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

This commit is contained in:
Caleb James DeLisle
2017-11-09 17:07:04 +01:00
parent 840cd91bcb
commit 7b62a8042e
13 changed files with 44 additions and 32 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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