@innovastudio/contentbuilder 1.0.33 → 1.0.34

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 (91) hide show
  1. package/README.md +1913 -0
  2. package/license.txt +80 -0
  3. package/package.json +40 -19
  4. package/public/contentbuilder/config.js +8 -0
  5. package/public/contentbuilder/contentbuilder.css +4282 -0
  6. package/public/contentbuilder/contentbuilder.esm.js +59500 -0
  7. package/public/contentbuilder/contentbuilder.min.js +122 -0
  8. package/public/contentbuilder/lang/en.js +299 -0
  9. package/public/contentbuilder/lang/fr.js +299 -0
  10. package/public/contentbuilder/plugins/buttoneditor/images/a.jpg +0 -0
  11. package/public/contentbuilder/plugins/buttoneditor/images/b.jpg +0 -0
  12. package/public/contentbuilder/plugins/buttoneditor/images/c.jpg +0 -0
  13. package/public/contentbuilder/plugins/buttoneditor/images/d.jpg +0 -0
  14. package/public/contentbuilder/plugins/buttoneditor/images/e.jpg +0 -0
  15. package/public/contentbuilder/plugins/buttoneditor/images/f.jpg +0 -0
  16. package/public/contentbuilder/plugins/buttoneditor/images/g.jpg +0 -0
  17. package/public/contentbuilder/plugins/buttoneditor/images/h.jpg +0 -0
  18. package/public/contentbuilder/plugins/buttoneditor/plugin.js +1566 -0
  19. package/public/contentbuilder/plugins/buttoneditor/readme.txt +7 -0
  20. package/public/contentbuilder/plugins/helloworld/plugin.js +15 -0
  21. package/public/contentbuilder/plugins/helloworld/readme.txt +23 -0
  22. package/public/contentbuilder/plugins/preview/plugin.js +301 -0
  23. package/public/contentbuilder/plugins/preview/readme.txt +23 -0
  24. package/public/contentbuilder/plugins/searchreplace/plugin.js +458 -0
  25. package/public/contentbuilder/plugins/searchreplace/readme.txt +23 -0
  26. package/public/contentbuilder/plugins/searchreplace/searchreplace.html +264 -0
  27. package/public/contentbuilder/plugins/showgrid/plugin.js +73 -0
  28. package/public/contentbuilder/plugins/showgrid/readme.txt +23 -0
  29. package/public/contentbuilder/plugins/symbols/plugin.js +2876 -0
  30. package/public/contentbuilder/plugins/symbols/readme.txt +23 -0
  31. package/public/contentbuilder/plugins/wordcount/plugin.js +75 -0
  32. package/public/contentbuilder/plugins/wordcount/readme.txt +23 -0
  33. package/public/contentbuilder/themes/colored-blue.css +1125 -0
  34. package/public/contentbuilder/themes/colored-blue2.css +1125 -0
  35. package/public/contentbuilder/themes/colored-blue3.css +1125 -0
  36. package/public/contentbuilder/themes/colored-blue4.css +1125 -0
  37. package/public/contentbuilder/themes/colored-blue5.css +1125 -0
  38. package/public/contentbuilder/themes/colored-blue6.css +1125 -0
  39. package/public/contentbuilder/themes/colored-blue7.css +1125 -0
  40. package/public/contentbuilder/themes/colored-blue8.css +1125 -0
  41. package/public/contentbuilder/themes/colored-dark.css +1125 -0
  42. package/public/contentbuilder/themes/colored-darkblue.css +1125 -0
  43. package/public/contentbuilder/themes/colored-gray.css +1125 -0
  44. package/public/contentbuilder/themes/colored-green.css +1125 -0
  45. package/public/contentbuilder/themes/colored-green2.css +1125 -0
  46. package/public/contentbuilder/themes/colored-green3.css +1125 -0
  47. package/public/contentbuilder/themes/colored-green4.css +1125 -0
  48. package/public/contentbuilder/themes/colored-green5.css +1125 -0
  49. package/public/contentbuilder/themes/colored-magenta.css +1125 -0
  50. package/public/contentbuilder/themes/colored-orange.css +1125 -0
  51. package/public/contentbuilder/themes/colored-orange2.css +1125 -0
  52. package/public/contentbuilder/themes/colored-orange3.css +1125 -0
  53. package/public/contentbuilder/themes/colored-pink.css +1125 -0
  54. package/public/contentbuilder/themes/colored-pink2.css +1125 -0
  55. package/public/contentbuilder/themes/colored-pink3.css +1125 -0
  56. package/public/contentbuilder/themes/colored-pink4.css +1125 -0
  57. package/public/contentbuilder/themes/colored-purple.css +1125 -0
  58. package/public/contentbuilder/themes/colored-purple2.css +1125 -0
  59. package/public/contentbuilder/themes/colored-red.css +1125 -0
  60. package/public/contentbuilder/themes/colored-red2.css +1125 -0
  61. package/public/contentbuilder/themes/colored-red3.css +1125 -0
  62. package/public/contentbuilder/themes/colored-red4.css +1125 -0
  63. package/public/contentbuilder/themes/colored-red5.css +1125 -0
  64. package/public/contentbuilder/themes/colored-yellow.css +1125 -0
  65. package/public/contentbuilder/themes/colored-yellow2.css +1125 -0
  66. package/public/contentbuilder/themes/dark-blue.css +1125 -0
  67. package/public/contentbuilder/themes/dark-blue2.css +1125 -0
  68. package/public/contentbuilder/themes/dark-blue3.css +1125 -0
  69. package/public/contentbuilder/themes/dark-gray.css +1125 -0
  70. package/public/contentbuilder/themes/dark-pink.css +1125 -0
  71. package/public/contentbuilder/themes/dark-purple.css +1125 -0
  72. package/public/contentbuilder/themes/dark-red.css +1125 -0
  73. package/public/contentbuilder/themes/dark.css +1124 -0
  74. package/public/contentbuilder/themes/light-blue.css +1125 -0
  75. package/public/contentbuilder/themes/light-blue2.css +1125 -0
  76. package/public/contentbuilder/themes/light-blue3.css +1125 -0
  77. package/public/contentbuilder/themes/light-cyan.css +1125 -0
  78. package/public/contentbuilder/themes/light-gray.css +1125 -0
  79. package/public/contentbuilder/themes/light-gray2.css +1125 -0
  80. package/public/contentbuilder/themes/light-green.css +1125 -0
  81. package/public/contentbuilder/themes/light-pink.css +1125 -0
  82. package/public/contentbuilder/themes/light-pink2.css +1125 -0
  83. package/public/contentbuilder/themes/light-purple.css +1125 -0
  84. package/public/contentbuilder/themes/light-purple2.css +1125 -0
  85. package/public/contentbuilder/themes/light-red.css +1125 -0
  86. package/public/contentbuilder/themes/light-yellow.css +1125 -0
  87. package/public/contentbuilder/themes/light-yellow2.css +1125 -0
  88. package/readme.txt +23 -0
  89. package/.eslintrc.json +0 -28
  90. package/lib/contentbuilder.js +0 -46711
  91. package/rollup.config.js +0 -23
@@ -0,0 +1,458 @@
1
+ /*
2
+ Search & Replace Plugin
3
+ */
4
+
5
+ (function () {
6
+ var js1 = 'https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.0/rangy-core.min.js';
7
+ var js2 = 'https://cdnjs.cloudflare.com/ajax/libs/rangy/1.3.0/rangy-textrange.min.js'
8
+
9
+ // _cb.getScript(js1);
10
+ // _cb.getScript(js2);
11
+ _cb.getScripts([js1,js2]); //Get js1 first, then after loaded, get js2
12
+
13
+ var html = '<div class="is-modal is-modal-content searchreplace">' +
14
+ '<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') +
15
+ '<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>' +
16
+ '</div>' +
17
+ '<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>' +
18
+ '</div>' +
19
+ '<svg width="0" height="0" style="position:absolute;display:none;">' +
20
+ '<defs>' +
21
+ '<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>' +
22
+ '</defs>' +
23
+ '</svg>';
24
+
25
+ _cb.addHtml(html);
26
+
27
+ var css = '<style>#_cbhtml .is-modal.searchreplace {' +
28
+ 'z-index:10004;position:fixed;width:500px;height:265px;top:50%;left:50%;margin-top:-155px;margin-left:-250px;' +
29
+ '}' +
30
+ '</style>';
31
+
32
+ _cb.addCss(css);
33
+
34
+ var button = '<button class="searchreplace-button" title="Search & Replace" style="font-size:15px;vertical-align:bottom;">' +
35
+ '<svg class="is-icon-flex" style="width:17px;height:17px;"><use xlink:href="#ion-ios-search-strong"></use></svg>' +
36
+ '</button>';
37
+
38
+ _cb.addButton('searchreplace', button, '.searchreplace-button', function () {
39
+
40
+
41
+ var modal = document.querySelector(".is-modal.searchreplace");
42
+ modal.className = modal.className + ' active';
43
+
44
+ var btnClose = modal.querySelector('.is-modal-close');
45
+ btnClose.addEventListener('click', function(e){
46
+ _cb.hideModal(modal);
47
+ });
48
+
49
+ // var scriptPath = _cb.getScriptPath();
50
+ // modal.querySelector('iframe').src = scriptPath + 'plugins/searchreplace/searchreplace.html';
51
+
52
+ // var wraper = _cb.getScope();
53
+ // $wraper.focusEnd();
54
+
55
+ iframe = modal.querySelector('iframe');
56
+ doc = iframe.contentWindow.document;
57
+ doc.open();
58
+ doc.write(getHTML());
59
+ doc.close();
60
+
61
+ });
62
+ /*
63
+ _cb.addButton2('searchreplace', button, '.searchreplace-button', function () {
64
+
65
+ var modal = document.querySelector(".is-modal.searchreplace");
66
+ modal.className = modal.className + ' active';
67
+
68
+ var btnClose = modal.querySelector('.is-modal-close');
69
+ btnClose.addEventListener('click', function(e){
70
+ _cb.hideModal(modal);
71
+ });
72
+
73
+ // var scriptPath = _cb.getScriptPath();
74
+ // modal.querySelector('iframe').src = scriptPath + 'plugins/searchreplace/searchreplace.html';
75
+
76
+ // var wraper = _cb.getScope();
77
+ // $wraper.focusEnd();
78
+
79
+ iframe = modal.querySelector('iframe');
80
+ doc = iframe.contentWindow.document;
81
+ doc.open();
82
+ doc.write(getHTML());
83
+ doc.close();
84
+
85
+ });
86
+ */
87
+
88
+ function getHTML() {
89
+
90
+ const html = `
91
+ <!DOCTYPE HTML>
92
+ <html>
93
+ <head>
94
+ <meta charset="utf-8">
95
+ <title></title>
96
+ <style>
97
+ body {margin:20px 20px 0;overflow-x:hidden;overflow-y:auto;font-family:sans-serif;
98
+ font-size: 12px;
99
+ letter-spacing: 1px;
100
+ font-weight: 300;}
101
+ .container {}
102
+ .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;}
103
+ .clearfix:before, .clearfix:after {content: " ";display: table;}
104
+ .clearfix:after {clear: both;}
105
+ .clearfix {*zoom: 1;}
106
+
107
+ .inptext {
108
+ width: 90%;
109
+ height: 45px;
110
+ box-sizing: border-box;
111
+ margin: 0;
112
+ font-family: sans-serif;
113
+ font-size: 15px;
114
+ letter-spacing: 1px;
115
+ padding: 0;
116
+ padding-left: 8px;
117
+ display: inline-block;
118
+ border: none;
119
+ border-radius: 0;
120
+ color: ${_cb.styleInputColor};
121
+ background-color: ${_cb.styleInputBackground};
122
+ border-bottom: ${_cb.styleInputBorderBottom};
123
+ }
124
+ #chkMatchCase {opacity:0.9}
125
+ button {
126
+ width: 55px;
127
+ height: 45px;
128
+ background-color: ${_cb.styleButtonClassicBackground};
129
+ color: ${_cb.styleButtonClassicColor};
130
+ border: transparent 1px solid;
131
+ border-bottom: ${_cb.styleInputBorderBottom};
132
+ font-family: sans-serif;
133
+ font-size: 12px;
134
+ letter-spacing: 1px;
135
+ font-weight: 300;
136
+ opacity: 1;
137
+ line-height: 1;
138
+ display: inline-block;
139
+ box-sizing: border-box;
140
+ margin: 0;
141
+ padding: 0;
142
+ cursor: pointer;
143
+ text-transform: none;
144
+ text-align: center;
145
+ position: relative;
146
+ border-radius: 0;
147
+ user-select: none;
148
+ -moz-user-select: none;
149
+ -khtml-user-select: none;
150
+ -webkit-user-select: none;
151
+ -o-user-select: none;
152
+ white-space: nowrap;
153
+ display: flex;
154
+ align-items: center;
155
+ justify-content: center;
156
+ }
157
+ .inptext:focus {outline:none}
158
+ button:focus {outline:none;}
159
+ .input-replaceall {
160
+ border: none;
161
+ }
162
+ button:hover {
163
+ background-color: ${_cb.styleButtonClassicBackgroundHover};
164
+ }
165
+
166
+ label {
167
+ color: ${_cb.styleLabelColor};
168
+ }
169
+ </style>
170
+ </head>
171
+ <body>
172
+ <form autocomplete="off">
173
+ <div style="display:flex;justify-content:space-between;">
174
+ <input id="txtSearch" tabindex="1" class="inptext" type="text" style="width:100%;" autocomplete="off" />
175
+ <button class="input-search" style="width:130px;">Search Next</button>
176
+ </div>
177
+ <div style="margin:10px 0">
178
+ <label for="txtReplaceWith">Replace with:</label>
179
+ </div>
180
+ <div style="display:flex;justify-content:space-between;">
181
+ <input id="txtReplaceWith" tabindex="2" class="inptext" type="text" style="width:100%;" autocomplete="off" />
182
+ <button class="input-replace" style="width:130px;">Replace</button>
183
+ </div>
184
+ <div style="display:flex;justify-content:space-between;margin:17px 0;">
185
+ <div>
186
+ <label id="lblMatchCase" for="chkMatchCase">
187
+ <input type="checkbox" name="chkMatchCase" id="chkMatchCase"> Match case
188
+ </label>
189
+ <div id="divStatus" style="margin-top:12px;"></div>
190
+ </div>
191
+ <button class="input-replaceall" style="width:130px;">Replace All</button>
192
+ </div>
193
+ </form>
194
+
195
+
196
+ <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
197
+ <script>
198
+ var nReplaceCount = 0;
199
+
200
+ jQuery(document).ready(function () {
201
+
202
+ jQuery('#txtSearch').focus();
203
+
204
+ jQuery('.input-replaceall').click(function (e) {
205
+
206
+ e.preventDefault();
207
+
208
+ jQuery('#divStatus').html('');
209
+
210
+ var target = jQuery('#txtSearch').val();
211
+ var replaceWith = jQuery('#txtReplaceWith').val();
212
+ if (jQuery("#chkMatchCase").prop("checked")) {
213
+ var bMatchCase = true;
214
+ } else {
215
+ var bMatchCase = false;
216
+ }
217
+
218
+ var within = parent._cb.getScope();
219
+
220
+ var sel = parent.getSelection();
221
+
222
+ var r1 = parent.document.createRange();
223
+ r1.selectNodeContents(within);
224
+
225
+ // https://stackoverflow.com/questions/32192664/how-to-select-a-given-string-repeatedly-within-the-text-of-a-contenteditable-ele
226
+ if (sel.toString().search(target) > -1) {
227
+ var ok = parent.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
228
+ if (ok) {
229
+ var rng = parent.getSelection().getRangeAt(0);
230
+ rng.deleteContents();
231
+ rng.insertNode(document.createTextNode(replaceWith));
232
+ nReplaceCount++;
233
+ }
234
+ jQuery('.input-replaceall').trigger('click');
235
+ } else if (sel.toString().length > 0) {
236
+ var ok = parent.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
237
+ if (ok) {
238
+ var rng = parent.getSelection().getRangeAt(0);
239
+ rng.deleteContents();
240
+ rng.insertNode(document.createTextNode(replaceWith));
241
+ nReplaceCount++;
242
+ }
243
+ jQuery('.input-replaceall').trigger('click');
244
+ } else if (sel.rangeCount) {
245
+ var ok = parent.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
246
+ if (ok) {
247
+ var rng = parent.getSelection().getRangeAt(0);
248
+ rng.deleteContents();
249
+ rng.insertNode(document.createTextNode(replaceWith));
250
+ nReplaceCount++;
251
+ jQuery('.input-replaceall').trigger('click');
252
+ } else {
253
+ jQuery('#divStatus').html(nReplaceCount + ' occurrence(s) replaced.');
254
+ nReplaceCount = 0;
255
+ }
256
+ }
257
+ });
258
+
259
+ jQuery('.input-search').click(function (e) {
260
+
261
+ e.preventDefault();
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.getSelection();
274
+
275
+ var r1 = parent.document.createRange();
276
+ r1.selectNodeContents(within);
277
+
278
+ if (sel.toString().search(target) > -1) {
279
+ var ok = parent.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
280
+ if (ok) {
281
+ jQuery('#divStatus').html('');
282
+ } else {
283
+
284
+ }
285
+ } else if (sel.toString().length > 0) {
286
+ var ok = parent.findOne(target, bMatchCase, within, sel.focusNode, sel.focusOffset);
287
+ if (ok) {
288
+ jQuery('#divStatus').html('');
289
+ } else {
290
+ jQuery('#divStatus').html('Passed the end of the content.');
291
+ var ok = parent.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
292
+ if (ok) {
293
+ jQuery('#divStatus').html('');
294
+ } else {
295
+ jQuery('#divStatus').html('The specified text was not found.');
296
+ }
297
+ }
298
+ } else if (sel.rangeCount) {
299
+ var ok = parent.findOne(target, bMatchCase, within, sel.anchorNode, sel.anchorOffset);
300
+ if (ok) {
301
+ jQuery('#divStatus').html('');
302
+ } else {
303
+ var ok = parent.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
304
+ if (ok) {
305
+ jQuery('#divStatus').html('');
306
+ } else {
307
+ jQuery('#divStatus').html('The specified text was not found.');
308
+ }
309
+ }
310
+ }
311
+
312
+ });
313
+
314
+ jQuery('.input-replace').click(function (e) {
315
+
316
+ e.preventDefault();
317
+
318
+ var target = jQuery('#txtSearch').val();
319
+ var replaceWith = jQuery('#txtReplaceWith').val();
320
+ if (jQuery("#chkMatchCase").prop("checked")) {
321
+ var bMatchCase = true;
322
+ } else {
323
+ var bMatchCase = false;
324
+ }
325
+
326
+ var within = parent._cb.getScope();
327
+
328
+ var sel = parent.getSelection();
329
+
330
+ var r1 = parent.document.createRange();
331
+ r1.selectNodeContents(within);
332
+
333
+ var text = getSelected(parent);
334
+ if (text) {
335
+ if ((((text + '').toLowerCase() == target.toLowerCase()) && bMatchCase==false) ||
336
+ ((text == target) && bMatchCase == true)) {
337
+ var rng = parent.getSelection().getRangeAt(0);
338
+ rng.deleteContents();
339
+ rng.insertNode(document.createTextNode(replaceWith));
340
+ }
341
+ }
342
+
343
+ if (sel.rangeCount) {
344
+ var ok = parent.findOne(target, bMatchCase, within, sel.anchorNode, sel.anchorOffset);
345
+ if (ok) {
346
+ jQuery('#divStatus').html('');
347
+ } else {
348
+ var ok = parent.findOne(target, bMatchCase, within, r1.commonAncestorContainer, r1.startOffset);
349
+ if (ok) {
350
+ jQuery('#divStatus').html('');
351
+ } else {
352
+ jQuery('#divStatus').html('The specified text was not found.');
353
+ }
354
+ }
355
+ }
356
+ });
357
+
358
+ });
359
+
360
+ function getSelected(window) {
361
+ if (window.getSelection) { return window.getSelection(); }
362
+ else if (document.getSelection) { return document.getSelection(); }
363
+ else {
364
+ var selection = document.selection && document.selection.createRange();
365
+ if (selection.text) { return selection.text; }
366
+ return false;
367
+ }
368
+ return false;
369
+ }
370
+
371
+ </script>
372
+ </body>
373
+ </html>
374
+
375
+ `;
376
+
377
+ return html;
378
+ }
379
+
380
+ })();
381
+
382
+ // https://stackoverflow.com/questions/32192664/how-to-select-a-given-string-repeatedly-within-the-text-of-a-contenteditable-ele
383
+ function findOne(target, caseSensitive, within, startNode, startPos) {
384
+ if (rangy.supported) {
385
+ var range = rangy.createRange();
386
+ var searchScopeRange = rangy.createRange();
387
+
388
+ searchScopeRange.selectNodeContents(within);
389
+
390
+ if (startNode != null && startPos != null) {
391
+ searchScopeRange.setStart(startNode, startPos);
392
+ }
393
+
394
+ var options = {
395
+ caseSensitive: caseSensitive,
396
+ wholeWordsOnly: true,
397
+ withinRange: searchScopeRange
398
+ };
399
+
400
+ if (target !== "") {
401
+ range.findText(target, options);
402
+
403
+ selectRange(range.startContainer, range.endContainer, range.startOffset, range.endOffset);
404
+
405
+ var text = getSelected(parent);
406
+ if (text != '') {
407
+ return true;
408
+ } else {
409
+ return false;
410
+ }
411
+ }
412
+ }
413
+
414
+ function selectRange(startNode, endNode, startPos, endPos) {
415
+ var range = document.createRange()
416
+ range.setStart(startNode, startPos);
417
+ range.setEnd(endNode, endPos);
418
+
419
+ var sel = window.getSelection();
420
+ sel.removeAllRanges();
421
+ sel.addRange(range);
422
+ }
423
+
424
+ function getSelected(window) {
425
+ if (window.getSelection) { return window.getSelection(); }
426
+ else if (document.getSelection) { return document.getSelection(); }
427
+ else {
428
+ var selection = document.selection && document.selection.createRange();
429
+ if (selection.text) { return selection.text; }
430
+ return false;
431
+ }
432
+ return false;
433
+ }
434
+
435
+ }
436
+
437
+ // https://stackoverflow.com/questions/1181700/set-cursor-position-on-contenteditable-div/3323835
438
+ // $.fn.focusEnd = function () {
439
+ // $(this).focus();
440
+ // var tmp = $('<span />').appendTo($(this)),
441
+ // node = tmp.get(0),
442
+ // range = null,
443
+ // sel = null;
444
+
445
+ // if (document.selection) {
446
+ // range = document.body.createTextRange();
447
+ // range.moveToElementText(node);
448
+ // range.select();
449
+ // } else if (window.getSelection) {
450
+ // range = document.createRange();
451
+ // range.selectNode(node);
452
+ // sel = window.getSelection();
453
+ // sel.removeAllRanges();
454
+ // sel.addRange(range);
455
+ // }
456
+ // tmp.remove();
457
+ // return this;
458
+ // }
@@ -0,0 +1,23 @@
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.