Remove TextPatcher and begin to include ChainPad directly using requirejs instead of sniffing off the window

pull/1/head
Caleb James DeLisle 7 years ago
parent 840cd91bcb
commit 7b62a8042e

@ -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) {

@ -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) {

@ -26,9 +26,9 @@ define([
Messages,
Util,
Thumb,
AppConfig)
AppConfig,
ChainPad)
{
var ChainPad = window.ChainPad;
var SaveAs = window.saveAs;
var UNINITIALIZED = 'UNINITIALIZED';

@ -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.

@ -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' ?

@ -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;

@ -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) {

@ -22,4 +22,5 @@ define([
}
transformCursor(ops);
};
return module.exports;
});

@ -17,7 +17,6 @@ define([
'less!/customize/src/less2/main.less',
], function (
$,
TextPatcher,
Toolbar,
JSONSortify,
Cryptpad,

@ -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);

@ -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();
};

@ -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: {

@ -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,

Loading…
Cancel
Save