@themarioga/grid-editor 6.0.0-beta.4 → 6.0.0

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 (43) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +60 -6
  3. package/UPGRADING.md +27 -2
  4. package/dist/grideditor.css +46 -0
  5. package/dist/grideditor.min.css +1 -1
  6. package/dist/grideditor.min.css.map +1 -1
  7. package/dist/jquery.grideditor.bundle.min.js +2 -2
  8. package/dist/jquery.grideditor.js +53 -20
  9. package/dist/jquery.grideditor.min.js +1 -1
  10. package/dist/jquery.grideditor.min.js.map +1 -1
  11. package/dist/locales/grideditor.es.js +4 -2
  12. package/dist/locales/grideditor.es.min.js +1 -1
  13. package/dist/locales/grideditor.es.min.js.map +1 -1
  14. package/dist/plugins/grideditor.ckeditor.js +6 -52
  15. package/dist/plugins/grideditor.ckeditor.min.js +1 -1
  16. package/dist/plugins/grideditor.ckeditor.min.js.map +1 -1
  17. package/dist/plugins/grideditor.codemirror-inline.js +190 -0
  18. package/dist/plugins/grideditor.codemirror-inline.min.js +2 -0
  19. package/dist/plugins/grideditor.codemirror-inline.min.js.map +1 -0
  20. package/dist/plugins/grideditor.codemirror.js +79 -0
  21. package/dist/plugins/grideditor.codemirror.min.js +2 -0
  22. package/dist/plugins/grideditor.codemirror.min.js.map +1 -0
  23. package/dist/plugins/grideditor.summernote.js +6 -52
  24. package/dist/plugins/grideditor.summernote.min.js +1 -1
  25. package/dist/plugins/grideditor.summernote.min.js.map +1 -1
  26. package/dist/plugins/grideditor.tinymce.js +6 -52
  27. package/dist/plugins/grideditor.tinymce.min.js +1 -1
  28. package/dist/plugins/grideditor.tinymce.min.js.map +1 -1
  29. package/docs/events.md +6 -0
  30. package/docs/locale-keys.md +14 -4
  31. package/docs/plugins.md +20 -5
  32. package/example/codemirror.html +103 -0
  33. package/example/index.html +8 -0
  34. package/package.json +1 -1
  35. package/src/js/jquery.grideditor.js +53 -20
  36. package/src/js/locales/grideditor.es.js +4 -2
  37. package/src/js/plugins/grideditor.ckeditor.js +2 -2
  38. package/src/js/plugins/grideditor.codemirror-inline.js +190 -0
  39. package/src/js/plugins/grideditor.codemirror.js +79 -0
  40. package/src/js/plugins/grideditor.summernote.js +2 -2
  41. package/src/js/plugins/grideditor.tinymce.js +2 -2
  42. package/src/js/text/grideditor.text.js +4 -50
  43. package/src/less/grideditor.less +54 -0
@@ -8,10 +8,10 @@
8
8
  *
9
9
  * It is a feature plugin, `text`, that the `plugins` setting does not choose
10
10
  * (content_types does), and it is everything a text is to the editor: the
11
- * text block's drawer, the Text buttons in the toolbar and the Add text tool
12
- * in each column, createText, opening an editor on a click and closing it
13
- * again with the host's attributes put back, and making the host's plain
14
- * content a text through the core's `textTypes` hook.
11
+ * text block's drawer, the Text buttons in the toolbar, createText, opening
12
+ * an editor on a click and closing it again with the host's attributes put
13
+ * back, and making the host's plain content a text through the core's
14
+ * `textTypes` hook.
15
15
  *
16
16
  * Each editor registers under $.fn.gridEditor.texts, which is this file's own
17
17
  * registry and not a contract: an editor of a host's own is a feature plugin
@@ -22,8 +22,6 @@
22
22
  if ($.fn.gridEditor.features.text) { return; }
23
23
 
24
24
  $.extend($.fn.gridEditor.locales.en, {
25
- 'tool.add_text': 'Add text',
26
- 'tool.add_text_type': 'Add {editor} text',
27
25
  'text.add': 'Text',
28
26
  'text.add_type': 'Text ({editor})',
29
27
  'panel.editor': 'Editor',
@@ -119,11 +117,6 @@
119
117
  .html(content !== undefined ? content : (text && text.initialContent) || '');
120
118
  }
121
119
 
122
- /** A text block at the end of a column, through the add events. */
123
- function addTextTo(col, type) {
124
- return ge.place(makeText(type), 'text', { appendTo: col, source: 'tool' });
125
- }
126
-
127
120
  /**
128
121
  * createText(type?, options?): a content area of a text editor's,
129
122
  * detached unless a placement is given. The type is the first one
@@ -262,44 +255,6 @@
262
255
  });
263
256
  }
264
257
 
265
- /**
266
- * The add text tool, in each column's drawer before its add row tool:
267
- * a text of the first editor offered, or, held, of the one chosen.
268
- */
269
- function addTextTools() {
270
- var texts = offeredTexts();
271
- if (!texts.length) { return; }
272
-
273
- ge.canvas.find('.column').each(function() {
274
- var col = $(this);
275
- var drawer = col.children('.ge-tools-drawer');
276
- if (!drawer.length || drawer.children('.ge-add-text').length) { return; }
277
-
278
- ge.createTool(drawer, ge.t('tool.add_text'), 'ge-add-text', 'bi bi-type', function() {
279
- if (ge.closePicker()) { return; } // The picker was open: that was the answer
280
-
281
- addTextTo(col, texts[0]);
282
- });
283
-
284
- var tool = drawer.children('.ge-add-text');
285
- var addRow = drawer.children('.ge-add-row');
286
- if (addRow.length) { tool.insertBefore(addRow); }
287
-
288
- if (texts.length > 1) {
289
- ge.attachPicker(tool, function() {
290
- ge.openPicker(tool, texts.map(function(type) {
291
- return {
292
- label: textLabel(type),
293
- title: ge.t('tool.add_text_type', { editor: textLabel(type) }),
294
- attributes: { 'data-ge-content-type': type },
295
- choose: function() { addTextTo(col, type); },
296
- };
297
- }), 'ge-text-picker');
298
- });
299
- }
300
- });
301
- }
302
-
303
258
  var texts = offeredTexts();
304
259
 
305
260
  return {
@@ -354,7 +309,6 @@
354
309
 
355
310
  onInit: function() {
356
311
  markTexts();
357
- addTextTools();
358
312
 
359
313
  ge.canvas.off('click.ge-text').on('click.ge-text', '.ge-content', onClick);
360
314
  },
@@ -402,8 +356,8 @@
402
356
  *
403
357
  * Up to 5.x the main bundle carried a copy of this file; since 6.0 it is
404
358
  * loaded on its own, like every plugin. The built file starts with what
405
- * every text editor shares - text blocks, the Text button and the Add text
406
- * tool, createText, making the host's plain content a text - from
359
+ * every text editor shares - text blocks, the Text button, createText,
360
+ * making the host's plain content a text - from
407
361
  * src/js/text/grideditor.text.js, installed once however many editors a
408
362
  * page loads.
409
363
  */
@@ -1,2 +1,2 @@
1
- (x=>{var e,v;function h(t){var n={};return x.each(x.makeArray(t.attributes),function(t,e){n[e.name]=e.value}),n}function p(t){return(t||"").split(/\s+/).filter(function(t){return""!==t&&!e.test(t)})}function t(o){var r=o.settings,f={},n={};function i(){return r.content_types.filter(function(t){return!!f[t]})}function c(t){var e=f[t];return e&&e.labelKey?o.t(e.labelKey):t}function a(t,e){var n=f[t];return x('<div class="ge-content" />').addClass("ge-content-type-"+t).attr("data-ge-content-type",t).html(void 0!==e?e:n&&n.initialContent||"")}function d(t,e){o.place(a(e),"text",{appendTo:t,source:"tool"})}function e(t){return f[t.attr("data-ge-content-type")]}function l(t){var e;t.hasClass("ge-rte-active")||t.is(":visible")&&(e=f[t.attr("data-ge-content-type")])&&(e.available&&!e.available()?e.missingKey&&console.error(o.t(e.missingKey)):(t.data("ge-text-before",h(t[0])).removeData("ge-text-ready"),t.addClass("ge-rte-active"),e.start(t)))}function t(){l(x(this))}function s(t){var n,e,a,i,o,r,c,d=f[t.attr("data-ge-content-type")],l=t.data("ge-text-before"),s=l?h(t[0]):null;d&&d.stop(t),t.removeClass("ge-rte-active"),l&&(d=l,e=(n=t).data("ge-text-ready")||l,a=s,i=x.extend({},d),x.each(x.extend({},e,a),function(t){"class"===t||v.test(t)||e[t]===a[t]||(void 0===a[t]?delete i[t]:i[t]=a[t])}),o=p(e.class),r=p(a.class),c=p(d.class).filter(function(t){return-1!==r.indexOf(t)||-1===o.indexOf(t)}),r.forEach(function(t){-1===o.indexOf(t)&&-1===c.indexOf(t)&&c.push(t)}),c.length?i.class=c.join(" "):delete i.class,x.each(h(n[0]),function(t){n.removeAttr(t)}),x.each(i,function(t,e){n.attr(t,e)}),t.removeData("ge-text-before").removeData("ge-text-ready"))}function u(e){var n=e.children(".ge-content"),t=n.attr("data-ge-content-type"),a=x('<div class="ge-tools-drawer ge-text-drawer" />').prependTo(e),i=(o.createMoveTool(a),o.addSettingsTool(a,n,r.text_classes));x('<div class="ge-field ge-text-editor" />').append(x('<span class="ge-field-label" />').text(o.t("panel.editor"))).append(x('<span class="ge-field-value" />').text(c(t))).prependTo(i.children(".ge-details-general")),r.text_tools.forEach(function(t){o.createTool(a,t.title||"",t.className||"",t.iconClass||"bi bi-wrench",t.on)}),o.createTool(a,o.t("tool.delete_text"),"ge-delete-text","bi bi-trash",function(){o.deleteNode("text",n,o.t("confirm.delete_text"),function(t){s(n),e.slideUp(function(){e.remove(),t()})})})}x.each(x.fn.gridEditor.texts,function(t,e){f[t]=e(o)}),Array.isArray(r.content_types)||(r.content_types=Object.keys(f)),Array.isArray(r.text_tools)||(r.text_tools=[]),Array.isArray(r.text_classes)||(r.text_classes=[]);var g=i();return{methods:{createText:function(t,e){return t&&"object"==typeof t&&(e=t,t=void 0),e=e||{},(t=t||i()[0])&&f[t]?o.place(a(t,e.content),"text",e):(n["createText:"+t]||(n["createText:"+t]=!0,o.warn('createText: no text editor "'+t+'" is loaded; load its plugin and name it in content_types')),null)}},textTypes:function(){var n=i(),t=Object.keys(f).filter(function(t){return-1===n.indexOf(t)});return n.concat(t).map(function(t){var e=f[t];return{type:t,label:c(t),offered:-1!==n.indexOf(t),available:e.available?function(){return e.available()}:null,missingKey:e.missingKey,edit:function(t){var e=t.parent(".ge-text-block");e.length&&!e.children(".ge-tools-drawer").length&&u(e),l(t)}}})},toolbar:g.map(function(t){return{label:function(){return 1<g.length?o.t("text.add_type",{editor:c(t)}):o.t("text.add")},iconClass:f[t].iconClass,className:"ge-add-text-button",kind:"text",inColumn:!0,create:function(){return a(t)}}}),onInit:function(){var a;o.canvas.find(".ge-text-block").each(function(){var t=x(this);t.children(".ge-tools-drawer").length||e(t.children(".ge-content"))&&u(t)}),(a=i()).length&&o.canvas.find(".column").each(function(){var t,e=x(this),n=e.children(".ge-tools-drawer");n.length&&!n.children(".ge-add-text").length&&(o.createTool(n,o.t("tool.add_text"),"ge-add-text","bi bi-type",function(){o.closePicker()||d(e,a[0])}),t=n.children(".ge-add-text"),(n=n.children(".ge-add-row")).length&&t.insertBefore(n),1<a.length)&&o.attachPicker(t,function(){o.openPicker(t,a.map(function(t){return{label:c(t),title:o.t("tool.add_text_type",{editor:c(t)}),attributes:{"data-ge-content-type":t},choose:function(){d(e,t)}}}),"ge-text-picker")})}),o.canvas.off("click.ge-text").on("click.ge-text",".ge-content",t)},onBeforeDeinit:function(){o.canvas.find(".ge-content").each(function(){e(x(this))&&s(x(this))})},onDeinit:function(){o.canvas.off("click.ge-text")},onContentReady:function(t){t.data("ge-text-before")&&!t.data("ge-text-ready")&&t.data("ge-text-ready",h(t[0]))}}}x.fn.gridEditor.features.text||(x.extend(x.fn.gridEditor.locales.en,{"tool.add_text":"Add text","tool.add_text_type":"Add {editor} text","text.add":"Text","text.add_type":"Text ({editor})","panel.editor":"Editor","panel.kind_text":"Text"}),x.fn.gridEditor.texts=x.fn.gridEditor.texts||{},e=/^(mce-|cke|note-)|^(active|ge-rte-active)$/,v=/^(data-mce-|contenteditable$|spellcheck$)/,t.always=!0,x.fn.gridEditor.features.text=t)})(jQuery),(r=>{r.extend(r.fn.gridEditor.locales.en,{"text.ckeditor":"CKEditor"});var e="<p>Lorem initius... </p>";r.fn.gridEditor.texts.ckeditor=function(o){return{labelKey:"text.ckeditor",initialContent:e,missingKey:"error.ckeditor_missing",available:function(){return!!window.CKEDITOR},start:function(t){var i=o.settings;t.each(function(){var t,n,a=r(this);a.hasClass("active")||(a.html()==e&&a.html("&nbsp;"),a.addClass("active").attr("contenteditable","true"),t=r.extend({},i.ckeditor&&i.ckeditor.config?i.ckeditor.config:{},{on:{instanceReady:function(t){var e;try{e=i.ckeditor.config.on.instanceReady}catch(t){}e&&e.call(this,t),o.textReady(a),n.focus()}}}),n=window.CKEDITOR.inline(a.get(0),t),a.data("ge-ckeditor",n))})},stop:function(t){t.filter(".active").each(function(){var n,a,t=r(this),e=window.CKEDITOR?(n=t).data("ge-ckeditor")||(a=null,r.each(window.CKEDITOR.instances,function(t,e){e.element&&e.element.$===n[0]&&(a=e)}),a):null;e&&e.destroy(),t.removeData("ge-ckeditor"),t.removeClass("active cke_focus").removeAttr("id").removeAttr("style").removeAttr("spellcheck").removeAttr("contenteditable")})}}}})(jQuery);
1
+ (g=>{var t,x;function v(e){var n={};return g.each(g.makeArray(e.attributes),function(e,t){n[t.name]=t.value}),n}function y(e){return(e||"").split(/\s+/).filter(function(e){return""!==e&&!t.test(e)})}function e(r){var o=r.settings,f={},n={};function a(){return o.content_types.filter(function(e){return!!f[e]})}function c(e){var t=f[e];return t&&t.labelKey?r.t(t.labelKey):e}function i(e,t){var n=f[e];return g('<div class="ge-content" />').addClass("ge-content-type-"+e).attr("data-ge-content-type",e).html(void 0!==t?t:n&&n.initialContent||"")}function t(e){return f[e.attr("data-ge-content-type")]}function s(e){var t;e.hasClass("ge-rte-active")||e.is(":visible")&&(t=f[e.attr("data-ge-content-type")])&&(t.available&&!t.available()?t.missingKey&&console.error(r.t(t.missingKey)):(e.data("ge-text-before",v(e[0])).removeData("ge-text-ready"),e.addClass("ge-rte-active"),t.start(e)))}function e(){s(g(this))}function l(e){var n,t,a,i,r,o,c,s=f[e.attr("data-ge-content-type")],l=e.data("ge-text-before"),d=l?v(e[0]):null;s&&s.stop(e),e.removeClass("ge-rte-active"),l&&(s=l,t=(n=e).data("ge-text-ready")||l,a=d,i=g.extend({},s),g.each(g.extend({},t,a),function(e){"class"===e||x.test(e)||t[e]===a[e]||(void 0===a[e]?delete i[e]:i[e]=a[e])}),r=y(t.class),o=y(a.class),c=y(s.class).filter(function(e){return-1!==o.indexOf(e)||-1===r.indexOf(e)}),o.forEach(function(e){-1===r.indexOf(e)&&-1===c.indexOf(e)&&c.push(e)}),c.length?i.class=c.join(" "):delete i.class,g.each(v(n[0]),function(e){n.removeAttr(e)}),g.each(i,function(e,t){n.attr(e,t)}),e.removeData("ge-text-before").removeData("ge-text-ready"))}function d(t){var n=t.children(".ge-content"),e=n.attr("data-ge-content-type"),a=g('<div class="ge-tools-drawer ge-text-drawer" />').prependTo(t),i=(r.createMoveTool(a),r.addSettingsTool(a,n,o.text_classes));g('<div class="ge-field ge-text-editor" />').append(g('<span class="ge-field-label" />').text(r.t("panel.editor"))).append(g('<span class="ge-field-value" />').text(c(e))).prependTo(i.children(".ge-details-general")),o.text_tools.forEach(function(e){r.createTool(a,e.title||"",e.className||"",e.iconClass||"bi bi-wrench",e.on)}),r.createTool(a,r.t("tool.delete_text"),"ge-delete-text","bi bi-trash",function(){r.deleteNode("text",n,r.t("confirm.delete_text"),function(e){l(n),t.slideUp(function(){t.remove(),e()})})})}g.each(g.fn.gridEditor.texts,function(e,t){f[e]=t(r)}),Array.isArray(o.content_types)||(o.content_types=Object.keys(f)),Array.isArray(o.text_tools)||(o.text_tools=[]),Array.isArray(o.text_classes)||(o.text_classes=[]);var u=a();return{methods:{createText:function(e,t){return e&&"object"==typeof e&&(t=e,e=void 0),t=t||{},(e=e||a()[0])&&f[e]?r.place(i(e,t.content),"text",t):(n["createText:"+e]||(n["createText:"+e]=!0,r.warn('createText: no text editor "'+e+'" is loaded; load its plugin and name it in content_types')),null)}},textTypes:function(){var n=a(),e=Object.keys(f).filter(function(e){return-1===n.indexOf(e)});return n.concat(e).map(function(e){var t=f[e];return{type:e,label:c(e),offered:-1!==n.indexOf(e),available:t.available?function(){return t.available()}:null,missingKey:t.missingKey,edit:function(e){var t=e.parent(".ge-text-block");t.length&&!t.children(".ge-tools-drawer").length&&d(t),s(e)}}})},toolbar:u.map(function(e){return{label:function(){return 1<u.length?r.t("text.add_type",{editor:c(e)}):r.t("text.add")},iconClass:f[e].iconClass,className:"ge-add-text-button",kind:"text",inColumn:!0,create:function(){return i(e)}}}),onInit:function(){r.canvas.find(".ge-text-block").each(function(){var e=g(this);e.children(".ge-tools-drawer").length||t(e.children(".ge-content"))&&d(e)}),r.canvas.off("click.ge-text").on("click.ge-text",".ge-content",e)},onBeforeDeinit:function(){r.canvas.find(".ge-content").each(function(){t(g(this))&&l(g(this))})},onDeinit:function(){r.canvas.off("click.ge-text")},onContentReady:function(e){e.data("ge-text-before")&&!e.data("ge-text-ready")&&e.data("ge-text-ready",v(e[0]))}}}g.fn.gridEditor.features.text||(g.extend(g.fn.gridEditor.locales.en,{"text.add":"Text","text.add_type":"Text ({editor})","panel.editor":"Editor","panel.kind_text":"Text"}),g.fn.gridEditor.texts=g.fn.gridEditor.texts||{},t=/^(mce-|cke|note-)|^(active|ge-rte-active)$/,x=/^(data-mce-|contenteditable$|spellcheck$)/,e.always=!0,g.fn.gridEditor.features.text=e)})(jQuery),(o=>{o.extend(o.fn.gridEditor.locales.en,{"text.ckeditor":"CKEditor"});var t="<p>Lorem initius... </p>";o.fn.gridEditor.texts.ckeditor=function(r){return{labelKey:"text.ckeditor",initialContent:t,missingKey:"error.ckeditor_missing",available:function(){return!!window.CKEDITOR},start:function(e){var i=r.settings;e.each(function(){var e,n,a=o(this);a.hasClass("active")||(a.html()==t&&a.html("&nbsp;"),a.addClass("active").attr("contenteditable","true"),e=o.extend({},i.ckeditor&&i.ckeditor.config?i.ckeditor.config:{},{on:{instanceReady:function(e){var t;try{t=i.ckeditor.config.on.instanceReady}catch(e){}t&&t.call(this,e),r.textReady(a),n.focus()}}}),n=window.CKEDITOR.inline(a.get(0),e),a.data("ge-ckeditor",n))})},stop:function(e){e.filter(".active").each(function(){var n,a,e=o(this),t=window.CKEDITOR?(n=e).data("ge-ckeditor")||(a=null,o.each(window.CKEDITOR.instances,function(e,t){t.element&&t.element.$===n[0]&&(a=t)}),a):null;t&&t.destroy(),e.removeData("ge-ckeditor"),e.removeClass("active cke_focus").removeAttr("id").removeAttr("style").removeAttr("spellcheck").removeAttr("contenteditable")})}}}})(jQuery);
2
2
  //# sourceMappingURL=grideditor.ckeditor.min.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"grideditor.ckeditor.min.js","sources":["../../src/js/text/grideditor.text.js","../../src/js/plugins/grideditor.ckeditor.js"],"names":["$","EDITOR_CLASS","EDITOR_ATTRIBUTE","attributesOf","element","found","each","makeArray","attributes","i","attribute","name","value","classesIn","split","filter","test","textFeature","ge","settings","TEXTS","warned","offeredTexts","content_types","type","textLabel","text","labelKey","t","makeText","content","addClass","attr","html","undefined","initialContent","addTextTo","col","place","appendTo","source","isOurs","block","startText","hasClass","is","available","missingKey","console","error","data","removeData","start","onClick","this","closeText","ready","open","result","readyClasses","openClasses","classes","before","stop","removeClass","extend","indexOf","forEach","push","length","join","removeAttr","createTextControls","textBlock","children","drawer","prependTo","details","createMoveTool","addSettingsTool","text_classes","append","text_tools","hostTool","createTool","title","className","iconClass","on","deleteNode","removed","slideUp","remove","fn","gridEditor","texts","factory","Array","isArray","Object","keys","methods","createText","options","warn","textTypes","offered","others","concat","map","label","edit","parent","toolbar","editor","kind","inColumn","create","onInit","canvas","find","tool","closePicker","addRow","insertBefore","attachPicker","openPicker","data-ge-content-type","choose","off","onBeforeDeinit","onDeinit","onContentReady","area","features","locales","en","tool.add_text","tool.add_text_type","text.add","text.add_type","panel.editor","panel.kind_text","always","jQuery","text.ckeditor","INITIAL_CONTENT","ckeditor","window","CKEDITOR","contentAreas","configuration","instance","contentArea","config","instanceReady","evt","callback","err","call","textReady","focus","inline","get","instances","destroy"],"mappings":"CAmBUA,IAEN,IAeIC,EACAC,EAEJ,SAASC,EAAaC,GAClB,IAAIC,EAAQ,GAIZ,OAHAL,EAAEM,KAAKN,EAAEO,UAAUH,EAAQI,UAAU,EAAG,SAASC,EAAGC,GAChDL,EAAMK,EAAUC,MAAQD,EAAUE,KACtC,CAAC,EACMP,CACX,CAEA,SAASQ,EAAUD,GACf,OAAQA,GAAS,IAAIE,MAAM,KAAK,EAAEC,OAAO,SAASJ,GAC9C,MAAgB,KAATA,GAAe,CAACV,EAAae,KAAKL,CAAI,CACjD,CAAC,CACL,CAiCA,SAASM,EAAYC,GAEjB,IAAIC,EAAWD,EAAGC,SACdC,EAAQ,GACRC,EAAS,GAab,SAASC,IACL,OAAOH,EAASI,cAAcR,OAAO,SAASS,GAAQ,MAAO,CAAC,CAACJ,EAAMI,EAAO,CAAC,CACjF,CAGA,SAASC,EAAUD,GACf,IAAIE,EAAON,EAAMI,GACjB,OAAOE,GAAQA,EAAKC,SAAWT,EAAGU,EAAEF,EAAK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AS,QAAQ,EAAEC,KAAK,kBAAmB,MAAM,EAEzDuH,EAAgBvJ,EAAEiE,OAClB,GACC9C,EAASgI,UAAYhI,EAASgI,SAASO,OAASvI,EAASgI,SAASO,OAAS,GAC5E,CAEIlE,GAAI,CACAmE,cAAe,SAAUC,GAErB,IAAIC,EACJ,IACIA,EAAW1I,EAASgI,SAASO,OAAOlE,GAAGmE,aAG3C,CAFE,MAAOG,IAGLD,GACAA,EAASE,KAAKzG,KAAMsG,CAAG,EAM3B1I,EAAG8I,UAAUP,CAAW,EAExBD,EAASS,MAAM,CACnB,CACJ,CACJ,CACJ,EACIT,EAAWJ,OAAOC,SAASa,OAAOT,EAAYU,IAAI,CAAC,EAAGZ,CAAa,EACvEE,EAAYvG,KAAK,cAAesG,CAAQ,EAC5C,CAAC,CACL,EAEAzF,KAAM,SAASuF,GACXA,EAAavI,OAAO,SAAS,EAAET,KAAK,WAChC,IArEQmJ,EAIZpJ,EAiEQoJ,EAAczJ,EAAEsD,IAAI,EAKpBkG,EAAWJ,OAAOC,UA1EdI,EA0EoCA,GAzE7BvG,KAAK,aAAa,IAGrC7C,EAAQ,KACZL,EAAEM,KAAK8I,OAAOC,SAASe,UAAW,SAASzJ,EAAM6I,GACzCA,EAASpJ,SAAWoJ,EAASpJ,QAAQJ,IAAMyJ,EAAY,KAAMpJ,EAAQmJ,EAC7E,CAAC,EAEMnJ,GAiE4D,KACvDmJ,GAAYA,EAASa,QAAQ,EACjCZ,EAAYtG,WAAW,aAAa,EAGpCsG,EACKzF,YAAY,kBAAkB,EAC9BO,WAAW,IAAI,EACfA,WAAW,OAAO,EAClBA,WAAW,YAAY,EACvBA,WAAW,iBAAiB,CAErC,CAAC,CACL,CACJ,CACJ,CACH,GAAEyE,MAAM"}
1
+ {"version":3,"file":"grideditor.ckeditor.min.js","sources":["../../src/js/text/grideditor.text.js","../../src/js/plugins/grideditor.ckeditor.js"],"names":["$","EDITOR_CLASS","EDITOR_ATTRIBUTE","attributesOf","element","found","each","makeArray","attributes","i","attribute","name","value","classesIn","split","filter","test","textFeature","ge","settings","TEXTS","warned","offeredTexts","content_types","type","textLabel","text","labelKey","t","makeText","content","addClass","attr","html","undefined","initialContent","isOurs","block","startText","hasClass","is","available","missingKey","console","error","data","removeData","start","onClick","this","closeText","ready","open","result","readyClasses","openClasses","classes","before","stop","removeClass","extend","indexOf","forEach","push","length","join","removeAttr","createTextControls","textBlock","children","drawer","prependTo","details","createMoveTool","addSettingsTool","text_classes","append","text_tools","hostTool","createTool","title","className","iconClass","on","deleteNode","removed","slideUp","remove","fn","gridEditor","texts","factory","Array","isArray","Object","keys","methods","createText","options","place","warn","textTypes","offered","others","concat","map","label","edit","parent","toolbar","editor","kind","inColumn","create","onInit","canvas","find","off","onBeforeDeinit","onDeinit","onContentReady","area","features","locales","en","text.add","text.add_type","panel.editor","panel.kind_text","always","jQuery","text.ckeditor","INITIAL_CONTENT","ckeditor","window","CKEDITOR","contentAreas","configuration","instance","contentArea","config","instanceReady","evt","callback","err","call","textReady","focus","inline","get","instances","destroy"],"mappings":"CAmBUA,IAEN,IAaIC,EACAC,EAEJ,SAASC,EAAaC,GAClB,IAAIC,EAAQ,GAIZ,OAHAL,EAAEM,KAAKN,EAAEO,UAAUH,EAAQI,UAAU,EAAG,SAASC,EAAGC,GAChDL,EAAMK,EAAUC,MAAQD,EAAUE,KACtC,CAAC,EACMP,CACX,CAEA,SAASQ,EAAUD,GACf,OAAQA,GAAS,IAAIE,MAAM,KAAK,EAAEC,OAAO,SAASJ,GAC9C,MAAgB,KAATA,GAAe,CAACV,EAAae,KAAKL,CAAI,CACjD,CAAC,CACL,CAiCA,SAASM,EAAYC,GAEjB,IAAIC,EAAWD,EAAGC,SACdC,EAAQ,GACRC,EAAS,GAab,SAASC,IACL,OAAOH,EAASI,cAAcR,OAAO,SAASS,GAAQ,MAAO,CAAC,CAACJ,EAAMI,EAAO,CAAC,CACjF,CAGA,SAASC,EAAUD,GACf,IAAIE,EAAON,EAAMI,GACjB,O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AAY,EACvBA,WAAW,iBAAiB,CAErC,CAAC,CACL,CACJ,CACJ,CACH,GAAEgE,MAAM"}
@@ -0,0 +1,190 @@
1
+ /**
2
+ * A block's html, edited in place with CodeMirror.
3
+ *
4
+ * A feature plugin: load this file after the editor, and CodeMirror 5 with
5
+ * its html mode after or before it, and every drawer of a row, a column, a
6
+ * text, the host's plain content, an element, a section or a container has a
7
+ * </> tool. It opens the block's html - the block itself and everything in
8
+ * it, as getHtml would give it - in CodeMirror where the block was, and
9
+ * Apply puts what was written in the block's place. What it can ask the
10
+ * editor for is the handle its factory is called with, described in
11
+ * docs/plugins.md.
12
+ *
13
+ * <link rel="stylesheet" href="codemirror/lib/codemirror.css">
14
+ * <script src="codemirror/lib/codemirror.js"></script>
15
+ * <script src="codemirror/mode/xml/xml.js"></script>
16
+ * <script src="codemirror/mode/javascript/javascript.js"></script>
17
+ * <script src="codemirror/mode/css/css.js"></script>
18
+ * <script src="codemirror/mode/htmlmixed/htmlmixed.js"></script>
19
+ * <script src="dist/jquery.grideditor.min.js"></script>
20
+ * <script src="dist/plugins/grideditor.codemirror-inline.min.js"></script>
21
+ *
22
+ * Without CodeMirror on the page the html is edited in a plain textarea.
23
+ * CodeMirror's options are the codemirror plugin's, codemirror.config.
24
+ */
25
+ (function($) {
26
+
27
+ $.extend($.fn.gridEditor.locales.en, {
28
+ 'tool.edit_html': 'Edit html',
29
+ 'codemirror.apply': 'Apply',
30
+ 'codemirror.cancel': 'Cancel',
31
+ });
32
+
33
+ /** What has html of its own to edit: a pane's is split between its button and its body. */
34
+ var KINDS = ['row', 'column', 'text', 'plain', 'element', 'section'];
35
+
36
+ $.fn.gridEditor.features['codemirror-inline'] = function(ge) {
37
+
38
+ var open = []; // The blocks being edited: { node, kind, from, wrapper, textarea, editor }
39
+
40
+ function options() {
41
+ var own = (ge.settings.codemirror && ge.settings.codemirror.config) || {};
42
+
43
+ return $.extend({
44
+ mode: 'htmlmixed',
45
+ lineNumbers: true,
46
+ lineWrapping: true,
47
+ tabSize: 2,
48
+ indentUnit: 2,
49
+ // As tall as what it holds, up to the css's limit
50
+ viewportMargin: Infinity,
51
+ }, own);
52
+ }
53
+
54
+ /** What stands for the node in its column: a text's text block, or the node. */
55
+ function anchorOf(node) {
56
+ var textBlock = node.parent('.ge-text-block');
57
+ return textBlock.length ? textBlock : node;
58
+ }
59
+
60
+ function entryOf(node) {
61
+ return open.filter(function(entry) { return entry.node[0] === node[0]; })[0] || null;
62
+ }
63
+
64
+ function editable(node, kind) {
65
+ return KINDS.indexOf(kind) !== -1 || node.is('[data-ge-container]');
66
+ }
67
+
68
+ /** The editor where the block was, the block hidden behind it. */
69
+ function show(entry) {
70
+ var anchor = anchorOf(entry.node).addClass('ge-code-hidden');
71
+ entry.wrapper.insertAfter(anchor);
72
+ if (entry.editor) { entry.editor.refresh(); }
73
+ }
74
+
75
+ function hide(entry) {
76
+ entry.wrapper.detach();
77
+ anchorOf(entry.node).removeClass('ge-code-hidden');
78
+ entry.node.removeClass('ge-code-hidden');
79
+ }
80
+
81
+ function close(entry) {
82
+ hide(entry);
83
+ if (entry.editor) { entry.editor.toTextArea(); }
84
+ entry.wrapper.remove();
85
+ open.splice(open.indexOf(entry), 1);
86
+ }
87
+
88
+ function openEditor(node) {
89
+ if (entryOf(node)) { return; }
90
+
91
+ var entry = {
92
+ node: node,
93
+ kind: ge.kindOf(node),
94
+ // As getHtml gives it: no drawers, no editor open in it
95
+ from: ge.nodeHtml(node),
96
+ // A drawer, to the editor: never content, never a block to move
97
+ wrapper: $('<div class="ge-tools-drawer ge-code-inline" />'),
98
+ editor: null,
99
+ };
100
+ entry.textarea = $('<textarea class="ge-code-inline-source" />').val(entry.from).appendTo(entry.wrapper);
101
+
102
+ var bar = $('<div class="ge-code-inline-bar" />').appendTo(entry.wrapper);
103
+ $('<button type="button" class="btn btn-sm btn-primary ge-code-apply" />')
104
+ .text(ge.t('codemirror.apply'))
105
+ .on('click', function() { apply(entry); })
106
+ .appendTo(bar);
107
+ $('<button type="button" class="btn btn-sm btn-outline-secondary ge-code-cancel" />')
108
+ .text(ge.t('codemirror.cancel'))
109
+ .on('click', function() { close(entry); })
110
+ .appendTo(bar);
111
+
112
+ open.push(entry);
113
+ show(entry);
114
+
115
+ if (window.CodeMirror) {
116
+ entry.editor = window.CodeMirror.fromTextArea(entry.textarea[0], options());
117
+ $(entry.editor.getWrapperElement()).addClass('ge-code-editor');
118
+ entry.editor.focus();
119
+ } else {
120
+ entry.textarea.trigger('focus');
121
+ }
122
+ }
123
+
124
+ /**
125
+ * What was written, in the block's place, through the edit-html events.
126
+ * The canvas leaves editing to take it in and comes back, as it does for
127
+ * getHtml, so what was written is read as the editor reads any markup.
128
+ */
129
+ function apply(entry) {
130
+ var to = entry.editor ? entry.editor.getValue() : entry.textarea.val();
131
+ var payload = ge.payloadFor(entry.kind, entry.node, { source: 'tool', from: entry.from, to: to });
132
+
133
+ // Canceled, the editor stays open with what was written in it
134
+ if (!ge.emit('before-edit-html', payload)) { return; }
135
+
136
+ close(entry);
137
+
138
+ var instance = ge.canvas.data('grideditor');
139
+ instance.deinit();
140
+
141
+ var made = $('<div />').html(to).contents();
142
+ entry.node.replaceWith(made);
143
+
144
+ instance.init();
145
+
146
+ ge.emit('after-edit-html', ge.payloadFor(entry.kind, made.filter('*'), {
147
+ source: 'tool',
148
+ from: entry.from,
149
+ to: to,
150
+ }));
151
+ }
152
+
153
+ function tool(drawer, node) {
154
+ ge.createTool(drawer, ge.t('tool.edit_html'), 'ge-edit-html', 'bi bi-code-slash', function() {
155
+ openEditor(node);
156
+ });
157
+ }
158
+
159
+ return {
160
+ drawerTools: function(drawer, node, kind) {
161
+ if (editable(node, kind)) { tool(drawer, node); }
162
+ },
163
+
164
+ // Plain content has no gear, and so none of the drawerTools: its
165
+ // html is what there is to edit about it
166
+ plainTools: tool,
167
+
168
+ // Every deinit - getHtml's among them - takes the editors off the
169
+ // canvas, whatever is in them, and every init puts them back where
170
+ // their block is. A block that is gone takes its editor with it.
171
+ onBeforeDeinit: function() {
172
+ open.forEach(hide);
173
+ },
174
+
175
+ onInit: function() {
176
+ open.slice().forEach(function(entry) {
177
+ if (!$.contains(document.documentElement, entry.node[0])) {
178
+ if (entry.editor) { entry.editor.toTextArea(); }
179
+ entry.wrapper.remove();
180
+ open.splice(open.indexOf(entry), 1);
181
+ return;
182
+ }
183
+
184
+ show(entry);
185
+ });
186
+ },
187
+ };
188
+ };
189
+
190
+ })(jQuery);
@@ -0,0 +1,2 @@
1
+ (l=>{l.extend(l.fn.gridEditor.locales.en,{"tool.edit_html":"Edit html","codemirror.apply":"Apply","codemirror.cancel":"Cancel"});var s=["row","column","text","plain","element","section"];l.fn.gridEditor.features["codemirror-inline"]=function(i){var t=[];function r(e){var o=e.parent(".ge-text-block");return o.length?o:e}function d(e){var o=r(e.node).addClass("ge-code-hidden");e.wrapper.insertAfter(o),e.editor&&e.editor.refresh()}function o(e){e.wrapper.detach(),r(e.node).removeClass("ge-code-hidden"),e.node.removeClass("ge-code-hidden")}function a(e){o(e),e.editor&&e.editor.toTextArea(),e.wrapper.remove(),t.splice(t.indexOf(e),1)}function n(e){var o,n;o=e,t.filter(function(e){return e.node[0]===o[0]})[0]||((n={node:e,kind:i.kindOf(e),from:i.nodeHtml(e),wrapper:l('<div class="ge-tools-drawer ge-code-inline" />'),editor:null}).textarea=l('<textarea class="ge-code-inline-source" />').val(n.from).appendTo(n.wrapper),e=l('<div class="ge-code-inline-bar" />').appendTo(n.wrapper),l('<button type="button" class="btn btn-sm btn-primary ge-code-apply" />').text(i.t("codemirror.apply")).on("click",function(){var e,o,t,r;t=(e=n).editor?e.editor.getValue():e.textarea.val(),r=i.payloadFor(e.kind,e.node,{source:"tool",from:e.from,to:t}),i.emit("before-edit-html",r)&&(a(e),(r=i.canvas.data("grideditor")).deinit(),o=l("<div />").html(t).contents(),e.node.replaceWith(o),r.init(),i.emit("after-edit-html",i.payloadFor(e.kind,o.filter("*"),{source:"tool",from:e.from,to:t})))}).appendTo(e),l('<button type="button" class="btn btn-sm btn-outline-secondary ge-code-cancel" />').text(i.t("codemirror.cancel")).on("click",function(){a(n)}).appendTo(e),t.push(n),d(n),window.CodeMirror?(n.editor=window.CodeMirror.fromTextArea(n.textarea[0],(e=i.settings.codemirror&&i.settings.codemirror.config||{},l.extend({mode:"htmlmixed",lineNumbers:!0,lineWrapping:!0,tabSize:2,indentUnit:2,viewportMargin:1/0},e))),l(n.editor.getWrapperElement()).addClass("ge-code-editor"),n.editor.focus()):n.textarea.trigger("focus"))}function c(e,o){i.createTool(e,i.t("tool.edit_html"),"ge-edit-html","bi bi-code-slash",function(){n(o)})}return{drawerTools:function(e,o,t){var r;r=o,-1===s.indexOf(t)&&!r.is("[data-ge-container]")||c(e,o)},plainTools:c,onBeforeDeinit:function(){t.forEach(o)},onInit:function(){t.slice().forEach(function(e){l.contains(document.documentElement,e.node[0])?d(e):(e.editor&&e.editor.toTextArea(),e.wrapper.remove(),t.splice(t.indexOf(e),1))})}}}})(jQuery);
2
+ //# sourceMappingURL=grideditor.codemirror-inline.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grideditor.codemirror-inline.min.js","sources":["../../src/js/plugins/grideditor.codemirror-inline.js"],"names":["$","extend","fn","gridEditor","locales","en","tool.edit_html","codemirror.apply","codemirror.cancel","KINDS","features","ge","open","anchorOf","node","textBlock","parent","length","show","entry","anchor","addClass","wrapper","insertAfter","editor","refresh","hide","detach","removeClass","close","toTextArea","remove","splice","indexOf","openEditor","filter","kind","kindOf","from","nodeHtml","textarea","val","appendTo","bar","text","t","on","made","to","payload","getValue","payloadFor","source","emit","instance","canvas","data","deinit","html","contents","replaceWith","init","push","window","CodeMirror","fromTextArea","own","settings","codemirror","config","mode","lineNumbers","lineWrapping","tabSize","indentUnit","viewportMargin","Infinity","getWrapperElement","focus","trigger","tool","drawer","createTool","drawerTools","is","plainTools","onBeforeDeinit","forEach","onInit","slice","contains","document","documentElement","jQuery"],"mappings":"CAwBUA,IAEVA,EAAEC,O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TC,WAAY,EAEZC,eAAgBC,EAAAA,CACpB,EAAGV,CAAG,EAiEwE,EAC1ElE,EAAEmB,EAAMK,OAAOqD,kBAAkB,CAAC,EAAExD,SAAS,gBAAgB,EAC7DF,EAAMK,OAAOsD,MAAM,GAEnB3D,EAAMqB,SAASuC,QAAQ,OAAO,EAEtC,CA+BA,SAASC,EAAKC,EAAQnE,GAClBH,EAAGuE,WAAWD,EAAQtE,EAAGkC,EAAE,gBAAgB,EAAG,eAAgB,mBAAoB,WAC9EX,EAAWpB,CAAI,CACnB,CAAC,CACL,CAEA,MAAO,CACHqE,YAAa,SAASF,EAAQnE,EAAMsB,GAhGxC,IAAkBtB,EAAAA,EAiGGA,EAhGc,CAAC,IAAzBL,EAAMwB,QAgGUG,CAhGE,GAAYtB,CAAAA,EAAKsE,GAAG,qBAAqB,GAgGlCJ,EAAKC,EAAQnE,CAAI,CACjD,EAIAuE,WAAYL,EAKZM,eAAgB,WACZ1E,EAAK2E,QAAQ7D,CAAI,CACrB,EAEA8D,OAAQ,WACJ5E,EAAK6E,MAAM,EAAEF,QAAQ,SAASpE,GACrBnB,EAAE0F,SAASC,SAASC,gBAAiBzE,EAAML,KAAK,EAAE,EAOvDI,EAAKC,CAAK,GANFA,EAAMK,QAAUL,EAAMK,OAAOM,WAAW,EAC5CX,EAAMG,QAAQS,OAAO,EACrBnB,EAAKoB,OAAOpB,EAAKqB,QAAQd,CAAK,EAAG,CAAC,EAK1C,CAAC,CACL,CACJ,CACJ,CAEC,GAAE0E,MAAM"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * CodeMirror for grid-editor's source view.
3
+ *
4
+ * A feature plugin: load this file after the editor, and CodeMirror 5 with
5
+ * its html mode after or before it, and the toolbar's source button edits the
6
+ * canvas's html in CodeMirror - highlighted, with line numbers - rather than
7
+ * in a plain textarea. What it can ask the editor for is the handle its
8
+ * factory is called with, described in docs/plugins.md.
9
+ *
10
+ * <link rel="stylesheet" href="codemirror/lib/codemirror.css">
11
+ * <script src="codemirror/lib/codemirror.js"></script>
12
+ * <script src="codemirror/mode/xml/xml.js"></script>
13
+ * <script src="codemirror/mode/javascript/javascript.js"></script>
14
+ * <script src="codemirror/mode/css/css.js"></script>
15
+ * <script src="codemirror/mode/htmlmixed/htmlmixed.js"></script>
16
+ * <script src="dist/jquery.grideditor.min.js"></script>
17
+ * <script src="dist/plugins/grideditor.codemirror.min.js"></script>
18
+ *
19
+ * CodeMirror 5 rather than 6: 6 comes as ES modules only, for a bundler,
20
+ * where 5 loads from a script tag like the rest of the page. Without
21
+ * CodeMirror on the page the source view is the textarea, as before, and
22
+ * the console says why.
23
+ */
24
+ (function($) {
25
+
26
+ $.extend($.fn.gridEditor.locales.en, {
27
+ 'error.codemirror_missing': 'CodeMirror not available! Make sure you loaded the CodeMirror js file; the source is edited in a plain textarea without it.',
28
+ });
29
+
30
+ $.fn.gridEditor.features.codemirror = function(ge) {
31
+
32
+ var editor = null;
33
+ var warned = false;
34
+
35
+ function options() {
36
+ var own = (ge.settings.codemirror && ge.settings.codemirror.config) || {};
37
+
38
+ return $.extend({
39
+ mode: 'htmlmixed',
40
+ lineNumbers: true,
41
+ lineWrapping: true,
42
+ tabSize: 2,
43
+ indentUnit: 2,
44
+ }, own);
45
+ }
46
+
47
+ return {
48
+ // Over the textarea the editor fills with the canvas's html: it goes
49
+ // where the textarea was, as tall as the editor made the textarea
50
+ onSourceOpen: function(textarea) {
51
+ if (!window.CodeMirror) {
52
+ if (!warned) {
53
+ warned = true;
54
+ ge.warn(ge.t('error.codemirror_missing'));
55
+ }
56
+ return;
57
+ }
58
+
59
+ var height = textarea.height();
60
+
61
+ editor = window.CodeMirror.fromTextArea(textarea[0], options());
62
+ $(editor.getWrapperElement()).addClass('ge-code-editor');
63
+ editor.setSize(null, height);
64
+ editor.focus();
65
+ },
66
+
67
+ // What it holds goes back in the textarea, which is what the canvas
68
+ // is made of again, and the textarea is left as it found it
69
+ onSourceClose: function() {
70
+ if (!editor) { return; }
71
+
72
+ editor.save();
73
+ editor.toTextArea();
74
+ editor = null;
75
+ },
76
+ };
77
+ };
78
+
79
+ })(jQuery);
@@ -0,0 +1,2 @@
1
+ (t=>{t.extend(t.fn.gridEditor.locales.en,{"error.codemirror_missing":"CodeMirror not available! Make sure you loaded the CodeMirror js file; the source is edited in a plain textarea without it."}),t.fn.gridEditor.features.codemirror=function(o){var i=null,n=!1;return{onSourceOpen:function(e){var r;window.CodeMirror?(r=e.height(),i=window.CodeMirror.fromTextArea(e[0],(e=o.settings.codemirror&&o.settings.codemirror.config||{},t.extend({mode:"htmlmixed",lineNumbers:!0,lineWrapping:!0,tabSize:2,indentUnit:2},e))),t(i.getWrapperElement()).addClass("ge-code-editor"),i.setSize(null,r),i.focus()):n||(n=!0,o.warn(o.t("error.codemirror_missing")))},onSourceClose:function(){i&&(i.save(),i.toTextArea(),i=null)}}}})(jQuery);
2
+ //# sourceMappingURL=grideditor.codemirror.min.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"grideditor.codemirror.min.js","sources":["../../src/js/plugins/grideditor.codemirror.js"],"names":["$","extend","fn","gridEditor","locales","en","error.codemirror_missing","features","codemirror","ge","editor","warned","onSourceOpen","textarea","height","window","CodeMirror","fromTextArea","own","settings","config","mode","lineNumbers","lineWrapping","tabSize","indentUnit","getWrapperElement","addClass","setSize","focus","warn","t","onSourceClose","save","toTextArea","jQuery"],"mappings":"CAuBUA,IAEVA,EAAEC,OAAOD,EAAEE,GAAGC,WAAWC,QAAQC,GAAI,CACjCC,2BAA4B,6HAChC,CAAC,EAEDN,EAAEE,GAAGC,WAAWI,SAASC,WAAa,SAASC,GAE3C,IAAIC,EAAS,KACTC,EAAS,CAAA,EAcb,MAAO,CAGHC,aAAc,SAASC,GACnB,IAQIC,EARCC,OAAOC,YAQRF,EAASD,EAASC,OAAO,EAE7BJ,EAASK,OAAOC,WAAWC,aAAaJ,EAAS,IAzBjDK,EAAOT,EAAGU,SAASX,YAAcC,EAAGU,SAASX,WAAWY,QAAW,GAEhEpB,EAAEC,OAAO,CACZoB,KAAM,YACNC,YAAa,CAAA,EACbC,aAAc,CAAA,EACdC,QAAS,EACTC,WAAY,CAChB,EAAGP,CAAG,EAiB4D,EAC9DlB,EAAEU,EAAOgB,kBAAkB,CAAC,EAAEC,SAAS,gBAAgB,EACvDjB,EAAOkB,QAAQ,KAAMd,CAAM,EAC3BJ,EAAOmB,MAAM,GAZJlB,IACDA,EAAS,CAAA,EACTF,EAAGqB,KAAKrB,EAAGsB,EAAE,0BAA0B,CAAC,EAWpD,EAIAC,cAAe,WACNtB,IAELA,EAAOuB,KAAK,EACZvB,EAAOwB,WAAW,EAClBxB,EAAS,KACb,CACJ,CACJ,CAEC,GAAEyB,MAAM"}
@@ -8,10 +8,10 @@
8
8
  *
9
9
  * It is a feature plugin, `text`, that the `plugins` setting does not choose
10
10
  * (content_types does), and it is everything a text is to the editor: the
11
- * text block's drawer, the Text buttons in the toolbar and the Add text tool
12
- * in each column, createText, opening an editor on a click and closing it
13
- * again with the host's attributes put back, and making the host's plain
14
- * content a text through the core's `textTypes` hook.
11
+ * text block's drawer, the Text buttons in the toolbar, createText, opening
12
+ * an editor on a click and closing it again with the host's attributes put
13
+ * back, and making the host's plain content a text through the core's
14
+ * `textTypes` hook.
15
15
  *
16
16
  * Each editor registers under $.fn.gridEditor.texts, which is this file's own
17
17
  * registry and not a contract: an editor of a host's own is a feature plugin
@@ -22,8 +22,6 @@
22
22
  if ($.fn.gridEditor.features.text) { return; }
23
23
 
24
24
  $.extend($.fn.gridEditor.locales.en, {
25
- 'tool.add_text': 'Add text',
26
- 'tool.add_text_type': 'Add {editor} text',
27
25
  'text.add': 'Text',
28
26
  'text.add_type': 'Text ({editor})',
29
27
  'panel.editor': 'Editor',
@@ -119,11 +117,6 @@
119
117
  .html(content !== undefined ? content : (text && text.initialContent) || '');
120
118
  }
121
119
 
122
- /** A text block at the end of a column, through the add events. */
123
- function addTextTo(col, type) {
124
- return ge.place(makeText(type), 'text', { appendTo: col, source: 'tool' });
125
- }
126
-
127
120
  /**
128
121
  * createText(type?, options?): a content area of a text editor's,
129
122
  * detached unless a placement is given. The type is the first one
@@ -262,44 +255,6 @@
262
255
  });
263
256
  }
264
257
 
265
- /**
266
- * The add text tool, in each column's drawer before its add row tool:
267
- * a text of the first editor offered, or, held, of the one chosen.
268
- */
269
- function addTextTools() {
270
- var texts = offeredTexts();
271
- if (!texts.length) { return; }
272
-
273
- ge.canvas.find('.column').each(function() {
274
- var col = $(this);
275
- var drawer = col.children('.ge-tools-drawer');
276
- if (!drawer.length || drawer.children('.ge-add-text').length) { return; }
277
-
278
- ge.createTool(drawer, ge.t('tool.add_text'), 'ge-add-text', 'bi bi-type', function() {
279
- if (ge.closePicker()) { return; } // The picker was open: that was the answer
280
-
281
- addTextTo(col, texts[0]);
282
- });
283
-
284
- var tool = drawer.children('.ge-add-text');
285
- var addRow = drawer.children('.ge-add-row');
286
- if (addRow.length) { tool.insertBefore(addRow); }
287
-
288
- if (texts.length > 1) {
289
- ge.attachPicker(tool, function() {
290
- ge.openPicker(tool, texts.map(function(type) {
291
- return {
292
- label: textLabel(type),
293
- title: ge.t('tool.add_text_type', { editor: textLabel(type) }),
294
- attributes: { 'data-ge-content-type': type },
295
- choose: function() { addTextTo(col, type); },
296
- };
297
- }), 'ge-text-picker');
298
- });
299
- }
300
- });
301
- }
302
-
303
258
  var texts = offeredTexts();
304
259
 
305
260
  return {
@@ -354,7 +309,6 @@
354
309
 
355
310
  onInit: function() {
356
311
  markTexts();
357
- addTextTools();
358
312
 
359
313
  ge.canvas.off('click.ge-text').on('click.ge-text', '.ge-content', onClick);
360
314
  },
@@ -402,8 +356,8 @@
402
356
  *
403
357
  * Up to 5.x the main bundle carried a copy of this file; since 6.0 it is
404
358
  * loaded on its own, like every plugin. The built file starts with what
405
- * every text editor shares - text blocks, the Text button and the Add text
406
- * tool, createText, making the host's plain content a text - from
359
+ * every text editor shares - text blocks, the Text button, createText,
360
+ * making the host's plain content a text - from
407
361
  * src/js/text/grideditor.text.js, installed once however many editors a
408
362
  * page loads.
409
363
  */