bedrock_sass 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/_vendor/tinymce/plugins/advlist/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.js +428 -0
- data/assets/_vendor/tinymce/plugins/advlist/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/anchor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/anchor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autolink/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.js +404 -0
- data/assets/_vendor/tinymce/plugins/autolink/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autoresize/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.js +451 -0
- data/assets/_vendor/tinymce/plugins/autoresize/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/autosave/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.js +608 -0
- data/assets/_vendor/tinymce/plugins/autosave/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/bbcode/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.js +264 -0
- data/assets/_vendor/tinymce/plugins/bbcode/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/charmap/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.js +850 -0
- data/assets/_vendor/tinymce/plugins/charmap/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/code/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.js +338 -0
- data/assets/_vendor/tinymce/plugins/code/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/codesample/css/prism.css +138 -0
- data/assets/_vendor/tinymce/plugins/codesample/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.js +1582 -0
- data/assets/_vendor/tinymce/plugins/codesample/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.js +272 -0
- data/assets/_vendor/tinymce/plugins/colorpicker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.js +496 -0
- data/assets/_vendor/tinymce/plugins/contextmenu/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/directionality/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.js +270 -0
- data/assets/_vendor/tinymce/plugins/directionality/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cool.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-cry.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-embarassed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-foot-in-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-frown.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-innocent.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-kiss.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-laughing.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-money-mouth.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-sealed.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-smile.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-surprised.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-tongue-out.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-undecided.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-wink.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/img/smiley-yell.gif +0 -0
- data/assets/_vendor/tinymce/plugins/emoticons/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.js +256 -0
- data/assets/_vendor/tinymce/plugins/emoticons/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullpage/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.js +962 -0
- data/assets/_vendor/tinymce/plugins/fullpage/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.js +455 -0
- data/assets/_vendor/tinymce/plugins/fullscreen/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/help/img/logo.png +0 -0
- data/assets/_vendor/tinymce/plugins/help/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.js +1527 -0
- data/assets/_vendor/tinymce/plugins/help/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/hr/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.js +195 -0
- data/assets/_vendor/tinymce/plugins/hr/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/image/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.js +1572 -0
- data/assets/_vendor/tinymce/plugins/image/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/imagetools/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.js +4444 -0
- data/assets/_vendor/tinymce/plugins/imagetools/plugin.min.js +2 -0
- data/assets/_vendor/tinymce/plugins/importcss/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.js +577 -0
- data/assets/_vendor/tinymce/plugins/importcss/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.js +482 -0
- data/assets/_vendor/tinymce/plugins/insertdatetime/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.js +395 -0
- data/assets/_vendor/tinymce/plugins/legacyoutput/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/link/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.js +1231 -0
- data/assets/_vendor/tinymce/plugins/link/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/lists/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.js +1985 -0
- data/assets/_vendor/tinymce/plugins/lists/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/media/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.js +2026 -0
- data/assets/_vendor/tinymce/plugins/media/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.js +313 -0
- data/assets/_vendor/tinymce/plugins/nonbreaking/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/noneditable/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.js +316 -0
- data/assets/_vendor/tinymce/plugins/noneditable/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.js +354 -0
- data/assets/_vendor/tinymce/plugins/pagebreak/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/paste/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.js +2935 -0
- data/assets/_vendor/tinymce/plugins/paste/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/preview/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.js +410 -0
- data/assets/_vendor/tinymce/plugins/preview/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/print/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.js +194 -0
- data/assets/_vendor/tinymce/plugins/print/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/save/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.js +370 -0
- data/assets/_vendor/tinymce/plugins/save/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.js +977 -0
- data/assets/_vendor/tinymce/plugins/searchreplace/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.js +1419 -0
- data/assets/_vendor/tinymce/plugins/spellchecker/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.js +419 -0
- data/assets/_vendor/tinymce/plugins/tabfocus/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/table/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.js +15527 -0
- data/assets/_vendor/tinymce/plugins/table/plugin.min.js +5 -0
- data/assets/_vendor/tinymce/plugins/template/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.js +807 -0
- data/assets/_vendor/tinymce/plugins/template/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textcolor/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.js +619 -0
- data/assets/_vendor/tinymce/plugins/textcolor/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/textpattern/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.js +718 -0
- data/assets/_vendor/tinymce/plugins/textpattern/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/toc/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.js +559 -0
- data/assets/_vendor/tinymce/plugins/toc/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/css/visualblocks.css +154 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.js +459 -0
- data/assets/_vendor/tinymce/plugins/visualblocks/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/visualchars/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.js +1325 -0
- data/assets/_vendor/tinymce/plugins/visualchars/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/plugins/wordcount/index.js +7 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.js +735 -0
- data/assets/_vendor/tinymce/plugins/wordcount/plugin.min.js +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.inline.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/content.mobile.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-mobile.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.svg +63 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce-small.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.eot +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.svg +131 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.ttf +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/fonts/tinymce.woff +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/anchor.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/loader.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/object.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/img/trans.gif +0 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.min.css +1 -0
- data/assets/_vendor/tinymce/skins/lightgray/skin.mobile.min.css +2 -0
- data/assets/_vendor/tinymce/themes/inlite/index.js +7 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.js +18787 -0
- data/assets/_vendor/tinymce/themes/inlite/theme.min.js +5 -0
- data/assets/_vendor/tinymce/themes/mobile/index.js +7 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.js +23384 -0
- data/assets/_vendor/tinymce/themes/mobile/theme.min.js +8 -0
- data/assets/_vendor/tinymce/themes/modern/index.js +7 -0
- data/assets/_vendor/tinymce/themes/modern/theme.js +18311 -0
- data/assets/_vendor/tinymce/themes/modern/theme.min.js +5 -0
- data/assets/_vendor/tinymce/tinymce.js +44399 -0
- data/assets/bedrock/js/bedrock.js +16587 -6193
- data/assets/bedrock/scss/_bedrock-components.scss +16 -0
- data/assets/bedrock/scss/_bedrock-settings.scss +15 -0
- data/assets/bedrock/scss/components/attachments-grid.scss +138 -0
- data/assets/bedrock/scss/components/dropzone-upload.scss +158 -0
- data/assets/bedrock/scss/components/global.scss +16 -8
- data/assets/bedrock/scss/components/helper-classes.scss +59 -0
- data/assets/bedrock/scss/components/inline-edit-box.scss +80 -0
- data/assets/bedrock/scss/components/login-box.scss +48 -0
- data/assets/bedrock/scss/components/no-content.scss +31 -0
- data/assets/bedrock/scss/components/off-canvas-menu.scss +1 -1
- data/assets/bedrock/scss/components/page-content.scss +51 -0
- data/assets/bedrock/scss/components/reveal-panel.scss +89 -0
- data/assets/bedrock/scss/components/select-box.scss +332 -0
- data/assets/bedrock/scss/components/tiny-mce-editor.scss +14 -7
- data/lib/bedrock_sass.rb +6 -0
- data/lib/bedrock_sass/engine.rb +8 -0
- data/lib/bedrock_sass/version.rb +1 -1
- data/lib/tasks/before_assets_precompile.rake +11 -0
- metadata +188 -2
@@ -0,0 +1 @@
|
|
1
|
+
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("4",tinymce.util.Tools.resolve),g("1",["4"],function(a){return a("tinymce.PluginManager")}),g("2",[],function(){var a=function(a){a.addCommand("mcePrint",function(){a.getWin().print()})};return{register:a}}),g("3",[],function(){var a=function(a){a.addButton("print",{title:"Print",cmd:"mcePrint"}),a.addMenuItem("print",{text:"Print",cmd:"mcePrint",icon:"print"})};return{register:a}}),g("0",["1","2","3"],function(a,b,c){return a.add("print",function(a){b.register(a),c.register(a),a.addShortcut("Meta+P","","mcePrint")}),function(){}}),d("0")()}();
|
@@ -0,0 +1,370 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["tinymce.plugins.save.Plugin","tinymce.core.PluginManager","tinymce.plugins.save.api.Commands","tinymce.plugins.save.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.save.core.Actions","tinymce.plugins.save.api.Settings","tinymce.core.dom.DOMUtils","tinymce.core.util.Tools"]
|
85
|
+
jsc*/
|
86
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
87
|
+
/**
|
88
|
+
* ResolveGlobal.js
|
89
|
+
*
|
90
|
+
* Released under LGPL License.
|
91
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
92
|
+
*
|
93
|
+
* License: http://www.tinymce.com/license
|
94
|
+
* Contributing: http://www.tinymce.com/contributing
|
95
|
+
*/
|
96
|
+
|
97
|
+
define(
|
98
|
+
'tinymce.core.PluginManager',
|
99
|
+
[
|
100
|
+
'global!tinymce.util.Tools.resolve'
|
101
|
+
],
|
102
|
+
function (resolve) {
|
103
|
+
return resolve('tinymce.PluginManager');
|
104
|
+
}
|
105
|
+
);
|
106
|
+
|
107
|
+
/**
|
108
|
+
* ResolveGlobal.js
|
109
|
+
*
|
110
|
+
* Released under LGPL License.
|
111
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
112
|
+
*
|
113
|
+
* License: http://www.tinymce.com/license
|
114
|
+
* Contributing: http://www.tinymce.com/contributing
|
115
|
+
*/
|
116
|
+
|
117
|
+
define(
|
118
|
+
'tinymce.core.dom.DOMUtils',
|
119
|
+
[
|
120
|
+
'global!tinymce.util.Tools.resolve'
|
121
|
+
],
|
122
|
+
function (resolve) {
|
123
|
+
return resolve('tinymce.dom.DOMUtils');
|
124
|
+
}
|
125
|
+
);
|
126
|
+
|
127
|
+
/**
|
128
|
+
* ResolveGlobal.js
|
129
|
+
*
|
130
|
+
* Released under LGPL License.
|
131
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
132
|
+
*
|
133
|
+
* License: http://www.tinymce.com/license
|
134
|
+
* Contributing: http://www.tinymce.com/contributing
|
135
|
+
*/
|
136
|
+
|
137
|
+
define(
|
138
|
+
'tinymce.core.util.Tools',
|
139
|
+
[
|
140
|
+
'global!tinymce.util.Tools.resolve'
|
141
|
+
],
|
142
|
+
function (resolve) {
|
143
|
+
return resolve('tinymce.util.Tools');
|
144
|
+
}
|
145
|
+
);
|
146
|
+
|
147
|
+
/**
|
148
|
+
* Settings.js
|
149
|
+
*
|
150
|
+
* Released under LGPL License.
|
151
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
152
|
+
*
|
153
|
+
* License: http://www.tinymce.com/license
|
154
|
+
* Contributing: http://www.tinymce.com/contributing
|
155
|
+
*/
|
156
|
+
|
157
|
+
define(
|
158
|
+
'tinymce.plugins.save.api.Settings',
|
159
|
+
[
|
160
|
+
],
|
161
|
+
function () {
|
162
|
+
var enableWhenDirty = function (editor) {
|
163
|
+
return editor.getParam('save_enablewhendirty', true);
|
164
|
+
};
|
165
|
+
|
166
|
+
var hasOnSaveCallback = function (editor) {
|
167
|
+
return !!editor.getParam('save_onsavecallback');
|
168
|
+
};
|
169
|
+
|
170
|
+
var hasOnCancelCallback = function (editor) {
|
171
|
+
return !!editor.getParam('save_oncancelcallback');
|
172
|
+
};
|
173
|
+
|
174
|
+
return {
|
175
|
+
enableWhenDirty: enableWhenDirty,
|
176
|
+
hasOnSaveCallback: hasOnSaveCallback,
|
177
|
+
hasOnCancelCallback: hasOnCancelCallback
|
178
|
+
};
|
179
|
+
}
|
180
|
+
);
|
181
|
+
/**
|
182
|
+
* Actions.js
|
183
|
+
*
|
184
|
+
* Released under LGPL License.
|
185
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
186
|
+
*
|
187
|
+
* License: http://www.tinymce.com/license
|
188
|
+
* Contributing: http://www.tinymce.com/contributing
|
189
|
+
*/
|
190
|
+
|
191
|
+
define(
|
192
|
+
'tinymce.plugins.save.core.Actions',
|
193
|
+
[
|
194
|
+
'tinymce.core.dom.DOMUtils',
|
195
|
+
'tinymce.core.util.Tools',
|
196
|
+
'tinymce.plugins.save.api.Settings'
|
197
|
+
],
|
198
|
+
function (DOMUtils, Tools, Settings) {
|
199
|
+
var displayErrorMessage = function (editor, message) {
|
200
|
+
editor.notificationManager.open({
|
201
|
+
text: editor.translate(message),
|
202
|
+
type: 'error'
|
203
|
+
});
|
204
|
+
};
|
205
|
+
|
206
|
+
var save = function (editor) {
|
207
|
+
var formObj;
|
208
|
+
|
209
|
+
formObj = DOMUtils.DOM.getParent(editor.id, 'form');
|
210
|
+
|
211
|
+
if (Settings.enableWhenDirty(editor) && !editor.isDirty()) {
|
212
|
+
return;
|
213
|
+
}
|
214
|
+
|
215
|
+
editor.save();
|
216
|
+
|
217
|
+
// Use callback instead
|
218
|
+
if (Settings.hasOnSaveCallback(editor)) {
|
219
|
+
editor.execCallback('save_onsavecallback', editor);
|
220
|
+
editor.nodeChanged();
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
|
224
|
+
if (formObj) {
|
225
|
+
editor.setDirty(false);
|
226
|
+
|
227
|
+
if (!formObj.onsubmit || formObj.onsubmit()) {
|
228
|
+
if (typeof formObj.submit === 'function') {
|
229
|
+
formObj.submit();
|
230
|
+
} else {
|
231
|
+
displayErrorMessage(editor, 'Error: Form submit field collision.');
|
232
|
+
}
|
233
|
+
}
|
234
|
+
|
235
|
+
editor.nodeChanged();
|
236
|
+
} else {
|
237
|
+
displayErrorMessage(editor, 'Error: No form element found.');
|
238
|
+
}
|
239
|
+
};
|
240
|
+
|
241
|
+
var cancel = function (editor) {
|
242
|
+
var h = Tools.trim(editor.startContent);
|
243
|
+
|
244
|
+
// Use callback instead
|
245
|
+
if (Settings.hasOnCancelCallback(editor)) {
|
246
|
+
editor.execCallback('save_oncancelcallback', editor);
|
247
|
+
return;
|
248
|
+
}
|
249
|
+
|
250
|
+
editor.setContent(h);
|
251
|
+
editor.undoManager.clear();
|
252
|
+
editor.nodeChanged();
|
253
|
+
};
|
254
|
+
|
255
|
+
return {
|
256
|
+
save: save,
|
257
|
+
cancel: cancel
|
258
|
+
};
|
259
|
+
}
|
260
|
+
);
|
261
|
+
/**
|
262
|
+
* Commands.js
|
263
|
+
*
|
264
|
+
* Released under LGPL License.
|
265
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
266
|
+
*
|
267
|
+
* License: http://www.tinymce.com/license
|
268
|
+
* Contributing: http://www.tinymce.com/contributing
|
269
|
+
*/
|
270
|
+
|
271
|
+
define(
|
272
|
+
'tinymce.plugins.save.api.Commands',
|
273
|
+
[
|
274
|
+
'tinymce.plugins.save.core.Actions'
|
275
|
+
],
|
276
|
+
function (Actions) {
|
277
|
+
var register = function (editor) {
|
278
|
+
editor.addCommand('mceSave', function () {
|
279
|
+
Actions.save(editor);
|
280
|
+
});
|
281
|
+
|
282
|
+
editor.addCommand('mceCancel', function () {
|
283
|
+
Actions.cancel(editor);
|
284
|
+
});
|
285
|
+
};
|
286
|
+
|
287
|
+
return {
|
288
|
+
register: register
|
289
|
+
};
|
290
|
+
}
|
291
|
+
);
|
292
|
+
/**
|
293
|
+
* Buttons.js
|
294
|
+
*
|
295
|
+
* Released under LGPL License.
|
296
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
297
|
+
*
|
298
|
+
* License: http://www.tinymce.com/license
|
299
|
+
* Contributing: http://www.tinymce.com/contributing
|
300
|
+
*/
|
301
|
+
|
302
|
+
define(
|
303
|
+
'tinymce.plugins.save.ui.Buttons',
|
304
|
+
[
|
305
|
+
'tinymce.plugins.save.api.Settings'
|
306
|
+
],
|
307
|
+
function (Settings) {
|
308
|
+
var stateToggle = function (editor) {
|
309
|
+
return function (e) {
|
310
|
+
var ctrl = e.control;
|
311
|
+
|
312
|
+
editor.on('nodeChange dirty', function () {
|
313
|
+
ctrl.disabled(Settings.enableWhenDirty(editor) && !editor.isDirty());
|
314
|
+
});
|
315
|
+
};
|
316
|
+
};
|
317
|
+
|
318
|
+
var register = function (editor) {
|
319
|
+
editor.addButton('save', {
|
320
|
+
icon: 'save',
|
321
|
+
text: 'Save',
|
322
|
+
cmd: 'mceSave',
|
323
|
+
disabled: true,
|
324
|
+
onPostRender: stateToggle(editor)
|
325
|
+
});
|
326
|
+
|
327
|
+
editor.addButton('cancel', {
|
328
|
+
text: 'Cancel',
|
329
|
+
icon: false,
|
330
|
+
cmd: 'mceCancel',
|
331
|
+
disabled: true,
|
332
|
+
onPostRender: stateToggle(editor)
|
333
|
+
});
|
334
|
+
|
335
|
+
editor.addShortcut('Meta+S', '', 'mceSave');
|
336
|
+
};
|
337
|
+
|
338
|
+
return {
|
339
|
+
register: register
|
340
|
+
};
|
341
|
+
}
|
342
|
+
);
|
343
|
+
/**
|
344
|
+
* Plugin.js
|
345
|
+
*
|
346
|
+
* Released under LGPL License.
|
347
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
348
|
+
*
|
349
|
+
* License: http://www.tinymce.com/license
|
350
|
+
* Contributing: http://www.tinymce.com/contributing
|
351
|
+
*/
|
352
|
+
|
353
|
+
define(
|
354
|
+
'tinymce.plugins.save.Plugin',
|
355
|
+
[
|
356
|
+
'tinymce.core.PluginManager',
|
357
|
+
'tinymce.plugins.save.api.Commands',
|
358
|
+
'tinymce.plugins.save.ui.Buttons'
|
359
|
+
],
|
360
|
+
function (PluginManager, Commands, Buttons) {
|
361
|
+
PluginManager.add('save', function (editor) {
|
362
|
+
Buttons.register(editor);
|
363
|
+
Commands.register(editor);
|
364
|
+
});
|
365
|
+
|
366
|
+
return function () { };
|
367
|
+
}
|
368
|
+
);
|
369
|
+
dem('tinymce.plugins.save.Plugin')();
|
370
|
+
})();
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(){var a={},b=function(b){for(var c=a[b],e=c.deps,f=c.defn,g=e.length,h=new Array(g),i=0;i<g;++i)h[i]=d(e[i]);var j=f.apply(null,h);if(void 0===j)throw"module ["+b+"] returned undefined";c.instance=j},c=function(b,c,d){if("string"!=typeof b)throw"module id must be a string";if(void 0===c)throw"no dependencies for "+b;if(void 0===d)throw"no definition function for "+b;a[b]={deps:c,defn:d,instance:void 0}},d=function(c){var d=a[c];if(void 0===d)throw"module ["+c+"] was undefined";return void 0===d.instance&&b(c),d.instance},e=function(a,b){for(var c=a.length,e=new Array(c),f=0;f<c;++f)e[f]=d(a[f]);b.apply(null,e)},f={};f.bolt={module:{api:{define:c,require:e,demand:d}}};var g=c,h=function(a,b){g(a,[],function(){return b})};h("4",tinymce.util.Tools.resolve),g("1",["4"],function(a){return a("tinymce.PluginManager")}),g("7",["4"],function(a){return a("tinymce.dom.DOMUtils")}),g("8",["4"],function(a){return a("tinymce.util.Tools")}),g("6",[],function(){var a=function(a){return a.getParam("save_enablewhendirty",!0)},b=function(a){return!!a.getParam("save_onsavecallback")},c=function(a){return!!a.getParam("save_oncancelcallback")};return{enableWhenDirty:a,hasOnSaveCallback:b,hasOnCancelCallback:c}}),g("5",["7","8","6"],function(a,b,c){var d=function(a,b){a.notificationManager.open({text:a.translate(b),type:"error"})},e=function(b){var e;if(e=a.DOM.getParent(b.id,"form"),!c.enableWhenDirty(b)||b.isDirty())return b.save(),c.hasOnSaveCallback(b)?(b.execCallback("save_onsavecallback",b),void b.nodeChanged()):void(e?(b.setDirty(!1),e.onsubmit&&!e.onsubmit()||("function"==typeof e.submit?e.submit():d(b,"Error: Form submit field collision.")),b.nodeChanged()):d(b,"Error: No form element found."))},f=function(a){var d=b.trim(a.startContent);return c.hasOnCancelCallback(a)?void a.execCallback("save_oncancelcallback",a):(a.setContent(d),a.undoManager.clear(),void a.nodeChanged())};return{save:e,cancel:f}}),g("2",["5"],function(a){var b=function(b){b.addCommand("mceSave",function(){a.save(b)}),b.addCommand("mceCancel",function(){a.cancel(b)})};return{register:b}}),g("3",["6"],function(a){var b=function(b){return function(c){var d=c.control;b.on("nodeChange dirty",function(){d.disabled(a.enableWhenDirty(b)&&!b.isDirty())})}},c=function(a){a.addButton("save",{icon:"save",text:"Save",cmd:"mceSave",disabled:!0,onPostRender:b(a)}),a.addButton("cancel",{text:"Cancel",icon:!1,cmd:"mceCancel",disabled:!0,onPostRender:b(a)}),a.addShortcut("Meta+S","","mceSave")};return{register:c}}),g("0",["1","2","3"],function(a,b,c){return a.add("save",function(a){c.register(a),b.register(a)}),function(){}}),d("0")()}();
|
@@ -0,0 +1,977 @@
|
|
1
|
+
(function () {
|
2
|
+
|
3
|
+
var defs = {}; // id -> {dependencies, definition, instance (possibly undefined)}
|
4
|
+
|
5
|
+
// Used when there is no 'main' module.
|
6
|
+
// The name is probably (hopefully) unique so minification removes for releases.
|
7
|
+
var register_3795 = function (id) {
|
8
|
+
var module = dem(id);
|
9
|
+
var fragments = id.split('.');
|
10
|
+
var target = Function('return this;')();
|
11
|
+
for (var i = 0; i < fragments.length - 1; ++i) {
|
12
|
+
if (target[fragments[i]] === undefined)
|
13
|
+
target[fragments[i]] = {};
|
14
|
+
target = target[fragments[i]];
|
15
|
+
}
|
16
|
+
target[fragments[fragments.length - 1]] = module;
|
17
|
+
};
|
18
|
+
|
19
|
+
var instantiate = function (id) {
|
20
|
+
var actual = defs[id];
|
21
|
+
var dependencies = actual.deps;
|
22
|
+
var definition = actual.defn;
|
23
|
+
var len = dependencies.length;
|
24
|
+
var instances = new Array(len);
|
25
|
+
for (var i = 0; i < len; ++i)
|
26
|
+
instances[i] = dem(dependencies[i]);
|
27
|
+
var defResult = definition.apply(null, instances);
|
28
|
+
if (defResult === undefined)
|
29
|
+
throw 'module [' + id + '] returned undefined';
|
30
|
+
actual.instance = defResult;
|
31
|
+
};
|
32
|
+
|
33
|
+
var def = function (id, dependencies, definition) {
|
34
|
+
if (typeof id !== 'string')
|
35
|
+
throw 'module id must be a string';
|
36
|
+
else if (dependencies === undefined)
|
37
|
+
throw 'no dependencies for ' + id;
|
38
|
+
else if (definition === undefined)
|
39
|
+
throw 'no definition function for ' + id;
|
40
|
+
defs[id] = {
|
41
|
+
deps: dependencies,
|
42
|
+
defn: definition,
|
43
|
+
instance: undefined
|
44
|
+
};
|
45
|
+
};
|
46
|
+
|
47
|
+
var dem = function (id) {
|
48
|
+
var actual = defs[id];
|
49
|
+
if (actual === undefined)
|
50
|
+
throw 'module [' + id + '] was undefined';
|
51
|
+
else if (actual.instance === undefined)
|
52
|
+
instantiate(id);
|
53
|
+
return actual.instance;
|
54
|
+
};
|
55
|
+
|
56
|
+
var req = function (ids, callback) {
|
57
|
+
var len = ids.length;
|
58
|
+
var instances = new Array(len);
|
59
|
+
for (var i = 0; i < len; ++i)
|
60
|
+
instances[i] = dem(ids[i]);
|
61
|
+
callback.apply(null, instances);
|
62
|
+
};
|
63
|
+
|
64
|
+
var ephox = {};
|
65
|
+
|
66
|
+
ephox.bolt = {
|
67
|
+
module: {
|
68
|
+
api: {
|
69
|
+
define: def,
|
70
|
+
require: req,
|
71
|
+
demand: dem
|
72
|
+
}
|
73
|
+
}
|
74
|
+
};
|
75
|
+
|
76
|
+
var define = def;
|
77
|
+
var require = req;
|
78
|
+
var demand = dem;
|
79
|
+
// this helps with minification when using a lot of global references
|
80
|
+
var defineGlobal = function (id, ref) {
|
81
|
+
define(id, [], function () { return ref; });
|
82
|
+
};
|
83
|
+
/*jsc
|
84
|
+
["tinymce.plugins.searchreplace.Plugin","ephox.katamari.api.Cell","tinymce.core.PluginManager","tinymce.plugins.searchreplace.api.Api","tinymce.plugins.searchreplace.api.Commands","tinymce.plugins.searchreplace.ui.Buttons","global!tinymce.util.Tools.resolve","tinymce.plugins.searchreplace.core.Actions","tinymce.plugins.searchreplace.ui.Dialog","tinymce.core.util.Tools","tinymce.plugins.searchreplace.core.FindReplaceText"]
|
85
|
+
jsc*/
|
86
|
+
define(
|
87
|
+
'ephox.katamari.api.Cell',
|
88
|
+
|
89
|
+
[
|
90
|
+
],
|
91
|
+
|
92
|
+
function () {
|
93
|
+
var Cell = function (initial) {
|
94
|
+
var value = initial;
|
95
|
+
|
96
|
+
var get = function () {
|
97
|
+
return value;
|
98
|
+
};
|
99
|
+
|
100
|
+
var set = function (v) {
|
101
|
+
value = v;
|
102
|
+
};
|
103
|
+
|
104
|
+
var clone = function () {
|
105
|
+
return Cell(get());
|
106
|
+
};
|
107
|
+
|
108
|
+
return {
|
109
|
+
get: get,
|
110
|
+
set: set,
|
111
|
+
clone: clone
|
112
|
+
};
|
113
|
+
};
|
114
|
+
|
115
|
+
return Cell;
|
116
|
+
}
|
117
|
+
);
|
118
|
+
|
119
|
+
defineGlobal("global!tinymce.util.Tools.resolve", tinymce.util.Tools.resolve);
|
120
|
+
/**
|
121
|
+
* ResolveGlobal.js
|
122
|
+
*
|
123
|
+
* Released under LGPL License.
|
124
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
125
|
+
*
|
126
|
+
* License: http://www.tinymce.com/license
|
127
|
+
* Contributing: http://www.tinymce.com/contributing
|
128
|
+
*/
|
129
|
+
|
130
|
+
define(
|
131
|
+
'tinymce.core.PluginManager',
|
132
|
+
[
|
133
|
+
'global!tinymce.util.Tools.resolve'
|
134
|
+
],
|
135
|
+
function (resolve) {
|
136
|
+
return resolve('tinymce.PluginManager');
|
137
|
+
}
|
138
|
+
);
|
139
|
+
|
140
|
+
/**
|
141
|
+
* ResolveGlobal.js
|
142
|
+
*
|
143
|
+
* Released under LGPL License.
|
144
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
145
|
+
*
|
146
|
+
* License: http://www.tinymce.com/license
|
147
|
+
* Contributing: http://www.tinymce.com/contributing
|
148
|
+
*/
|
149
|
+
|
150
|
+
define(
|
151
|
+
'tinymce.core.util.Tools',
|
152
|
+
[
|
153
|
+
'global!tinymce.util.Tools.resolve'
|
154
|
+
],
|
155
|
+
function (resolve) {
|
156
|
+
return resolve('tinymce.util.Tools');
|
157
|
+
}
|
158
|
+
);
|
159
|
+
|
160
|
+
/**
|
161
|
+
* FindReplaceText.js
|
162
|
+
*
|
163
|
+
* Released under LGPL License.
|
164
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
165
|
+
*
|
166
|
+
* License: http://www.tinymce.com/license
|
167
|
+
* Contributing: http://www.tinymce.com/contributing
|
168
|
+
*/
|
169
|
+
|
170
|
+
/*jshint smarttabs:true, undef:true, unused:true, latedef:true, curly:true, bitwise:true */
|
171
|
+
/*eslint no-labels:0, no-constant-condition: 0 */
|
172
|
+
|
173
|
+
define(
|
174
|
+
'tinymce.plugins.searchreplace.core.FindReplaceText',
|
175
|
+
[
|
176
|
+
],
|
177
|
+
function () {
|
178
|
+
function isContentEditableFalse(node) {
|
179
|
+
return node && node.nodeType === 1 && node.contentEditable === "false";
|
180
|
+
}
|
181
|
+
|
182
|
+
// Based on work developed by: James Padolsey http://james.padolsey.com
|
183
|
+
// released under UNLICENSE that is compatible with LGPL
|
184
|
+
// TODO: Handle contentEditable edgecase:
|
185
|
+
// <p>text<span contentEditable="false">text<span contentEditable="true">text</span>text</span>text</p>
|
186
|
+
function findAndReplaceDOMText(regex, node, replacementNode, captureGroup, schema) {
|
187
|
+
var m, matches = [], text, count = 0, doc;
|
188
|
+
var blockElementsMap, hiddenTextElementsMap, shortEndedElementsMap;
|
189
|
+
|
190
|
+
doc = node.ownerDocument;
|
191
|
+
blockElementsMap = schema.getBlockElements(); // H1-H6, P, TD etc
|
192
|
+
hiddenTextElementsMap = schema.getWhiteSpaceElements(); // TEXTAREA, PRE, STYLE, SCRIPT
|
193
|
+
shortEndedElementsMap = schema.getShortEndedElements(); // BR, IMG, INPUT
|
194
|
+
|
195
|
+
function getMatchIndexes(m, captureGroup) {
|
196
|
+
captureGroup = captureGroup || 0;
|
197
|
+
|
198
|
+
if (!m[0]) {
|
199
|
+
throw 'findAndReplaceDOMText cannot handle zero-length matches';
|
200
|
+
}
|
201
|
+
|
202
|
+
var index = m.index;
|
203
|
+
|
204
|
+
if (captureGroup > 0) {
|
205
|
+
var cg = m[captureGroup];
|
206
|
+
|
207
|
+
if (!cg) {
|
208
|
+
throw 'Invalid capture group';
|
209
|
+
}
|
210
|
+
|
211
|
+
index += m[0].indexOf(cg);
|
212
|
+
m[0] = cg;
|
213
|
+
}
|
214
|
+
|
215
|
+
return [index, index + m[0].length, [m[0]]];
|
216
|
+
}
|
217
|
+
|
218
|
+
function getText(node) {
|
219
|
+
var txt;
|
220
|
+
|
221
|
+
if (node.nodeType === 3) {
|
222
|
+
return node.data;
|
223
|
+
}
|
224
|
+
|
225
|
+
if (hiddenTextElementsMap[node.nodeName] && !blockElementsMap[node.nodeName]) {
|
226
|
+
return '';
|
227
|
+
}
|
228
|
+
|
229
|
+
txt = '';
|
230
|
+
|
231
|
+
if (isContentEditableFalse(node)) {
|
232
|
+
return '\n';
|
233
|
+
}
|
234
|
+
|
235
|
+
if (blockElementsMap[node.nodeName] || shortEndedElementsMap[node.nodeName]) {
|
236
|
+
txt += '\n';
|
237
|
+
}
|
238
|
+
|
239
|
+
if ((node = node.firstChild)) {
|
240
|
+
do {
|
241
|
+
txt += getText(node);
|
242
|
+
} while ((node = node.nextSibling));
|
243
|
+
}
|
244
|
+
|
245
|
+
return txt;
|
246
|
+
}
|
247
|
+
|
248
|
+
function stepThroughMatches(node, matches, replaceFn) {
|
249
|
+
var startNode, endNode, startNodeIndex,
|
250
|
+
endNodeIndex, innerNodes = [], atIndex = 0, curNode = node,
|
251
|
+
matchLocation = matches.shift(), matchIndex = 0;
|
252
|
+
|
253
|
+
out: while (true) {
|
254
|
+
if (blockElementsMap[curNode.nodeName] || shortEndedElementsMap[curNode.nodeName] || isContentEditableFalse(curNode)) {
|
255
|
+
atIndex++;
|
256
|
+
}
|
257
|
+
|
258
|
+
if (curNode.nodeType === 3) {
|
259
|
+
if (!endNode && curNode.length + atIndex >= matchLocation[1]) {
|
260
|
+
// We've found the ending
|
261
|
+
endNode = curNode;
|
262
|
+
endNodeIndex = matchLocation[1] - atIndex;
|
263
|
+
} else if (startNode) {
|
264
|
+
// Intersecting node
|
265
|
+
innerNodes.push(curNode);
|
266
|
+
}
|
267
|
+
|
268
|
+
if (!startNode && curNode.length + atIndex > matchLocation[0]) {
|
269
|
+
// We've found the match start
|
270
|
+
startNode = curNode;
|
271
|
+
startNodeIndex = matchLocation[0] - atIndex;
|
272
|
+
}
|
273
|
+
|
274
|
+
atIndex += curNode.length;
|
275
|
+
}
|
276
|
+
|
277
|
+
if (startNode && endNode) {
|
278
|
+
curNode = replaceFn({
|
279
|
+
startNode: startNode,
|
280
|
+
startNodeIndex: startNodeIndex,
|
281
|
+
endNode: endNode,
|
282
|
+
endNodeIndex: endNodeIndex,
|
283
|
+
innerNodes: innerNodes,
|
284
|
+
match: matchLocation[2],
|
285
|
+
matchIndex: matchIndex
|
286
|
+
});
|
287
|
+
|
288
|
+
// replaceFn has to return the node that replaced the endNode
|
289
|
+
// and then we step back so we can continue from the end of the
|
290
|
+
// match:
|
291
|
+
atIndex -= (endNode.length - endNodeIndex);
|
292
|
+
startNode = null;
|
293
|
+
endNode = null;
|
294
|
+
innerNodes = [];
|
295
|
+
matchLocation = matches.shift();
|
296
|
+
matchIndex++;
|
297
|
+
|
298
|
+
if (!matchLocation) {
|
299
|
+
break; // no more matches
|
300
|
+
}
|
301
|
+
} else if ((!hiddenTextElementsMap[curNode.nodeName] || blockElementsMap[curNode.nodeName]) && curNode.firstChild) {
|
302
|
+
if (!isContentEditableFalse(curNode)) {
|
303
|
+
// Move down
|
304
|
+
curNode = curNode.firstChild;
|
305
|
+
continue;
|
306
|
+
}
|
307
|
+
} else if (curNode.nextSibling) {
|
308
|
+
// Move forward:
|
309
|
+
curNode = curNode.nextSibling;
|
310
|
+
continue;
|
311
|
+
}
|
312
|
+
|
313
|
+
// Move forward or up:
|
314
|
+
while (true) {
|
315
|
+
if (curNode.nextSibling) {
|
316
|
+
curNode = curNode.nextSibling;
|
317
|
+
break;
|
318
|
+
} else if (curNode.parentNode !== node) {
|
319
|
+
curNode = curNode.parentNode;
|
320
|
+
} else {
|
321
|
+
break out;
|
322
|
+
}
|
323
|
+
}
|
324
|
+
}
|
325
|
+
}
|
326
|
+
|
327
|
+
/**
|
328
|
+
* Generates the actual replaceFn which splits up text nodes
|
329
|
+
* and inserts the replacement element.
|
330
|
+
*/
|
331
|
+
function genReplacer(nodeName) {
|
332
|
+
var makeReplacementNode;
|
333
|
+
|
334
|
+
if (typeof nodeName !== 'function') {
|
335
|
+
var stencilNode = nodeName.nodeType ? nodeName : doc.createElement(nodeName);
|
336
|
+
|
337
|
+
makeReplacementNode = function (fill, matchIndex) {
|
338
|
+
var clone = stencilNode.cloneNode(false);
|
339
|
+
|
340
|
+
clone.setAttribute('data-mce-index', matchIndex);
|
341
|
+
|
342
|
+
if (fill) {
|
343
|
+
clone.appendChild(doc.createTextNode(fill));
|
344
|
+
}
|
345
|
+
|
346
|
+
return clone;
|
347
|
+
};
|
348
|
+
} else {
|
349
|
+
makeReplacementNode = nodeName;
|
350
|
+
}
|
351
|
+
|
352
|
+
return function (range) {
|
353
|
+
var before, after, parentNode, startNode = range.startNode,
|
354
|
+
endNode = range.endNode, matchIndex = range.matchIndex;
|
355
|
+
|
356
|
+
if (startNode === endNode) {
|
357
|
+
var node = startNode;
|
358
|
+
|
359
|
+
parentNode = node.parentNode;
|
360
|
+
if (range.startNodeIndex > 0) {
|
361
|
+
// Add `before` text node (before the match)
|
362
|
+
before = doc.createTextNode(node.data.substring(0, range.startNodeIndex));
|
363
|
+
parentNode.insertBefore(before, node);
|
364
|
+
}
|
365
|
+
|
366
|
+
// Create the replacement node:
|
367
|
+
var el = makeReplacementNode(range.match[0], matchIndex);
|
368
|
+
parentNode.insertBefore(el, node);
|
369
|
+
if (range.endNodeIndex < node.length) {
|
370
|
+
// Add `after` text node (after the match)
|
371
|
+
after = doc.createTextNode(node.data.substring(range.endNodeIndex));
|
372
|
+
parentNode.insertBefore(after, node);
|
373
|
+
}
|
374
|
+
|
375
|
+
node.parentNode.removeChild(node);
|
376
|
+
|
377
|
+
return el;
|
378
|
+
}
|
379
|
+
|
380
|
+
// Replace startNode -> [innerNodes...] -> endNode (in that order)
|
381
|
+
before = doc.createTextNode(startNode.data.substring(0, range.startNodeIndex));
|
382
|
+
after = doc.createTextNode(endNode.data.substring(range.endNodeIndex));
|
383
|
+
var elA = makeReplacementNode(startNode.data.substring(range.startNodeIndex), matchIndex);
|
384
|
+
var innerEls = [];
|
385
|
+
|
386
|
+
for (var i = 0, l = range.innerNodes.length; i < l; ++i) {
|
387
|
+
var innerNode = range.innerNodes[i];
|
388
|
+
var innerEl = makeReplacementNode(innerNode.data, matchIndex);
|
389
|
+
innerNode.parentNode.replaceChild(innerEl, innerNode);
|
390
|
+
innerEls.push(innerEl);
|
391
|
+
}
|
392
|
+
|
393
|
+
var elB = makeReplacementNode(endNode.data.substring(0, range.endNodeIndex), matchIndex);
|
394
|
+
|
395
|
+
parentNode = startNode.parentNode;
|
396
|
+
parentNode.insertBefore(before, startNode);
|
397
|
+
parentNode.insertBefore(elA, startNode);
|
398
|
+
parentNode.removeChild(startNode);
|
399
|
+
|
400
|
+
parentNode = endNode.parentNode;
|
401
|
+
parentNode.insertBefore(elB, endNode);
|
402
|
+
parentNode.insertBefore(after, endNode);
|
403
|
+
parentNode.removeChild(endNode);
|
404
|
+
|
405
|
+
return elB;
|
406
|
+
};
|
407
|
+
}
|
408
|
+
|
409
|
+
text = getText(node);
|
410
|
+
if (!text) {
|
411
|
+
return;
|
412
|
+
}
|
413
|
+
|
414
|
+
if (regex.global) {
|
415
|
+
while ((m = regex.exec(text))) {
|
416
|
+
matches.push(getMatchIndexes(m, captureGroup));
|
417
|
+
}
|
418
|
+
} else {
|
419
|
+
m = text.match(regex);
|
420
|
+
matches.push(getMatchIndexes(m, captureGroup));
|
421
|
+
}
|
422
|
+
|
423
|
+
if (matches.length) {
|
424
|
+
count = matches.length;
|
425
|
+
stepThroughMatches(node, matches, genReplacer(replacementNode));
|
426
|
+
}
|
427
|
+
|
428
|
+
return count;
|
429
|
+
}
|
430
|
+
|
431
|
+
return {
|
432
|
+
findAndReplaceDOMText: findAndReplaceDOMText
|
433
|
+
};
|
434
|
+
}
|
435
|
+
);
|
436
|
+
/**
|
437
|
+
* Actions.js
|
438
|
+
*
|
439
|
+
* Released under LGPL License.
|
440
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
441
|
+
*
|
442
|
+
* License: http://www.tinymce.com/license
|
443
|
+
* Contributing: http://www.tinymce.com/contributing
|
444
|
+
*/
|
445
|
+
|
446
|
+
define(
|
447
|
+
'tinymce.plugins.searchreplace.core.Actions',
|
448
|
+
[
|
449
|
+
'tinymce.core.util.Tools',
|
450
|
+
'tinymce.plugins.searchreplace.core.FindReplaceText'
|
451
|
+
],
|
452
|
+
function (Tools, FindReplaceText) {
|
453
|
+
var getElmIndex = function (elm) {
|
454
|
+
var value = elm.getAttribute('data-mce-index');
|
455
|
+
|
456
|
+
if (typeof value === "number") {
|
457
|
+
return "" + value;
|
458
|
+
}
|
459
|
+
|
460
|
+
return value;
|
461
|
+
};
|
462
|
+
|
463
|
+
var markAllMatches = function (editor, currentIndexState, regex) {
|
464
|
+
var node, marker;
|
465
|
+
|
466
|
+
marker = editor.dom.create('span', {
|
467
|
+
'data-mce-bogus': 1
|
468
|
+
});
|
469
|
+
|
470
|
+
marker.className = 'mce-match-marker'; // IE 7 adds class="mce-match-marker" and class=mce-match-marker
|
471
|
+
node = editor.getBody();
|
472
|
+
|
473
|
+
done(editor, currentIndexState, false);
|
474
|
+
|
475
|
+
return FindReplaceText.findAndReplaceDOMText(regex, node, marker, false, editor.schema);
|
476
|
+
};
|
477
|
+
|
478
|
+
var unwrap = function (node) {
|
479
|
+
var parentNode = node.parentNode;
|
480
|
+
|
481
|
+
if (node.firstChild) {
|
482
|
+
parentNode.insertBefore(node.firstChild, node);
|
483
|
+
}
|
484
|
+
|
485
|
+
node.parentNode.removeChild(node);
|
486
|
+
};
|
487
|
+
|
488
|
+
var findSpansByIndex = function (editor, index) {
|
489
|
+
var nodes, spans = [];
|
490
|
+
|
491
|
+
nodes = Tools.toArray(editor.getBody().getElementsByTagName('span'));
|
492
|
+
if (nodes.length) {
|
493
|
+
for (var i = 0; i < nodes.length; i++) {
|
494
|
+
var nodeIndex = getElmIndex(nodes[i]);
|
495
|
+
|
496
|
+
if (nodeIndex === null || !nodeIndex.length) {
|
497
|
+
continue;
|
498
|
+
}
|
499
|
+
|
500
|
+
if (nodeIndex === index.toString()) {
|
501
|
+
spans.push(nodes[i]);
|
502
|
+
}
|
503
|
+
}
|
504
|
+
}
|
505
|
+
|
506
|
+
return spans;
|
507
|
+
};
|
508
|
+
|
509
|
+
var moveSelection = function (editor, currentIndexState, forward) {
|
510
|
+
var testIndex = currentIndexState.get(), dom = editor.dom;
|
511
|
+
|
512
|
+
forward = forward !== false;
|
513
|
+
|
514
|
+
if (forward) {
|
515
|
+
testIndex++;
|
516
|
+
} else {
|
517
|
+
testIndex--;
|
518
|
+
}
|
519
|
+
|
520
|
+
dom.removeClass(findSpansByIndex(editor, currentIndexState.get()), 'mce-match-marker-selected');
|
521
|
+
|
522
|
+
var spans = findSpansByIndex(editor, testIndex);
|
523
|
+
if (spans.length) {
|
524
|
+
dom.addClass(findSpansByIndex(editor, testIndex), 'mce-match-marker-selected');
|
525
|
+
editor.selection.scrollIntoView(spans[0]);
|
526
|
+
return testIndex;
|
527
|
+
}
|
528
|
+
|
529
|
+
return -1;
|
530
|
+
};
|
531
|
+
|
532
|
+
var removeNode = function (dom, node) {
|
533
|
+
var parent = node.parentNode;
|
534
|
+
|
535
|
+
dom.remove(node);
|
536
|
+
|
537
|
+
if (dom.isEmpty(parent)) {
|
538
|
+
dom.remove(parent);
|
539
|
+
}
|
540
|
+
};
|
541
|
+
|
542
|
+
var find = function (editor, currentIndexState, text, matchCase, wholeWord) {
|
543
|
+
text = text.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&");
|
544
|
+
text = text.replace(/\s/g, '\\s');
|
545
|
+
text = wholeWord ? '\\b' + text + '\\b' : text;
|
546
|
+
|
547
|
+
var count = markAllMatches(editor, currentIndexState, new RegExp(text, matchCase ? 'g' : 'gi'));
|
548
|
+
|
549
|
+
if (count) {
|
550
|
+
currentIndexState.set(-1);
|
551
|
+
currentIndexState.set(moveSelection(editor, currentIndexState, true));
|
552
|
+
}
|
553
|
+
|
554
|
+
return count;
|
555
|
+
};
|
556
|
+
|
557
|
+
var next = function (editor, currentIndexState) {
|
558
|
+
var index = moveSelection(editor, currentIndexState, true);
|
559
|
+
|
560
|
+
if (index !== -1) {
|
561
|
+
currentIndexState.set(index);
|
562
|
+
}
|
563
|
+
};
|
564
|
+
|
565
|
+
var prev = function (editor, currentIndexState) {
|
566
|
+
var index = moveSelection(editor, currentIndexState, false);
|
567
|
+
|
568
|
+
if (index !== -1) {
|
569
|
+
currentIndexState.set(index);
|
570
|
+
}
|
571
|
+
};
|
572
|
+
|
573
|
+
var isMatchSpan = function (node) {
|
574
|
+
var matchIndex = getElmIndex(node);
|
575
|
+
|
576
|
+
return matchIndex !== null && matchIndex.length > 0;
|
577
|
+
};
|
578
|
+
|
579
|
+
var replace = function (editor, currentIndexState, text, forward, all) {
|
580
|
+
var i, nodes, node, matchIndex, currentMatchIndex, nextIndex = currentIndexState.get(), hasMore;
|
581
|
+
|
582
|
+
forward = forward !== false;
|
583
|
+
|
584
|
+
node = editor.getBody();
|
585
|
+
nodes = Tools.grep(Tools.toArray(node.getElementsByTagName('span')), isMatchSpan);
|
586
|
+
for (i = 0; i < nodes.length; i++) {
|
587
|
+
var nodeIndex = getElmIndex(nodes[i]);
|
588
|
+
|
589
|
+
matchIndex = currentMatchIndex = parseInt(nodeIndex, 10);
|
590
|
+
if (all || matchIndex === currentIndexState.get()) {
|
591
|
+
if (text.length) {
|
592
|
+
nodes[i].firstChild.nodeValue = text;
|
593
|
+
unwrap(nodes[i]);
|
594
|
+
} else {
|
595
|
+
removeNode(editor.dom, nodes[i]);
|
596
|
+
}
|
597
|
+
|
598
|
+
while (nodes[++i]) {
|
599
|
+
matchIndex = parseInt(getElmIndex(nodes[i]), 10);
|
600
|
+
|
601
|
+
if (matchIndex === currentMatchIndex) {
|
602
|
+
removeNode(editor.dom, nodes[i]);
|
603
|
+
} else {
|
604
|
+
i--;
|
605
|
+
break;
|
606
|
+
}
|
607
|
+
}
|
608
|
+
|
609
|
+
if (forward) {
|
610
|
+
nextIndex--;
|
611
|
+
}
|
612
|
+
} else if (currentMatchIndex > currentIndexState.get()) {
|
613
|
+
nodes[i].setAttribute('data-mce-index', currentMatchIndex - 1);
|
614
|
+
}
|
615
|
+
}
|
616
|
+
|
617
|
+
currentIndexState.set(nextIndex);
|
618
|
+
|
619
|
+
if (forward) {
|
620
|
+
hasMore = hasNext(editor, currentIndexState);
|
621
|
+
next(editor, currentIndexState);
|
622
|
+
} else {
|
623
|
+
hasMore = hasPrev(editor, currentIndexState);
|
624
|
+
prev(editor, currentIndexState);
|
625
|
+
}
|
626
|
+
|
627
|
+
return !all && hasMore;
|
628
|
+
};
|
629
|
+
|
630
|
+
var done = function (editor, currentIndexState, keepEditorSelection) {
|
631
|
+
var i, nodes, startContainer, endContainer;
|
632
|
+
|
633
|
+
nodes = Tools.toArray(editor.getBody().getElementsByTagName('span'));
|
634
|
+
for (i = 0; i < nodes.length; i++) {
|
635
|
+
var nodeIndex = getElmIndex(nodes[i]);
|
636
|
+
|
637
|
+
if (nodeIndex !== null && nodeIndex.length) {
|
638
|
+
if (nodeIndex === currentIndexState.get().toString()) {
|
639
|
+
if (!startContainer) {
|
640
|
+
startContainer = nodes[i].firstChild;
|
641
|
+
}
|
642
|
+
|
643
|
+
endContainer = nodes[i].firstChild;
|
644
|
+
}
|
645
|
+
|
646
|
+
unwrap(nodes[i]);
|
647
|
+
}
|
648
|
+
}
|
649
|
+
|
650
|
+
if (startContainer && endContainer) {
|
651
|
+
var rng = editor.dom.createRng();
|
652
|
+
rng.setStart(startContainer, 0);
|
653
|
+
rng.setEnd(endContainer, endContainer.data.length);
|
654
|
+
|
655
|
+
if (keepEditorSelection !== false) {
|
656
|
+
editor.selection.setRng(rng);
|
657
|
+
}
|
658
|
+
|
659
|
+
return rng;
|
660
|
+
}
|
661
|
+
};
|
662
|
+
|
663
|
+
var hasNext = function (editor, currentIndexState) {
|
664
|
+
return findSpansByIndex(editor, currentIndexState.get() + 1).length > 0;
|
665
|
+
};
|
666
|
+
|
667
|
+
var hasPrev = function (editor, currentIndexState) {
|
668
|
+
return findSpansByIndex(editor, currentIndexState.get() - 1).length > 0;
|
669
|
+
};
|
670
|
+
|
671
|
+
return {
|
672
|
+
done: done,
|
673
|
+
find: find,
|
674
|
+
next: next,
|
675
|
+
prev: prev,
|
676
|
+
replace: replace,
|
677
|
+
hasNext: hasNext,
|
678
|
+
hasPrev: hasPrev
|
679
|
+
};
|
680
|
+
}
|
681
|
+
);
|
682
|
+
/**
|
683
|
+
* Api.js
|
684
|
+
*
|
685
|
+
* Released under LGPL License.
|
686
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
687
|
+
*
|
688
|
+
* License: http://www.tinymce.com/license
|
689
|
+
* Contributing: http://www.tinymce.com/contributing
|
690
|
+
*/
|
691
|
+
|
692
|
+
define(
|
693
|
+
'tinymce.plugins.searchreplace.api.Api',
|
694
|
+
[
|
695
|
+
'tinymce.plugins.searchreplace.core.Actions'
|
696
|
+
],
|
697
|
+
function (Actions) {
|
698
|
+
var get = function (editor, currentIndexState) {
|
699
|
+
var done = function (keepEditorSelection) {
|
700
|
+
return Actions.done(editor, currentIndexState, keepEditorSelection);
|
701
|
+
};
|
702
|
+
|
703
|
+
var find = function (text, matchCase, wholeWord) {
|
704
|
+
return Actions.find(editor, currentIndexState, text, matchCase, wholeWord);
|
705
|
+
};
|
706
|
+
|
707
|
+
var next = function () {
|
708
|
+
return Actions.next(editor, currentIndexState);
|
709
|
+
};
|
710
|
+
|
711
|
+
var prev = function () {
|
712
|
+
return Actions.prev(editor, currentIndexState);
|
713
|
+
};
|
714
|
+
|
715
|
+
var replace = function (text, forward, all) {
|
716
|
+
return Actions.replace(editor, currentIndexState, text, forward, all);
|
717
|
+
};
|
718
|
+
|
719
|
+
return {
|
720
|
+
done: done,
|
721
|
+
find: find,
|
722
|
+
next: next,
|
723
|
+
prev: prev,
|
724
|
+
replace: replace
|
725
|
+
};
|
726
|
+
};
|
727
|
+
|
728
|
+
return {
|
729
|
+
get: get
|
730
|
+
};
|
731
|
+
}
|
732
|
+
);
|
733
|
+
/**
|
734
|
+
* Dialog.js
|
735
|
+
*
|
736
|
+
* Released under LGPL License.
|
737
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
738
|
+
*
|
739
|
+
* License: http://www.tinymce.com/license
|
740
|
+
* Contributing: http://www.tinymce.com/contributing
|
741
|
+
*/
|
742
|
+
|
743
|
+
define(
|
744
|
+
'tinymce.plugins.searchreplace.ui.Dialog',
|
745
|
+
[
|
746
|
+
'tinymce.core.util.Tools',
|
747
|
+
'tinymce.plugins.searchreplace.core.Actions'
|
748
|
+
],
|
749
|
+
function (Tools, Actions) {
|
750
|
+
var open = function (editor, currentIndexState) {
|
751
|
+
var last = {}, selectedText;
|
752
|
+
editor.undoManager.add();
|
753
|
+
|
754
|
+
selectedText = Tools.trim(editor.selection.getContent({ format: 'text' }));
|
755
|
+
|
756
|
+
function updateButtonStates() {
|
757
|
+
win.statusbar.find('#next').disabled(Actions.hasNext(editor, currentIndexState) === false);
|
758
|
+
win.statusbar.find('#prev').disabled(Actions.hasPrev(editor, currentIndexState) === false);
|
759
|
+
}
|
760
|
+
|
761
|
+
function notFoundAlert() {
|
762
|
+
editor.windowManager.alert('Could not find the specified string.', function () {
|
763
|
+
win.find('#find')[0].focus();
|
764
|
+
});
|
765
|
+
}
|
766
|
+
|
767
|
+
var win = editor.windowManager.open({
|
768
|
+
layout: "flex",
|
769
|
+
pack: "center",
|
770
|
+
align: "center",
|
771
|
+
onClose: function () {
|
772
|
+
editor.focus();
|
773
|
+
Actions.done(editor, currentIndexState);
|
774
|
+
editor.undoManager.add();
|
775
|
+
},
|
776
|
+
onSubmit: function (e) {
|
777
|
+
var count, caseState, text, wholeWord;
|
778
|
+
|
779
|
+
e.preventDefault();
|
780
|
+
|
781
|
+
caseState = win.find('#case').checked();
|
782
|
+
wholeWord = win.find('#words').checked();
|
783
|
+
|
784
|
+
text = win.find('#find').value();
|
785
|
+
if (!text.length) {
|
786
|
+
Actions.done(editor, currentIndexState, false);
|
787
|
+
win.statusbar.items().slice(1).disabled(true);
|
788
|
+
return;
|
789
|
+
}
|
790
|
+
|
791
|
+
if (last.text === text && last.caseState === caseState && last.wholeWord === wholeWord) {
|
792
|
+
if (!Actions.hasNext(editor, currentIndexState)) {
|
793
|
+
notFoundAlert();
|
794
|
+
return;
|
795
|
+
}
|
796
|
+
|
797
|
+
Actions.next(editor, currentIndexState);
|
798
|
+
updateButtonStates();
|
799
|
+
return;
|
800
|
+
}
|
801
|
+
|
802
|
+
count = Actions.find(editor, currentIndexState, text, caseState, wholeWord);
|
803
|
+
if (!count) {
|
804
|
+
notFoundAlert();
|
805
|
+
}
|
806
|
+
|
807
|
+
win.statusbar.items().slice(1).disabled(count === 0);
|
808
|
+
updateButtonStates();
|
809
|
+
|
810
|
+
last = {
|
811
|
+
text: text,
|
812
|
+
caseState: caseState,
|
813
|
+
wholeWord: wholeWord
|
814
|
+
};
|
815
|
+
},
|
816
|
+
buttons: [
|
817
|
+
{
|
818
|
+
text: "Find", subtype: 'primary', onclick: function () {
|
819
|
+
win.submit();
|
820
|
+
}
|
821
|
+
},
|
822
|
+
{
|
823
|
+
text: "Replace", disabled: true, onclick: function () {
|
824
|
+
if (!Actions.replace(editor, currentIndexState, win.find('#replace').value())) {
|
825
|
+
win.statusbar.items().slice(1).disabled(true);
|
826
|
+
currentIndexState.set(-1);
|
827
|
+
last = {};
|
828
|
+
}
|
829
|
+
}
|
830
|
+
},
|
831
|
+
{
|
832
|
+
text: "Replace all", disabled: true, onclick: function () {
|
833
|
+
Actions.replace(editor, currentIndexState, win.find('#replace').value(), true, true);
|
834
|
+
win.statusbar.items().slice(1).disabled(true);
|
835
|
+
last = {};
|
836
|
+
}
|
837
|
+
},
|
838
|
+
{ type: "spacer", flex: 1 },
|
839
|
+
{
|
840
|
+
text: "Prev", name: 'prev', disabled: true, onclick: function () {
|
841
|
+
Actions.prev(editor, currentIndexState);
|
842
|
+
updateButtonStates();
|
843
|
+
}
|
844
|
+
},
|
845
|
+
{
|
846
|
+
text: "Next", name: 'next', disabled: true, onclick: function () {
|
847
|
+
Actions.next(editor, currentIndexState);
|
848
|
+
updateButtonStates();
|
849
|
+
}
|
850
|
+
}
|
851
|
+
],
|
852
|
+
title: "Find and replace",
|
853
|
+
items: {
|
854
|
+
type: "form",
|
855
|
+
padding: 20,
|
856
|
+
labelGap: 30,
|
857
|
+
spacing: 10,
|
858
|
+
items: [
|
859
|
+
{ type: 'textbox', name: 'find', size: 40, label: 'Find', value: selectedText },
|
860
|
+
{ type: 'textbox', name: 'replace', size: 40, label: 'Replace with' },
|
861
|
+
{ type: 'checkbox', name: 'case', text: 'Match case', label: ' ' },
|
862
|
+
{ type: 'checkbox', name: 'words', text: 'Whole words', label: ' ' }
|
863
|
+
]
|
864
|
+
}
|
865
|
+
});
|
866
|
+
};
|
867
|
+
|
868
|
+
return {
|
869
|
+
open: open
|
870
|
+
};
|
871
|
+
}
|
872
|
+
);
|
873
|
+
/**
|
874
|
+
* Commands.js
|
875
|
+
*
|
876
|
+
* Released under LGPL License.
|
877
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
878
|
+
*
|
879
|
+
* License: http://www.tinymce.com/license
|
880
|
+
* Contributing: http://www.tinymce.com/contributing
|
881
|
+
*/
|
882
|
+
|
883
|
+
define(
|
884
|
+
'tinymce.plugins.searchreplace.api.Commands',
|
885
|
+
[
|
886
|
+
'tinymce.plugins.searchreplace.ui.Dialog'
|
887
|
+
],
|
888
|
+
function (Dialog) {
|
889
|
+
var register = function (editor, currentIndexState) {
|
890
|
+
editor.addCommand('SearchReplace', function () {
|
891
|
+
Dialog.open(editor, currentIndexState);
|
892
|
+
});
|
893
|
+
};
|
894
|
+
|
895
|
+
return {
|
896
|
+
register: register
|
897
|
+
};
|
898
|
+
}
|
899
|
+
);
|
900
|
+
/**
|
901
|
+
* Buttons.js
|
902
|
+
*
|
903
|
+
* Released under LGPL License.
|
904
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
905
|
+
*
|
906
|
+
* License: http://www.tinymce.com/license
|
907
|
+
* Contributing: http://www.tinymce.com/contributing
|
908
|
+
*/
|
909
|
+
|
910
|
+
define(
|
911
|
+
'tinymce.plugins.searchreplace.ui.Buttons',
|
912
|
+
[
|
913
|
+
'tinymce.plugins.searchreplace.ui.Dialog'
|
914
|
+
],
|
915
|
+
function (Dialog) {
|
916
|
+
var showDialog = function (editor, currentIndexState) {
|
917
|
+
return function () {
|
918
|
+
Dialog.open(editor, currentIndexState);
|
919
|
+
};
|
920
|
+
};
|
921
|
+
|
922
|
+
var register = function (editor, currentIndexState) {
|
923
|
+
editor.addMenuItem('searchreplace', {
|
924
|
+
text: 'Find and replace',
|
925
|
+
shortcut: 'Meta+F',
|
926
|
+
onclick: showDialog(editor, currentIndexState),
|
927
|
+
separator: 'before',
|
928
|
+
context: 'edit'
|
929
|
+
});
|
930
|
+
|
931
|
+
editor.addButton('searchreplace', {
|
932
|
+
tooltip: 'Find and replace',
|
933
|
+
onclick: showDialog(editor, currentIndexState)
|
934
|
+
});
|
935
|
+
|
936
|
+
editor.shortcuts.add('Meta+F', '', showDialog(editor, currentIndexState));
|
937
|
+
};
|
938
|
+
|
939
|
+
return {
|
940
|
+
register: register
|
941
|
+
};
|
942
|
+
}
|
943
|
+
);
|
944
|
+
/**
|
945
|
+
* Plugin.js
|
946
|
+
*
|
947
|
+
* Released under LGPL License.
|
948
|
+
* Copyright (c) 1999-2017 Ephox Corp. All rights reserved
|
949
|
+
*
|
950
|
+
* License: http://www.tinymce.com/license
|
951
|
+
* Contributing: http://www.tinymce.com/contributing
|
952
|
+
*/
|
953
|
+
|
954
|
+
define(
|
955
|
+
'tinymce.plugins.searchreplace.Plugin',
|
956
|
+
[
|
957
|
+
'ephox.katamari.api.Cell',
|
958
|
+
'tinymce.core.PluginManager',
|
959
|
+
'tinymce.plugins.searchreplace.api.Api',
|
960
|
+
'tinymce.plugins.searchreplace.api.Commands',
|
961
|
+
'tinymce.plugins.searchreplace.ui.Buttons'
|
962
|
+
],
|
963
|
+
function (Cell, PluginManager, Api, Commands, Buttons) {
|
964
|
+
PluginManager.add('searchreplace', function (editor) {
|
965
|
+
var currentIndexState = Cell(-1);
|
966
|
+
|
967
|
+
Commands.register(editor, currentIndexState);
|
968
|
+
Buttons.register(editor, currentIndexState);
|
969
|
+
|
970
|
+
return Api.get(editor, currentIndexState);
|
971
|
+
});
|
972
|
+
|
973
|
+
return function () { };
|
974
|
+
}
|
975
|
+
);
|
976
|
+
dem('tinymce.plugins.searchreplace.Plugin')();
|
977
|
+
})();
|