diff --git a/www/common/common-history.js b/www/common/common-history.js index 23366f9a5..387f349fc 100644 --- a/www/common/common-history.js +++ b/www/common/common-history.js @@ -1,10 +1,8 @@ define([ 'jquery', '/bower_components/chainpad-crypto/crypto.js', - '/bower_components/chainpad/chainpad.dist.js', -], function ($, Crypto) { - var ChainPad = window.ChainPad; +], function ($, Crypto, ChainPad) { var History = {}; var getStates = function (rt) { diff --git a/www/common/cryptpad-common.js b/www/common/cryptpad-common.js index 5b850723c..96043ecd2 100644 --- a/www/common/cryptpad-common.js +++ b/www/common/cryptpad-common.js @@ -15,16 +15,36 @@ define([ '/file/file-crypto.js', '/common/common-realtime.js', '/common/common-language.js', - '/common/clipboard.js', '/common/pinpad.js', '/customize/application_config.js', '/common/media-tag.js', '/bower_components/nthen/index.js', '/bower_components/localforage/dist/localforage.min.js', -], function ($, Config, Messages, Store, Util, Hash, UI, History, UserList, Title, Metadata, - Messaging, Files, FileCrypto, Realtime, Language, Clipboard, - Pinpad, AppConfig, MediaTag, Nthen, localForage) { +], function ( + $, + Config, + Messages, + Store, + Util, + Hash, + UI, + History, + UserList, + Title, + Metadata, + Messaging, + Files, + FileCrypto, + Realtime, + Language, + Clipboard, + Pinpad, + AppConfig, + MediaTag, + Nthen, + localForage) +{ // Configure MediaTags to use our local viewer if (MediaTag && MediaTag.PdfPlugin) { diff --git a/www/common/sframe-app-framework.js b/www/common/sframe-app-framework.js index 7e3c6c537..7f055cc32 100644 --- a/www/common/sframe-app-framework.js +++ b/www/common/sframe-app-framework.js @@ -26,9 +26,9 @@ define([ Messages, Util, Thumb, - AppConfig) + AppConfig, + ChainPad) { - var ChainPad = window.ChainPad; var SaveAs = window.saveAs; var UNINITIALIZED = 'UNINITIALIZED'; diff --git a/www/common/sframe-chainpad-listmap.js b/www/common/sframe-chainpad-listmap.js index 3e5d9ab63..ce6c04a83 100644 --- a/www/common/sframe-chainpad-listmap.js +++ b/www/common/sframe-chainpad-listmap.js @@ -3,8 +3,7 @@ define([ '/bower_components/chainpad-netflux/chainpad-netflux.js', 'json.sortify', '/bower_components/chainpad/chainpad.dist.js' -], function (Realtime, Sortify) { - var ChainPad = window.ChainPad; +], function (Realtime, Sortify, ChainPad) { var api = {}; // "Proxy" is undefined in Safari : we need to use an normal object and check if there are local // changes regurlarly. diff --git a/www/common/sframe-chainpad-netflux-inner.js b/www/common/sframe-chainpad-netflux-inner.js index 4e2274db7..3e6ea43d2 100644 --- a/www/common/sframe-chainpad-netflux-inner.js +++ b/www/common/sframe-chainpad-netflux-inner.js @@ -18,8 +18,7 @@ define([ '/common/common-util.js', '/customize/application_config.js', '/bower_components/chainpad/chainpad.dist.js' -], function (Util, AppConfig) { - var ChainPad = window.ChainPad; +], function (Util, AppConfig, ChainPad) { var module = { exports: {} }; var badStateTimeout = typeof(AppConfig.badStateTimeout) === 'number' ? diff --git a/www/common/sframe-common-codemirror.js b/www/common/sframe-common-codemirror.js index e60314b7c..1f7f73f5f 100644 --- a/www/common/sframe-common-codemirror.js +++ b/www/common/sframe-common-codemirror.js @@ -4,11 +4,9 @@ define([ '/common/themes.js', '/common/cryptpad-common.js', '/common/text-cursor.js', - '/bower_components/chainpad/chainpad.dist.js' -], function ($, Modes, Themes, Cryptpad, TextCursor) { +], function ($, Modes, Themes, Cryptpad, TextCursor, ChainPad) { var module = {}; - var ChainPad = window.ChainPad; var cursorToPos = function(cursor, oldText) { var cLine = cursor.line; diff --git a/www/common/sframe-common-history.js b/www/common/sframe-common-history.js index 3c681b0e9..204b856df 100644 --- a/www/common/sframe-common-history.js +++ b/www/common/sframe-common-history.js @@ -1,8 +1,7 @@ define([ 'jquery', '/bower_components/chainpad/chainpad.dist.js', -], function ($) { - var ChainPad = window.ChainPad; +], function ($, ChainPad) { var History = {}; var getStates = function (rt) { diff --git a/www/common/text-cursor.js b/www/common/text-cursor.js index e8c0f9936..eaf33d0b3 100644 --- a/www/common/text-cursor.js +++ b/www/common/text-cursor.js @@ -22,4 +22,5 @@ define([ } transformCursor(ops); }; + return module.exports; }); \ No newline at end of file diff --git a/www/drive/inner.js b/www/drive/inner.js index bec410c58..66bcc95b7 100644 --- a/www/drive/inner.js +++ b/www/drive/inner.js @@ -17,7 +17,6 @@ define([ 'less!/customize/src/less2/main.less', ], function ( $, - TextPatcher, Toolbar, JSONSortify, Cryptpad, diff --git a/www/pad/inner.js b/www/pad/inner.js index fa605a44d..f048ebdef 100644 --- a/www/pad/inner.js +++ b/www/pad/inner.js @@ -30,9 +30,9 @@ define([ '/api/config', '/common/common-hash.js', '/common/common-util.js', + '/bower_components/chainpad/chainpad.dist.js', '/bower_components/diff-dom/diffDOM.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', @@ -49,10 +49,10 @@ define([ MediaTag, ApiConfig, Hash, - Util) + Util, + ChainPad) { var DiffDom = window.diffDOM; - var ChainPad = window.ChainPad; var slice = function (coll) { return Array.prototype.slice.call(coll); diff --git a/www/poll/inner.js b/www/poll/inner.js index be3e83ddd..53bba7ee0 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -15,6 +15,7 @@ define([ '/common/sframe-common-codemirror.js', '/common/sframe-common-interface.js', '/common/common-thumbnail.js', + '/bower_components/chainpad/chainpad.dist.js', 'cm/lib/codemirror', 'cm/addon/display/placeholder', @@ -22,7 +23,6 @@ define([ 'css!cm/lib/codemirror.css', '/bower_components/file-saver/FileSaver.min.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', @@ -44,11 +44,11 @@ define([ SframeCM, SFUI, Thumb, + ChainPad, CMeditor) { var Messages = Cryptpad.Messages; var saveAs = window.saveAs; - var ChainPad = window.ChainPad; var APP = window.APP = { unlocked: { @@ -675,7 +675,7 @@ define([ }; var updateDescription = function (old, n) { var o = APP.editor.getValue(); - SframeCM.setValueAndCursor(APP.editor, o, n, TextPatcher); + SframeCM.setValueAndCursor(APP.editor, o, n); updatePublishedDescription(); common.notify(); }; diff --git a/www/poll/render.js b/www/poll/render.js index 8eb3f1be5..460f8628b 100644 --- a/www/poll/render.js +++ b/www/poll/render.js @@ -3,12 +3,11 @@ define([ 'jquery', '/bower_components/hyperjson/hyperjson.js', '/common/text-cursor.js', + '/bower_components/chainpad/chainpad.dist.js', - '/bower_components/diff-dom/diffDOM.js', - '/bower_components/chainpad/chainpad.dist.js' -], function ($, Hyperjson, TextCursor) { + '/bower_components/diff-dom/diffDOM.js' +], function ($, Hyperjson, TextCursor, ChainPad) { var DiffDOM = window.diffDOM; - var ChainPad = window.ChainPad; var Example = { metadata: { diff --git a/www/whiteboard/inner.js b/www/whiteboard/inner.js index a70f1eaa3..f9fcfa1e8 100644 --- a/www/whiteboard/inner.js +++ b/www/whiteboard/inner.js @@ -15,10 +15,10 @@ define([ '/customize/application_config.js', '/common/common-thumbnail.js', '/whiteboard/colors.js', + '/bower_components/chainpad/chainpad.dist.js', '/bower_components/secure-fabric.js/dist/fabric.min.js', '/bower_components/file-saver/FileSaver.min.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', @@ -39,11 +39,11 @@ define([ Pages, AppConfig, Thumb, - Colors) + Colors, + ChainPad) { var saveAs = window.saveAs; var Messages = Cryptpad.Messages; - var ChainPad = window.ChainPad; var APP = window.APP = { Cryptpad: Cryptpad,