This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.acorn = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | |
// The main exported interface (under `self.acorn` when in the | |
// browser) is a `parse` function that takes a code string and | |
// returns an abstract syntax tree as specified by |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This is a collaborative editing protocol I came up with. Like OT, it | |
is change-based, not diff-based. But it is much easier to verify that | |
clients end up converging, because they all end up applying the | |
modifications in the same order (so that they _have to converge_, if | |
they are using the same algorithm). | |
Clients start with same version + version number | |
When a client makes a change, that is locally applied and a description |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"!name": "node_modules/cocos2d/src/global.js", | |
"!define": { | |
"String.prototype._observingFunctions.<i>": { | |
"!span": "4511[148:60]-4552[148:101]" | |
}, | |
"util.each.!1": { | |
"!type": "fn(mod: string|?, i: number)", | |
"!span": "9868[339:27]-10050[342:9]" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"!name": "node_modules/cocos2d/src/global.js", | |
"!define": { | |
"String.prototype._observingFunctions.<i>": { | |
"!span": "4511[148:60]-4552[148:101]" | |
}, | |
"util.each.!1": { | |
"!type": "fn(mod: string|?, i: number)", | |
"!span": "9868[339:27]-10050[342:9]" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<title>CodeMirror: merge view demo</title> | |
<meta charset="utf-8"/> | |
<link rel=stylesheet href="../doc/docs.css"> | |
<link rel=stylesheet href="../lib/codemirror.css"> | |
<link rel=stylesheet href="../addon/merge/merge.css"> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js"></script> | |
<style> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Pos} from "../src/model" | |
function rangeFromTransform(tr) { | |
let from, to | |
for (let i = 0; i < tr.steps.length; i++) { | |
let step = tr.steps[i], map = tr.maps[i] | |
let stepFrom = map.map(step.from || step.pos, -1).pos | |
let stepTo = map.map(step.to || step.pos, 1).pos | |
from = from ? map.map(from, -1).pos.min(stepFrom) : stepFrom | |
to = to ? map.map(to, 1).pos.max(stepTo) : stepTo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<div contenteditable=true style="border: 1px solid black">Foo bar</div> | |
<p>Put the cursor at the start of the editable content above, so | |
that the keyboard is in uppercase mode. Then press <button>this | |
button</button> to move the cursor to the end of 'foo'. Note that the | |
keyboard stays in uppercase mode althrough lowercase would be | |
appropriate for the new context.</p> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function changedRanges(history, group) { | |
let ranges = [] | |
history.forEach((step, i) => { | |
let map = step.posMap() | |
ranges = ranges.map(range => { | |
let from = map.map(range.from, 1), to = Math.max(from, map.map(range.to, -1)) | |
return {from, to} | |
}) | |
if (group.indexOf(i) > -1) { | |
let newRanges = [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let links = document.querySelectorAll("a[href]") | |
let base = /^[^#]*/.exec(document.location)[0] + "#" | |
for (let i = 0; i < links.length; i++) { | |
let link = links[i], anchor | |
if (link.href.indexOf(base) == 0 && !document.getElementById(anchor = decodeURIComponent(link.href.slice(base.length)))) | |
console.log("Missing anchor: " + anchor) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const {EditorState, Selection} = require("prosemirror-state") | |
const {MenuBarEditorView} = require("prosemirror-menu") | |
const {DOMParser, DOMSerializer, Schema} = require("prosemirror-model") | |
const {schema: baseSchema} = require("prosemirror-schema-basic") | |
const {exampleSetup} = require("prosemirror-example-setup") | |
const {keymap} = require("prosemirror-keymap") | |
const CodeMirror = require("codemirror") | |
require("codemirror/mode/javascript/javascript") | |
let view, menuView, schema = new Schema({ |