diff --git a/bower.json b/bower.json index 2b9c05687..0740b894d 100644 --- a/bower.json +++ b/bower.json @@ -29,10 +29,10 @@ "json.sortify": "~2.1.0", "secure-fabric.js": "secure-v1.7.9", "hyperjson": "~1.4.0", - "textpatcher": "^1.3.0", - "chainpad-json-validator": "^0.2.0", "chainpad-crypto": "^0.1.3", - "chainpad-listmap": "^0.3.0", + "chainpad-listmap": "git+https://git@github.com/xwiki-labs/chainpad-listmap.git#new-chainpad", + "chainpad": "git+https://git@github.com/xwiki-contrib/chainpad.git#transform-issues", + "chainpad-netflux": "^0.6.0", "file-saver": "1.3.1", "alertifyjs": "1.0.11", "scrypt-async": "1.2.0", diff --git a/www/code/inner.js b/www/code/inner.js index 5f2cf3df1..8e6f213f1 100644 --- a/www/code/inner.js +++ b/www/code/inner.js @@ -1,6 +1,5 @@ define([ 'jquery', - '/bower_components/textpatcher/TextPatcher.js', '/common/cryptpad-common.js', '/common/diffMarked.js', '/bower_components/nthen/index.js', @@ -38,7 +37,6 @@ define([ ], function ( $, - TextPatcher, Cryptpad, DiffMd, nThen, diff --git a/www/common/common-codemirror.js b/www/common/common-codemirror.js deleted file mode 100644 index a32d89af1..000000000 --- a/www/common/common-codemirror.js +++ /dev/null @@ -1,308 +0,0 @@ -define([ - 'jquery', - '/common/modes.js', - '/common/themes.js', - - '/bower_components/file-saver/FileSaver.min.js' -], function ($, Modes, Themes) { - var saveAs = window.saveAs; - var module = {}; - - module.create = function (ifrw, Cryptpad, defaultMode, CMeditor) { - var exp = {}; - var Messages = Cryptpad.Messages; - - var CodeMirror = exp.CodeMirror = CMeditor; - CodeMirror.modeURL = "cm/mode/%N/%N"; - - var $pad = $('#pad-iframe'); - var $textarea = exp.$textarea = $('#editor1'); - if (!$textarea.length) { $textarea = exp.$textarea = $pad.contents().find('#editor1'); } - - var Title; - var onLocal = function () {}; - var $rightside; - var $drawer; - exp.init = function (local, title, toolbar) { - if (typeof local === "function") { - onLocal = local; - } - Title = title; - $rightside = toolbar.$rightside; - $drawer = toolbar.$drawer; - }; - - var editor = exp.editor = CMeditor.fromTextArea($textarea[0], { - lineNumbers: true, - lineWrapping: true, - autoCloseBrackets: true, - matchBrackets : true, - showTrailingSpace : true, - styleActiveLine : true, - search: true, - highlightSelectionMatches: {showToken: /\w+/}, - extraKeys: {"Shift-Ctrl-R": undefined}, - foldGutter: true, - gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"], - mode: defaultMode || "javascript", - readOnly: true - }); - editor.setValue(Messages.codeInitialState); - - var setMode = exp.setMode = function (mode, cb) { - exp.highlightMode = mode; - if (mode !== "text") { - CMeditor.autoLoadMode(editor, mode); - } - editor.setOption('mode', mode); - if (exp.$language) { - var name = exp.$language.find('a[data-value="' + mode + '"]').text() || undefined; - name = name ? Messages.languageButton + ' ('+name+')' : Messages.languageButton; - exp.$language.setValue(mode, name); - } - if(cb) { cb(mode); } - }; - - var setTheme = exp.setTheme = (function () { - var path = '/common/theme/'; - - var $head = $(ifrw.document.head); - - var themeLoaded = exp.themeLoaded = function (theme) { - return $head.find('link[href*="'+theme+'"]').length; - }; - - var loadTheme = exp.loadTheme = function (theme) { - $head.append($('', { - rel: 'stylesheet', - href: path + theme + '.css', - })); - }; - - return function (theme, $select) { - if (!theme) { - editor.setOption('theme', 'default'); - } else { - if (!themeLoaded(theme)) { - loadTheme(theme); - } - editor.setOption('theme', theme); - } - if ($select) { - var name = theme || undefined; - name = name ? Messages.themeButton + ' ('+theme+')' : Messages.themeButton; - $select.setValue(theme, name); - } - }; - }()); - - exp.getHeadingText = function () { - var lines = editor.getValue().split(/\n/); - - var text = ''; - lines.some(function (line) { - // lines including a c-style comment are also valuable - var clike = /^\s*(\/\*|\/\/)(.*)?(\*\/)*$/; - if (clike.test(line)) { - line.replace(clike, function (a, one, two) { - if (!(two && two.replace)) { return; } - text = two.replace(/\*\/\s*$/, '').trim(); - }); - return true; - } - - // lisps? - var lispy = /^\s*(;|#\|)+(.*?)$/; - if (lispy.test(line)) { - line.replace(lispy, function (a, one, two) { - text = two; - }); - return true; - } - - // lines beginning with a hash are potentially valuable - // works for markdown, python, bash, etc. - var hash = /^#+(.*?)$/; - if (hash.test(line)) { - line.replace(hash, function (a, one) { - text = one; - }); - return true; - } - - // TODO make one more pass for multiline comments - }); - - return text.trim(); - }; - - exp.configureLanguage = function (cb, onModeChanged) { - var options = []; - Modes.list.forEach(function (l) { - options.push({ - tag: 'a', - attributes: { - 'data-value': l.mode, - 'href': '#', - }, - content: l.language // Pretty name of the language value - }); - }); - var dropdownConfig = { - text: 'Mode', // Button initial text - options: options, // Entries displayed in the menu - left: true, // Open to the left of the button - isSelect: true, - feedback: 'CODE_LANGUAGE', - }; - var $block = exp.$language = Cryptpad.createDropdown(dropdownConfig); - $block.find('button').attr('title', Messages.languageButtonTitle); - $block.find('a').click(function () { - setMode($(this).attr('data-value'), onModeChanged); - onLocal(); - }); - - if ($drawer) { $drawer.append($block); } - if (cb) { cb(); } - }; - - exp.configureTheme = function (cb) { - /* Remember the user's last choice of theme using localStorage */ - var themeKey = 'CRYPTPAD_CODE_THEME'; - var lastTheme = localStorage.getItem(themeKey) || 'default'; - - var options = []; - Themes.forEach(function (l) { - options.push({ - tag: 'a', - attributes: { - 'data-value': l.name, - 'href': '#', - }, - content: l.name // Pretty name of the language value - }); - }); - var dropdownConfig = { - text: 'Theme', // Button initial text - options: options, // Entries displayed in the menu - left: true, // Open to the left of the button - isSelect: true, - initialValue: lastTheme, - feedback: 'CODE_THEME', - }; - var $block = exp.$theme = Cryptpad.createDropdown(dropdownConfig); - $block.find('button').attr('title', Messages.themeButtonTitle); - - setTheme(lastTheme, $block); - - $block.find('a').click(function () { - var theme = $(this).attr('data-value'); - setTheme(theme, $block); - localStorage.setItem(themeKey, theme); - }); - - if ($drawer) { $drawer.append($block); } - if (cb) { cb(); } - }; - - exp.exportText = function () { - var text = editor.getValue(); - - var ext = Modes.extensionOf(exp.highlightMode); - - var title = Cryptpad.fixFileName(Title ? Title.suggestTitle('cryptpad') : "?") + (ext || '.txt'); - - Cryptpad.prompt(Messages.exportPrompt, title, function (filename) { - if (filename === null) { return; } - var blob = new Blob([text], { - type: 'text/plain;charset=utf-8' - }); - saveAs(blob, filename); - }); - }; - exp.importText = function (content, file) { - var $bar = ifrw.$('#cme_toolbox'); - var mode; - var mime = CodeMirror.findModeByMIME(file.type); - - if (!mime) { - var ext = /.+\.([^.]+)$/.exec(file.name); - if (ext[1]) { - mode = CMeditor.findModeByExtension(ext[1]); - mode = mode && mode.mode || null; - } - } else { - mode = mime && mime.mode || null; - } - - if (mode && Modes.list.some(function (o) { return o.mode === mode; })) { - setMode(mode); - $bar.find('#language-mode').val(mode); - } else { - console.log("Couldn't find a suitable highlighting mode: %s", mode); - setMode('text'); - $bar.find('#language-mode').val('text'); - } - - editor.setValue(content); - onLocal(); - }; - - var cursorToPos = function(cursor, oldText) { - var cLine = cursor.line; - var cCh = cursor.ch; - var pos = 0; - var textLines = oldText.split("\n"); - for (var line = 0; line <= cLine; line++) { - if(line < cLine) { - pos += textLines[line].length+1; - } - else if(line === cLine) { - pos += cCh; - } - } - return pos; - }; - - var posToCursor = function(position, newText) { - var cursor = { - line: 0, - ch: 0 - }; - var textLines = newText.substr(0, position).split("\n"); - cursor.line = textLines.length - 1; - cursor.ch = textLines[cursor.line].length; - return cursor; - }; - - exp.setValueAndCursor = function (oldDoc, remoteDoc, TextPatcher) { - var scroll = editor.getScrollInfo(); - //get old cursor here - var oldCursor = {}; - oldCursor.selectionStart = cursorToPos(editor.getCursor('from'), oldDoc); - oldCursor.selectionEnd = cursorToPos(editor.getCursor('to'), oldDoc); - - editor.setValue(remoteDoc); - editor.save(); - - var op = TextPatcher.diff(oldDoc, remoteDoc); - var selects = ['selectionStart', 'selectionEnd'].map(function (attr) { - return TextPatcher.transformCursor(oldCursor[attr], op); - }); - - if(selects[0] === selects[1]) { - editor.setCursor(posToCursor(selects[0], remoteDoc)); - } - else { - editor.setSelection(posToCursor(selects[0], remoteDoc), posToCursor(selects[1], remoteDoc)); - } - - editor.scrollTo(scroll.left, scroll.top); - }; - - return exp; - }; - - return module; -}); - diff --git a/www/common/common-history.js b/www/common/common-history.js index 6dea29ab7..23366f9a5 100644 --- a/www/common/common-history.js +++ b/www/common/common-history.js @@ -1,9 +1,9 @@ define([ 'jquery', - '/bower_components/chainpad-json-validator/json-ot.js', '/bower_components/chainpad-crypto/crypto.js', + '/bower_components/chainpad/chainpad.dist.js', -], function ($, JsonOT, Crypto) { +], function ($, Crypto) { var ChainPad = window.ChainPad; var History = {}; @@ -28,7 +28,7 @@ define([ return ChainPad.create({ userName: 'history', initialState: '', - transformFunction: JsonOT.validate, + patchTransformer: ChainPad.NaiveJSONStransformer, logLevel: 0, noPrune: true }); diff --git a/www/common/cryptget.js b/www/common/cryptget.js index cde78d298..a75e5c0f9 100644 --- a/www/common/cryptget.js +++ b/www/common/cryptget.js @@ -3,8 +3,7 @@ define([ '/bower_components/chainpad-crypto/crypto.js', '/bower_components/chainpad-netflux/chainpad-netflux.js', '/common/cryptpad-common.js', - '/bower_components/textpatcher/TextPatcher.js' -], function ($, Crypto, Realtime, Cryptpad, TextPatcher) { +], function ($, Crypto, Realtime, Cryptpad) { //var Messages = Cryptpad.Messages; //var noop = function () {}; var finish = function (S, err, doc) { @@ -72,9 +71,7 @@ define([ var realtime = Session.session = info.realtime; Session.network = info.network; - TextPatcher.create({ - realtime: realtime, - })(doc); + realtime.contentUpdate(doc); var to = window.setTimeout(function () { cb(new Error("Timeout")); diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 8a5b38c66..2effdfef1 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -11,11 +11,9 @@ define([ '/common/common-title.js', '/common/common-metadata.js', '/common/common-messaging.js', - '/common/common-codemirror.js', '/common/common-file.js', '/file/file-crypto.js', '/common/common-realtime.js', - '/common/clipboard.js', '/common/pinpad.js', '/customize/application_config.js', @@ -23,7 +21,7 @@ define([ '/bower_components/nthen/index.js', '/bower_components/localforage/dist/localforage.min.js', ], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata, - Messaging, CodeMirror, Files, FileCrypto, Realtime, Clipboard, + Messaging, Files, FileCrypto, Realtime, Clipboard, Pinpad, AppConfig, MediaTag, Nthen, localForage) { // Configure MediaTags to use our local viewer @@ -154,9 +152,6 @@ define([ // Metadata common.createMetadata = Metadata.create; - // CodeMirror - common.createCodemirror = CodeMirror.create; - // Files common.createFileManager = function (config) { return Files.create(common, config); }; diff --git a/www/common/fsStore.js b/www/common/fsStore.js index f24409d8b..26d4e9f63 100644 --- a/www/common/fsStore.js +++ b/www/common/fsStore.js @@ -2,10 +2,9 @@ define([ 'jquery', '/bower_components/chainpad-listmap/chainpad-listmap.js', '/bower_components/chainpad-crypto/crypto.js?v=0.1.5', - '/bower_components/textpatcher/TextPatcher.amd.js', '/common/userObject.js', '/common/migrate-user-object.js', -], function ($, Listmap, Crypto, TextPatcher, FO, Migrate) { +], function ($, Listmap, Crypto, FO, Migrate) { /* This module uses localStorage, which is synchronous, but exposes an asyncronous API. This is so that we can substitute other storage diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 342108678..7e3c6c537 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -2,9 +2,7 @@ define([ 'jquery', '/bower_components/hyperjson/hyperjson.js', '/common/toolbar3.js', - '/bower_components/chainpad-json-validator/json-ot.js', 'json.sortify', - '/bower_components/textpatcher/TextPatcher.js', '/common/cryptpad-common.js', '/bower_components/nthen/index.js', '/common/sframe-common.js', @@ -12,6 +10,7 @@ define([ '/common/common-util.js', '/common/common-thumbnail.js', '/customize/application_config.js', + '/bower_components/chainpad/chainpad.dist.js', 'css!/bower_components/bootstrap/dist/css/bootstrap.min.css', 'less!/bower_components/components-font-awesome/css/font-awesome.min.css', @@ -20,9 +19,7 @@ define([ $, Hyperjson, Toolbar, - JsonOT, JSONSortify, - TextPatcher, Cryptpad, nThen, SFCommon, @@ -31,6 +28,7 @@ define([ Thumb, AppConfig) { + var ChainPad = window.ChainPad; var SaveAs = window.saveAs; var UNINITIALIZED = 'UNINITIALIZED'; @@ -64,7 +62,6 @@ define([ var common; var cpNfInner; - var textPatcher; var readOnly; var title; var toolbar; @@ -182,10 +179,11 @@ define([ result in a feedback loop, which we call a browser fight */ // what changed? - var op = TextPatcher.diff(newContentStrNoMeta, newContent2StrNoMeta); + var ops = ChainPad.Diff.diff(newContentStrNoMeta, newContent2StrNoMeta); // log the changes - TextPatcher.log(newContentStrNoMeta, op); - var sop = JSON.stringify(TextPatcher.format(newContentStrNoMeta, op)); + console.log(newContentStrNoMeta); + console.log(ops); + var sop = JSON.stringify([ newContentStrNoMeta, ops ]); var fights = window.CryptPad_fights = window.CryptPad_fights || []; var index = fights.indexOf(sop); @@ -232,7 +230,7 @@ define([ } var contentStr = JSONSortify(content); - textPatcher(contentStr); + cpNfInner.chainpad.contentUpdate(contentStr); if (cpNfInner.chainpad.getUserDoc() !== contentStr) { console.error("realtime.getUserDoc() !== shjson"); } @@ -378,7 +376,7 @@ define([ }).nThen(function (waitFor) { cpNfInner = common.startRealtime({ // really basic operational transform - transformFunction: options.transformFunction || JsonOT.transform, + patchTransformer: options.patchTransformer || ChainPad.SmartJSONTransformer, // cryptpad debug logging (default is 1) // logLevel: 0, @@ -410,8 +408,6 @@ define([ cpNfInner.metadataMgr.onChange(checkReady); checkReady(); - textPatcher = TextPatcher.create({ realtime: cpNfInner.chainpad }); - var infiniteSpinnerModal = false; window.setInterval(function () { if (state === STATE.DISCONNECTED) { return; } diff --git a/www/common/sframe-chainpad-listmap.js b/www/common/sframe-chainpad-listmap.js index a4c63641d..3e5d9ab63 100644 --- a/www/common/sframe-chainpad-listmap.js +++ b/www/common/sframe-chainpad-listmap.js @@ -1,10 +1,10 @@ require.config({ paths: { 'json.sortify': '/bower_components/json.sortify/dist/JSON.sortify' } }); define([ '/bower_components/chainpad-netflux/chainpad-netflux.js', - '/bower_components/chainpad-json-validator/json-ot.js', 'json.sortify', - '/bower_components/textpatcher/TextPatcher.js', -], function (Realtime, JsonOT, Sortify, TextPatcher) { + '/bower_components/chainpad/chainpad.dist.js' +], function (Realtime, Sortify) { + var ChainPad = window.ChainPad; var api = {}; // "Proxy" is undefined in Safari : we need to use an normal object and check if there are local // changes regurlarly. @@ -627,7 +627,7 @@ define([ userName: cfg.userName, initialState: Sortify(cfg.data), readOnly: cfg.readOnly, - transformFunction: JsonOT.transform || JsonOT.validate, + patchTransformer: ChainPad.SmartJSONTransformer, logLevel: typeof(cfg.logLevel) === 'undefined'? 0: cfg.logLevel, validateContent: function (content) { try { @@ -650,7 +650,6 @@ define([ var realtime; var proxy; - var patchText; realtimeOptions.onRemote = function () { if (initializing) { return; } @@ -667,10 +666,10 @@ define([ var onLocal = realtimeOptions.onLocal = function () { if (initializing) { return; } var strung = isFakeProxy? DeepProxy.stringifyFakeProxy(proxy): Sortify(proxy); - patchText(strung); + realtime.contentUpdate(strung); // try harder - if (realtime.getUserDoc() !== strung) { patchText(strung); } + if (realtime.getUserDoc() !== strung) { realtime.contentUpdate(strung); } // onLocal if (cfg.onLocal) { cfg.onLocal(); } @@ -688,13 +687,8 @@ define([ var ready = false; realtimeOptions.onReady = function (info) { if (ready) { return; } - // create your patcher if (realtime !== info.realtime) { realtime = rt.realtime = info.realtime; - patchText = TextPatcher.create({ - realtime: realtime, - logging: cfg.logging || false, - }); } else { console.error(realtime); } diff --git a/www/common/sframe-chainpad-netflux-inner.js b/www/common/sframe-chainpad-netflux-inner.js index 0f150842c..4e2274db7 100644 --- a/www/common/sframe-chainpad-netflux-inner.js +++ b/www/common/sframe-chainpad-netflux-inner.js @@ -37,7 +37,7 @@ define([ var onReady = config.onReady || function () { }; var userName = config.userName; var initialState = config.initialState; - var transformFunction = config.transformFunction; + if (config.transformFunction) { throw new Error("transformFunction is nolonger allowed"); } var patchTransformer = config.patchTransformer; var validateContent = config.validateContent; var avgSyncMilliseconds = config.avgSyncMilliseconds; @@ -50,7 +50,6 @@ define([ var chainpad = ChainPad.create({ userName: userName, initialState: initialState, - transformFunction: transformFunction, patchTransformer: patchTransformer, validateContent: validateContent, avgSyncMilliseconds: avgSyncMilliseconds, diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index b7037164f..e60314b7c 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -3,9 +3,12 @@ define([ '/common/modes.js', '/common/themes.js', '/common/cryptpad-common.js', - '/bower_components/textpatcher/TextPatcher.js', -], function ($, Modes, Themes, Cryptpad, TextPatcher) { + '/common/text-cursor.js', + + '/bower_components/chainpad/chainpad.dist.js' +], function ($, Modes, Themes, Cryptpad, TextCursor) { var module = {}; + var ChainPad = window.ChainPad; var cursorToPos = function(cursor, oldText) { var cLine = cursor.line; @@ -34,7 +37,7 @@ define([ return cursor; }; - module.setValueAndCursor = function (editor, oldDoc, remoteDoc, TextPatcher) { + module.setValueAndCursor = function (editor, oldDoc, remoteDoc) { var scroll = editor.getScrollInfo(); //get old cursor here var oldCursor = {}; @@ -44,9 +47,9 @@ define([ editor.setValue(remoteDoc); editor.save(); - var op = TextPatcher.diff(oldDoc, remoteDoc); + var ops = ChainPad.Diff.diff(oldDoc, remoteDoc); var selects = ['selectionStart', 'selectionEnd'].map(function (attr) { - return TextPatcher.transformCursor(oldCursor[attr], op); + return TextCursor.transformCursor(oldCursor[attr], ops); }); if(selects[0] === selects[1]) { @@ -295,8 +298,8 @@ define([ return { content: content }; }; - exp.setValueAndCursor = function (oldDoc, remoteDoc, TextPatcher) { - return module.setValueAndCursor(editor, oldDoc, remoteDoc, TextPatcher); + exp.setValueAndCursor = function (oldDoc, remoteDoc) { + return module.setValueAndCursor(editor, oldDoc, remoteDoc); }; ///// @@ -308,7 +311,7 @@ define([ exp.contentUpdate = function (newContent) { var oldDoc = canonicalize($textarea.val()); var remoteDoc = newContent.content; - exp.setValueAndCursor(oldDoc, remoteDoc, TextPatcher); + exp.setValueAndCursor(oldDoc, remoteDoc); }; exp.getContent = function () { diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index 9167afc5f..3c681b0e9 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -1,8 +1,7 @@ define([ 'jquery', - '/bower_components/chainpad-json-validator/json-ot.js', '/bower_components/chainpad/chainpad.dist.js', -], function ($, JsonOT) { +], function ($) { var ChainPad = window.ChainPad; var History = {}; @@ -31,7 +30,7 @@ define([ } }, initialState: '', - transformFunction: JsonOT.validate, + patchTransformer: ChainPad.NaiveJSONTransformer, logLevel: 0, noPrune: true }); diff --git a/www/common/text-cursor.js b/www/common/text-cursor.js new file mode 100644 index 000000000..e8c0f9936 --- /dev/null +++ b/www/common/text-cursor.js @@ -0,0 +1,25 @@ +define([ +], function () { + var module = { exports: {} }; + var transformCursor = function (cursor, op) { + if (!op) { return cursor; } + var pos = op.offset; + var remove = op.toRemove; + var insert = op.toInsert.length; + if (typeof cursor === 'undefined') { return; } + if (typeof remove === 'number' && pos < cursor) { + cursor -= Math.min(remove, cursor - pos); + } + if (typeof insert === 'number' && pos < cursor) { + cursor += insert; + } + return cursor; + }; + module.exports.transformCursor = function (cursor, ops) { + if (Array.isArray(ops)) { + for (var i = ops.length - 1; i >= 0; i--) { transformCursor(cursor, ops[i]); } + return; + } + transformCursor(ops); + }; +}); \ No newline at end of file diff --git a/www/contacts/inner.js b/www/contacts/inner.js index 5bd342a48..e17192b8b 100644 --- a/www/contacts/inner.js +++ b/www/contacts/inner.js @@ -2,7 +2,6 @@ define([ 'jquery', '/bower_components/chainpad-crypto/crypto.js', '/common/toolbar3.js', - '/bower_components/chainpad-json-validator/json-ot.js', '/common/cryptpad-common.js', '/bower_components/nthen/index.js', '/common/sframe-common.js', @@ -17,7 +16,6 @@ define([ $, Crypto, Toolbar, - JsonOT, Cryptpad, nThen, SFCommon, diff --git a/www/drive/inner.js b/www/drive/inner.js index 864b2038d..bec410c58 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -1,6 +1,5 @@ define([ 'jquery', - '/bower_components/textpatcher/TextPatcher.js', '/common/toolbar3.js', 'json.sortify', '/common/cryptpad-common.js', @@ -2940,12 +2939,7 @@ define([ var rt = APP.rt = Listmap.create(listmapConfig); proxy = rt.proxy; var onCreate = function (info) { - var realtime = APP.realtime = info.realtime; - - APP.patchText = TextPatcher.create({ - realtime: realtime, - logging: true, - }); + APP.realtime = info.realtime; metadataMgr = common.getMetadataMgr(); diff --git a/www/examples/board/board.js b/www/examples/board/board.js deleted file mode 100644 index eec92e681..000000000 --- a/www/examples/board/board.js +++ /dev/null @@ -1,242 +0,0 @@ -define([ - 'jquery' -],function ($) { - var Board = {}; - var proxy; - - var Uid = function (prefix) { - return function () { - return prefix + Number(Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)) - .toString(32).replace(/\./g, ''); - }; - }; - - var removeUid = function (A, e) { - var i = A.indexOf(e); - if (i === -1) { return -1; } - A.splice(i, 1); - return i; - }; - - var luid = Board.luid = Uid('l-'); // list-uid - var cuid = Board.cuid = Uid('c-'); // card uid - - var Input = Board.Input = function (opt) { - return $('', opt); - }; - - /* - populate the proxy with all the relevant fields - return boolean whether you are the first user - */ - Board.initialize = function (_proxy) { - proxy = _proxy; - var first = false; - - ['listOrder'].forEach(function (k) { - if (typeof(proxy[k]) === 'undefined') { - first = true; - proxy[k] = []; - } - }); - - ['lists', 'cards'].forEach(function (k) { - if (typeof(proxy[k]) === 'undefined') { - proxy[k] = {}; - } - }); - - return first; - }; - - /* - * a list is appended to the extant order - */ - var List = Board.List = function (id) { - if (!id) { - id = List.create(); - } - - var $input = Input({ - type: 'text', - placeholder: 'list title', - }) - .addClass('list-title') - .on('keyup change', function () { - var val = $input.val(); - proxy.lists[id].title = val; - }); - - var $cards = $('
Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae
, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis.
- -Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus magna. Cras in mi at felis aliquet congue. Ut a est eget ligula molestie gravida. Curabitur massa. Donec eleifend, libero at sagittis mollis, tellus est malesuada tellus, at luctus turpis elit sit amet quam. Vivamus pretium ornare est.
-#header h1 a {
- display: block;
- width: 300px;
- height: 80px;
-}
-
-
-th 1 | -th 2 | -
---|---|
one | -two | -
three | -four | -