@innovastudio/contentbuilder 1.5.211 → 1.5.213

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/index.d.ts +232 -3
  2. package/package.json +9 -10
  3. package/public/contentbuilder/contentbuilder.css +11169 -6865
  4. package/public/contentbuilder/contentbuilder.esm.js +42164 -50757
  5. package/public/contentbuilder/contentbuilder.min.js +10 -107
  6. package/public/contentbuilder/lang/en.js +237 -6
  7. package/public/contentbuilder/lang/fr.js +245 -14
  8. package/public/contentbuilder/themes/colored-blue.css +57 -1324
  9. package/public/contentbuilder/themes/colored-blue2.css +57 -1324
  10. package/public/contentbuilder/themes/colored-blue3.css +57 -1324
  11. package/public/contentbuilder/themes/colored-blue4.css +57 -1324
  12. package/public/contentbuilder/themes/colored-blue5.css +57 -1324
  13. package/public/contentbuilder/themes/colored-blue6.css +57 -1324
  14. package/public/contentbuilder/themes/colored-blue7.css +57 -1324
  15. package/public/contentbuilder/themes/colored-blue8.css +57 -1324
  16. package/public/contentbuilder/themes/colored-cyan.css +58 -0
  17. package/public/contentbuilder/themes/colored-dark.css +57 -1295
  18. package/public/contentbuilder/themes/colored-darkblue.css +57 -1324
  19. package/public/contentbuilder/themes/colored-gray.css +57 -1324
  20. package/public/contentbuilder/themes/colored-green.css +57 -1324
  21. package/public/contentbuilder/themes/colored-green2.css +57 -1324
  22. package/public/contentbuilder/themes/colored-green3.css +57 -1324
  23. package/public/contentbuilder/themes/colored-green4.css +57 -1324
  24. package/public/contentbuilder/themes/colored-green5.css +57 -1324
  25. package/public/contentbuilder/themes/colored-magenta.css +57 -1324
  26. package/public/contentbuilder/themes/colored-orange.css +57 -1324
  27. package/public/contentbuilder/themes/colored-orange2.css +57 -1324
  28. package/public/contentbuilder/themes/colored-orange3.css +57 -1324
  29. package/public/contentbuilder/themes/colored-pink.css +57 -1324
  30. package/public/contentbuilder/themes/colored-pink2.css +57 -1324
  31. package/public/contentbuilder/themes/colored-pink3.css +57 -1324
  32. package/public/contentbuilder/themes/colored-pink4.css +57 -1324
  33. package/public/contentbuilder/themes/colored-purple.css +57 -1324
  34. package/public/contentbuilder/themes/colored-purple2.css +57 -1324
  35. package/public/contentbuilder/themes/colored-red.css +57 -1324
  36. package/public/contentbuilder/themes/colored-red2.css +57 -1324
  37. package/public/contentbuilder/themes/colored-red3.css +57 -1324
  38. package/public/contentbuilder/themes/colored-red4.css +57 -1324
  39. package/public/contentbuilder/themes/colored-red5.css +57 -1324
  40. package/public/contentbuilder/themes/colored-yellow.css +57 -1324
  41. package/public/contentbuilder/themes/colored-yellow2.css +57 -1324
  42. package/public/contentbuilder/themes/colored-yellow3.css +58 -0
  43. package/public/contentbuilder/themes/dark-blue.css +26 -1371
  44. package/public/contentbuilder/themes/dark-blue2.css +26 -1371
  45. package/public/contentbuilder/themes/dark-blue3.css +26 -1371
  46. package/public/contentbuilder/themes/dark-gray.css +26 -1371
  47. package/public/contentbuilder/themes/dark-pink.css +26 -1371
  48. package/public/contentbuilder/themes/dark-purple.css +26 -1371
  49. package/public/contentbuilder/themes/dark-red.css +26 -1371
  50. package/public/contentbuilder/themes/light-blue.css +29 -1323
  51. package/public/contentbuilder/themes/light-blue2.css +29 -1323
  52. package/public/contentbuilder/themes/light-blue3.css +29 -1323
  53. package/public/contentbuilder/themes/light-cyan.css +29 -1323
  54. package/public/contentbuilder/themes/light-gray.css +29 -1323
  55. package/public/contentbuilder/themes/light-gray2.css +29 -1323
  56. package/public/contentbuilder/themes/light-gray3.css +29 -1323
  57. package/public/contentbuilder/themes/light-green.css +29 -1323
  58. package/public/contentbuilder/themes/light-pink.css +29 -1323
  59. package/public/contentbuilder/themes/light-pink2.css +29 -1323
  60. package/public/contentbuilder/themes/light-purple.css +29 -1323
  61. package/public/contentbuilder/themes/light-purple2.css +29 -1323
  62. package/public/contentbuilder/themes/light-red.css +29 -1323
  63. package/public/contentbuilder/themes/light-yellow.css +29 -1323
  64. package/public/contentbuilder/themes/light-yellow2.css +29 -1323
  65. package/readme.txt +225 -154
  66. package/public/contentbuilder/config.js +0 -7
  67. package/public/contentbuilder/content.css +0 -7777
  68. package/public/contentbuilder/plugins/animation/plugin.js +0 -25
  69. package/public/contentbuilder/plugins/buttoneditor/images/a.jpg +0 -0
  70. package/public/contentbuilder/plugins/buttoneditor/images/b.jpg +0 -0
  71. package/public/contentbuilder/plugins/buttoneditor/images/c.jpg +0 -0
  72. package/public/contentbuilder/plugins/buttoneditor/images/d.jpg +0 -0
  73. package/public/contentbuilder/plugins/buttoneditor/images/e.jpg +0 -0
  74. package/public/contentbuilder/plugins/buttoneditor/images/f.jpg +0 -0
  75. package/public/contentbuilder/plugins/buttoneditor/images/g.jpg +0 -0
  76. package/public/contentbuilder/plugins/buttoneditor/images/h.jpg +0 -0
  77. package/public/contentbuilder/plugins/buttoneditor/plugin.js +0 -1600
  78. package/public/contentbuilder/plugins/buttoneditor/readme.txt +0 -7
  79. package/public/contentbuilder/plugins/helloworld/plugin.js +0 -21
  80. package/public/contentbuilder/plugins/helloworld/readme.txt +0 -23
  81. package/public/contentbuilder/plugins/preview/plugin.js +0 -371
  82. package/public/contentbuilder/plugins/preview/readme.txt +0 -23
  83. package/public/contentbuilder/plugins/searchreplace/plugin.js +0 -524
  84. package/public/contentbuilder/plugins/searchreplace/readme.txt +0 -23
  85. package/public/contentbuilder/plugins/searchreplace/searchreplace.html +0 -264
  86. package/public/contentbuilder/plugins/showgrid/plugin.js +0 -74
  87. package/public/contentbuilder/plugins/showgrid/readme.txt +0 -23
  88. package/public/contentbuilder/plugins/symbols/plugin.js +0 -3126
  89. package/public/contentbuilder/plugins/symbols/readme.txt +0 -23
  90. package/public/contentbuilder/plugins/wordcount/plugin.js +0 -76
  91. package/public/contentbuilder/plugins/wordcount/readme.txt +0 -23
  92. package/public/contentbuilder/themes/dark.css +0 -1377
@@ -1,524 +0,0 @@
1
- /*
2
- Search & Replace Plugin
3
- */
4
-
5
- (function () {
6
- if(typeof _cb === 'undefined') return;
7
-
8
- var js1 = 'https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.0/rangy-core.min.js';
9
- var js2 = 'https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.0/rangy-textrange.min.js'
10
-
11
- // _cb.getScript(js1);
12
- // _cb.getScript(js2);
13
- _cb.getScripts([js1,js2]); //Get js1 first, then after loaded, get js2
14
-
15
- var html = '<div class="is-modal is-modal-content searchreplace" tabindex="-1" role="dialog" aria-modal="true" aria-hidden="true">' +
16
- '<div class="is-modal-bar is-draggable" style="position: absolute;top: 0;left: 0;width: 100%;z-index:1;line-height:32px;height:32px;">' + _cb.out('Search & Replace') +
17
- '<div class="is-modal-close" style="z-index:1;width:32px;height:32px;position:absolute;top:0px;right:0px;box-sizing:border-box;padding:0;line-height:32px;font-size: 12px;text-align:center;cursor:pointer;">&#10005;</div>' +
18
- '</div>' +
19
- '<iframe style="position: absolute;top: 0;left: 0;width:100%;height:100%;border:none;border-top:32px solid transparent;margin:0;box-sizing:border-box;" src="about:blank"></iframe>' +
20
- '</div>' +
21
- '<svg width="0" height="0" style="position:absolute;display:none;">' +
22
- '<defs>' +
23
- '<symbol viewBox="0 0 512 512" id="ion-ios-search-strong"><path d="M344.5 298c15-23.6 23.8-51.6 23.8-81.7 0-84.1-68.1-152.3-152.1-152.3C132.1 64 64 132.2 64 216.3c0 84.1 68.1 152.3 152.1 152.3 30.5 0 58.9-9 82.7-24.4l6.9-4.8L414.3 448l33.7-34.3-108.5-108.6 5-7.1zm-43.1-166.8c22.7 22.7 35.2 52.9 35.2 85s-12.5 62.3-35.2 85c-22.7 22.7-52.9 35.2-85 35.2s-62.3-12.5-85-35.2c-22.7-22.7-35.2-52.9-35.2-85s12.5-62.3 35.2-85c22.7-22.7 52.9-35.2 85-35.2s62.3 12.5 85 35.2z"></path></symbol>' +
24
- '</defs>' +
25
- '</svg>';
26
-
27
- _cb.addHtml(html);
28
-
29
- var css = '<style>#_cbhtml .is-modal.searchreplace {' +
30
- 'z-index:10004;position:fixed;width:500px;height:265px;top:50%;left:50%;margin-top:-155px;margin-left:-250px;' +
31
- '}' +
32
- '</style>';
33
-
34
- _cb.addCss(css);
35
-
36
- var button = '<button class="searchreplace-button" title="Search & Replace" style="font-size:15px;vertical-align:bottom;">' +
37
- '<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-search-strong"></use></svg>' +
38
- '</button>';
39
-
40
- _cb.addButton('searchreplace', button, '.searchreplace-button', function () {
41
-
42
- var modal = document.querySelector(".is-modal.searchreplace");
43
- _cb.showModal(modal);
44
-
45
- var btnClose = modal.querySelector('.is-modal-close');
46
- btnClose.addEventListener('click', function(e){
47
- _cb.hideModal(modal);
48
- });
49
-
50
- // var scriptPath = _cb.getScriptPath();
51
- // modal.querySelector('iframe').src = scriptPath + 'plugins/searchreplace/searchreplace.html';
52
-
53
- // var wraper = _cb.getScope();
54
- // $wraper.focusEnd();
55
-
56
- iframe = modal.querySelector('iframe');
57
- doc = iframe.contentWindow.document;
58
- doc.open();
59
- doc.write(getHTML());
60
- doc.close();
61
-
62
- });
63
-
64
- if(_cb.iframe) {
65
- var iframeHtml = `
66
- <script src="https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.0/rangy-core.min.js"></script>
67
- <script src="https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.0/rangy-textrange.min.js"></script>
68
- <script>
69
- window.findOne = (target, caseSensitive, within, startNode, startPos)=>{
70
-
71
- if (rangy.supported) {
72
- var range = rangy.createRange();
73
- var searchScopeRange = rangy.createRange();
74
-
75
- searchScopeRange.selectNodeContents(within);
76
-
77
- if (startNode != null && startPos != null) {
78
- searchScopeRange.setStart(startNode, startPos);
79
- }
80
-
81
- var options = {
82
- caseSensitive: caseSensitive,
83
- wholeWordsOnly: true,
84
- withinRange: searchScopeRange
85
- };
86
-
87
- if (target !== "") {
88
- let result = (range.findText(target, options));
89
-
90
- selectRange(range.startContainer, range.endContainer, range.startOffset, range.endOffset);
91
-
92
- return result;
93
- }
94
- }
95
-
96
- function selectRange(startNode, endNode, startPos, endPos) {
97
- var range = document.createRange()
98
- range.setStart(startNode, startPos);
99
- range.setEnd(endNode, endPos);
100
-
101
- var sel = window.getSelection();
102
- sel.removeAllRanges();
103
- sel.addRange(range);
104
- }
105
- }
106
- </script>
107
- `;
108
-
109
-
110
- const contentStuff = _cb.doc.querySelector('#_cbhtml');
111
- const range = _cb.doc.createRange();
112
- range.setStart(contentStuff, 0);
113
- contentStuff.appendChild(range.createContextualFragment(iframeHtml) );
114
- }
115
- /*
116
- _cb.addButton2('searchreplace', button, '.searchreplace-button', function () {
117
-
118
- var modal = document.querySelector(".is-modal.searchreplace");
119
- modal.className = modal.className + ' active';
120
-
121
- var btnClose = modal.querySelector('.is-modal-close');
122
- btnClose.addEventListener('click', function(e){
123
- _cb.hideModal(modal);
124
- });
125
-
126
- // var scriptPath = _cb.getScriptPath();
127
- // modal.querySelector('iframe').src = scriptPath + 'plugins/searchreplace/searchreplace.html';
128
-
129
- // var wraper = _cb.getScope();
130
- // $wraper.focusEnd();
131
-
132
- iframe = modal.querySelector('iframe');
133
- doc = iframe.contentWindow.document;
134
- doc.open();
135
- doc.write(getHTML());
136
- doc.close();
137
-
138
- });
139
- */
140
-
141
- function getHTML() {
142
-
143
- const html = `
144
- <!DOCTYPE HTML>
145
- <html>
146
- <head>
147
- <meta charset="utf-8">
148
- <title></title>
149
- <style>
150
- body {margin:20px 20px 0;overflow-x:hidden;overflow-y:auto;font-family:sans-serif;
151
- font-size: 12px;
152
- letter-spacing: 1px;
153
- font-weight: 300;}
154
- .container {}
155
- .container > div {text-align:center;font-size:24px;cursor:pointer;margin: 0;display:inline-block;float:left;width:25%;height:80px;line-height:80px;border:#eee 1px solid;box-sizing:border-box;}
156
- .clearfix:before, .clearfix:after {content: " ";display: table;}
157
- .clearfix:after {clear: both;}
158
- .clearfix {*zoom: 1;}
159
-
160
- .inptext {
161
- width: 90%;
162
- height: 45px;
163
- box-sizing: border-box;
164
- margin: 0;
165
- font-family: sans-serif;
166
- font-size: 15px;
167
- letter-spacing: 1px;
168
- padding: 0;
169
- padding-left: 8px;
170
- display: inline-block;
171
- border: none;
172
- border-radius: 0;
173
- color: ${_cb.styleInputColor};
174
- background-color: ${_cb.styleInputBackground};
175
- border-bottom: ${_cb.styleInputBorderBottom};
176
- }
177
- #chkMatchCase {opacity:0.9}
178
- button {
179
- width: 55px;
180
- height: 45px;
181
- background-color: ${_cb.styleButtonClassicBackground};
182
- color: ${_cb.styleButtonClassicColor};
183
- border: transparent 1px solid;
184
- border-bottom: ${_cb.styleInputBorderBottom};
185
- font-family: sans-serif;
186
- font-size: 12px;
187
- letter-spacing: 1px;
188
- font-weight: 300;
189
- opacity: 1;
190
- line-height: 1;
191
- display: inline-block;
192
- box-sizing: border-box;
193
- margin: 0;
194
- padding: 0;
195
- cursor: pointer;
196
- text-transform: none;
197
- text-align: center;
198
- position: relative;
199
- border-radius: 0;
200
- user-select: none;
201
- -moz-user-select: none;
202
- -khtml-user-select: none;
203
- -webkit-user-select: none;
204
- -o-user-select: none;
205
- white-space: nowrap;
206
- display: flex;
207
- align-items: center;
208
- justify-content: center;
209
- }
210
- .inptext:focus {outline:none}
211
- button:focus {outline:none;}
212
- .input-replaceall {
213
- border: none;
214
- }
215
- button:hover {
216
- background-color: ${_cb.styleButtonClassicBackgroundHover};
217
- }
218
-
219
- label {
220
- color: ${_cb.styleModalColor};
221
- }
222
- </style>
223
- </head>
224
- <body>
225
- <form autocomplete="off">
226
- <div style="display:flex;justify-content:space-between;">
227
- <input id="txtSearch" tabindex="1" class="inptext" type="text" style="width:100%;" autocomplete="off" />
228
- <button class="input-search" style="width:130px;">Search Next</button>
229
- </div>
230
- <div style="margin:10px 0">
231
- <label for="txtReplaceWith">Replace with:</label>
232
- </div>
233
- <div style="display:flex;justify-content:space-between;">
234
- <input id="txtReplaceWith" tabindex="2" class="inptext" type="text" style="width:100%;" autocomplete="off" />
235
- <button class="input-replace" style="width:130px;">Replace</button>
236
- </div>
237
- <div style="display:flex;justify-content:space-between;margin:17px 0;">
238
- <div>
239
- <label id="lblMatchCase" for="chkMatchCase">
240
- <input type="checkbox" name="chkMatchCase" id="chkMatchCase"> Match case
241
- </label>
242
- <div id="divStatus" style="margin-top:12px;"></div>
243
- </div>
244
- <button class="input-replaceall" style="width:130px;">Replace All</button>
245
- </div>
246
- </form>
247
-
248
-
249
- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
250
- <script>
251
- var nReplaceCount = 0;
252
-
253
- jQuery(document).ready(function () {
254
-
255
- jQuery('#txtSearch').focus();
256
-
257
- jQuery('.input-replaceall').click(function (e) {
258
-
259
- e.preventDefault();
260
-
261
- jQuery('#divStatus').html('');
262
-
263
- var target = jQuery('#txtSearch').val();
264
- var replaceWith = jQuery('#txtReplaceWith').val();
265
- if (jQuery("#chkMatchCase").prop("checked")) {
266
- var bMatchCase = true;
267
- } else {
268
- var bMatchCase = false;
269
- }
270
-
271
- var within = parent._cb.getScope();
272
-
273
- var sel = parent._cb.win.getSelection();
274
-
275
- var r1 = parent.document.createRange();
276
- r1.selectNodeContents(within);
277
-
278
- // https://stackoverflow.com/questions/32192664/how-to-select-a-given-string-repeatedly-within-the-text-of-a-contenteditable-ele
279
- if (sel.toString().search(target) > -1) {
280
- var ok = parent._cb.win.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
281
- if (ok) {
282
- var rng = parent._cb.win.getSelection().getRangeAt(0);
283
- rng.deleteContents();
284
- rng.insertNode(document.createTextNode(replaceWith));
285
- nReplaceCount++;
286
- }
287
- jQuery('.input-replaceall').trigger('click');
288
- } else if (sel.toString().length > 0) {
289
- var ok = parent._cb.win.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
290
- if (ok) {
291
- var rng = parent._cb.win.getSelection().getRangeAt(0);
292
- rng.deleteContents();
293
- rng.insertNode(document.createTextNode(replaceWith));
294
- nReplaceCount++;
295
- }
296
- jQuery('.input-replaceall').trigger('click');
297
- } else if (sel.rangeCount) {
298
- var ok = parent._cb.win.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
299
- if (ok) {
300
- var rng = parent._cb.win.getSelection().getRangeAt(0);
301
- rng.deleteContents();
302
- rng.insertNode(document.createTextNode(replaceWith));
303
- nReplaceCount++;
304
- jQuery('.input-replaceall').trigger('click');
305
- } else {
306
- jQuery('#divStatus').html(nReplaceCount + ' occurrence(s) replaced.');
307
- nReplaceCount = 0;
308
- }
309
- }
310
- });
311
-
312
- jQuery('.input-search').click(function (e) {
313
-
314
- e.preventDefault();
315
-
316
- var target = jQuery('#txtSearch').val();
317
- var replaceWith = jQuery('#txtReplaceWith').val();
318
- if (jQuery("#chkMatchCase").prop("checked")) {
319
- var bMatchCase = true;
320
- } else {
321
- var bMatchCase = false;
322
- }
323
-
324
- var within = parent._cb.getScope();
325
-
326
- var sel = parent._cb.win.getSelection();
327
-
328
- var r1 = parent._cb.doc.createRange();
329
- r1.selectNodeContents(within);
330
-
331
- jQuery('#divStatus').html('');
332
-
333
- if (sel.toString().search(target) > -1) {
334
- var ok = parent._cb.win.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
335
- if (ok) {
336
- jQuery('#divStatus').html('');
337
- } else {
338
-
339
- }
340
- } else if (sel.toString().length > 0) {
341
- var ok = parent._cb.win.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
342
- if (ok) {
343
- jQuery('#divStatus').html('');
344
- } else {
345
- jQuery('#divStatus').html('Passed the end of the content.');
346
- var ok = parent._cb.win.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
347
- if (ok) {
348
- jQuery('#divStatus').html('');
349
- } else {
350
- jQuery('#divStatus').html('The specified text was not found.');
351
- }
352
- }
353
- } else if (sel.rangeCount) {
354
- var ok = parent._cb.win.findOne(target, bMatchCase, within, sel.anchorNode, sel.anchorOffset);
355
- if (ok) {
356
- jQuery('#divStatus').html('');
357
- } else {
358
- var ok = parent._cb.win.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
359
- if (ok) {
360
- jQuery('#divStatus').html('');
361
- } else {
362
- jQuery('#divStatus').html('The specified text was not found.');
363
- }
364
- }
365
- }
366
-
367
- });
368
-
369
- jQuery('.input-replace').click(function (e) {
370
-
371
- e.preventDefault();
372
-
373
- var target = jQuery('#txtSearch').val();
374
- var replaceWith = jQuery('#txtReplaceWith').val();
375
- if (jQuery("#chkMatchCase").prop("checked")) {
376
- var bMatchCase = true;
377
- } else {
378
- var bMatchCase = false;
379
- }
380
-
381
- var within = parent._cb.getScope();
382
-
383
- var sel = parent._cb.win.getSelection();
384
-
385
- var r1 = parent.document.createRange();
386
- r1.selectNodeContents(within);
387
-
388
- var text = getSelected(parent._cb.win);
389
- if (text) {
390
- if ((((text + '').toLowerCase() == target.toLowerCase()) && bMatchCase==false) ||
391
- ((text == target) && bMatchCase == true)) {
392
- var rng = parent._cb.win.getSelection().getRangeAt(0);
393
- rng.deleteContents();
394
- rng.insertNode(document.createTextNode(replaceWith));
395
- }
396
- }
397
-
398
- if (sel.rangeCount) {
399
- var ok = parent._cb.win.findOne(target, bMatchCase, within, sel.anchorNode, sel.anchorOffset);
400
- if (ok) {
401
- jQuery('#divStatus').html('');
402
- } else {
403
- var ok = parent._cb.win.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
404
- // if (ok) {
405
- // jQuery('#divStatus').html('');
406
- // } else {
407
- // jQuery('#divStatus').html('The specified text was not found.');
408
- // }
409
- }
410
- }
411
- });
412
-
413
- });
414
-
415
- function getSelected(window) {
416
- if (window.getSelection) { return window.getSelection(); }
417
- else if (document.getSelection) { return document.getSelection(); }
418
- else {
419
- var selection = document.selection && document.selection.createRange();
420
- if (selection.text) { return selection.text; }
421
- return false;
422
- }
423
- return false;
424
- }
425
-
426
- document.addEventListener('keydown', (e)=>{
427
- if(e.keyCode === 27) { // escape key
428
-
429
- var modal = parent.document.querySelector(".is-modal.searchreplace");
430
- parent._cb.hideModal(modal);
431
- }
432
- });
433
-
434
- </script>
435
- </body>
436
- </html>
437
-
438
- `;
439
-
440
- return html;
441
- }
442
-
443
- })();
444
-
445
-
446
- // https://stackoverflow.com/questions/32192664/how-to-select-a-given-string-repeatedly-within-the-text-of-a-contenteditable-ele
447
- function findOne(target, caseSensitive, within, startNode, startPos) {
448
-
449
- if (rangy.supported) {
450
- var range = rangy.createRange();
451
- var searchScopeRange = rangy.createRange();
452
-
453
- searchScopeRange.selectNodeContents(within);
454
-
455
- if (startNode != null && startPos != null) {
456
- searchScopeRange.setStart(startNode, startPos);
457
- }
458
-
459
- var options = {
460
- caseSensitive: caseSensitive,
461
- wholeWordsOnly: true,
462
- withinRange: searchScopeRange
463
- };
464
-
465
- if (target !== "") {
466
- let result = (range.findText(target, options));
467
-
468
- selectRange(range.startContainer, range.endContainer, range.startOffset, range.endOffset);
469
-
470
- return result;
471
- // var text = getSelected(parent);
472
- // if (text != '') {
473
- // return true;
474
- // } else {
475
- // return false;
476
- // }
477
- }
478
- }
479
-
480
- function selectRange(startNode, endNode, startPos, endPos) {
481
- var range = document.createRange()
482
- range.setStart(startNode, startPos);
483
- range.setEnd(endNode, endPos);
484
-
485
- var sel = window.getSelection();
486
- sel.removeAllRanges();
487
- sel.addRange(range);
488
- }
489
-
490
- function getSelected(window) {
491
- if (window.getSelection) { return window.getSelection(); }
492
- else if (document.getSelection) { return document.getSelection(); }
493
- else {
494
- var selection = document.selection && document.selection.createRange();
495
- if (selection.text) { return selection.text; }
496
- return false;
497
- }
498
- return false;
499
- }
500
-
501
- }
502
-
503
- // https://stackoverflow.com/questions/1181700/set-cursor-position-on-contenteditable-div/3323835
504
- // $.fn.focusEnd = function () {
505
- // $(this).focus();
506
- // var tmp = $('<span />').appendTo($(this)),
507
- // node = tmp.get(0),
508
- // range = null,
509
- // sel = null;
510
-
511
- // if (document.selection) {
512
- // range = document.body.createTextRange();
513
- // range.moveToElementText(node);
514
- // range.select();
515
- // } else if (window.getSelection) {
516
- // range = document.createRange();
517
- // range.selectNode(node);
518
- // sel = window.getSelection();
519
- // sel.removeAllRanges();
520
- // sel.addRange(range);
521
- // }
522
- // tmp.remove();
523
- // return this;
524
- // }
@@ -1,23 +0,0 @@
1
- Search & Replace Plugin
2
-
3
- To install the plugin, modify config file (contentbuilder\config.js) as follow:
4
-
5
- _cb.settings.plugins = ['searchreplace'];
6
-
7
- This plugin will add a 'Search & Replace' button on the 'More' popup on toolbar (click the 'More' button).
8
-
9
- You can also add the "searchreplace" button on the buttons or buttonsMore parameters:
10
-
11
- var obj = $.contentbuilder({
12
- ...
13
- buttons: [..., "searchreplace", ...]
14
- });
15
-
16
- or
17
-
18
- var obj = $.contentbuilder({
19
- ...
20
- buttonsMore: [..., "searchreplace", ...]
21
- });
22
-
23
- For more info about buttons or buttonsMore parameters, please check the ContentBuilder.js readme.txt.