@themarioga/grid-editor 8.2.0 → 8.4.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.
- package/CHANGELOG.md +31 -0
- package/README.md +25 -1
- package/dist/grideditor.bundle.min.js +3 -3
- package/dist/grideditor.css +116 -0
- package/dist/grideditor.d.ts +6 -0
- package/dist/grideditor.esm.js +301 -5
- package/dist/grideditor.js +301 -5
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +2 -2
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +4 -0
- package/dist/locales/grideditor.es.js +4 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.ckeditor.esm.js +1 -0
- package/dist/plugins/grideditor.ckeditor.js +1 -0
- package/dist/plugins/grideditor.ckeditor.min.js +1 -1
- package/dist/plugins/grideditor.ckeditor.min.js.map +2 -2
- package/dist/plugins/grideditor.sections.esm.js +1 -0
- package/dist/plugins/grideditor.sections.js +1 -0
- package/dist/plugins/grideditor.sections.min.js +1 -1
- package/dist/plugins/grideditor.sections.min.js.map +2 -2
- package/dist/plugins/grideditor.summernote.esm.js +1 -0
- package/dist/plugins/grideditor.summernote.js +1 -0
- package/dist/plugins/grideditor.summernote.min.js +1 -1
- package/dist/plugins/grideditor.summernote.min.js.map +2 -2
- package/dist/plugins/grideditor.tinymce.esm.js +1 -0
- package/dist/plugins/grideditor.tinymce.js +1 -0
- package/dist/plugins/grideditor.tinymce.min.js +1 -1
- package/dist/plugins/grideditor.tinymce.min.js.map +2 -2
- package/docs/locale-keys.md +4 -0
- package/docs/plugins.md +22 -0
- package/package.json +1 -1
- package/src/js/grideditor.js +359 -4
- package/src/js/locales/grideditor.es.js +4 -0
- package/src/js/plugins/grideditor.sections.js +1 -0
- package/src/js/text/grideditor.text.js +1 -0
- package/src/less/grideditor.less +134 -0
- package/types/grideditor.d.ts +6 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/plugins/grideditor.sections.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are jQuery's: 400 ms unless the caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Sections for grid-editor.\n *\n * A feature plugin: load this file after the editor and the canvas can hold\n * sections - Bootstrap's .container, .container-fluid and .container-{bp} -\n * each grouping rows at a width of its own. What it can ask the editor for is\n * the handle its factory is called with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.sections.min.js\"></script>\n *\n * Called sections, not containers, because a container is what the tabs,\n * accordion, popup and card plugins make. A section is recognised by its\n * Bootstrap class alone, and only as a child of the canvas: a .container\n * somewhere inside an element's markup is that element's business.\n *\n * sections.widths narrows the widths the field offers.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'section.add': 'Section',\n 'section.width': 'Width',\n 'section.fixed': 'Fixed',\n 'section.fluid': 'Full width',\n 'section.from': 'Fixed from {breakpoint}',\n 'tool.add_row_to_section': 'Add row',\n 'tool.delete_section': 'Remove section',\n 'confirm.delete_section': 'Delete this section and everything in it?',\n});\n\n/** Each width, and the class that gives it. */\nvar WIDTHS = {\n fixed: 'container',\n fluid: 'container-fluid',\n sm: 'container-sm',\n md: 'container-md',\n lg: 'container-lg',\n xl: 'container-xl',\n xxl: 'container-xxl',\n};\n\nvar ORDER = ['fixed', 'sm', 'md', 'lg', 'xl', 'xxl', 'fluid'];\n\nGridEditor.features.sections = function(ge) {\n\n var options = Object.assign({ widths: ORDER }, ge.settings.sections);\n\n function widthOf(section) {\n var found = null;\n\n Object.keys(WIDTHS).forEach(function(width) {\n if (!found && dom.hasClass(section, WIDTHS[width])) { found = width; }\n });\n\n return found;\n }\n\n function isSection(node) {\n return node.parentElement === ge.canvas && widthOf(node) !== null;\n }\n\n function sections() {\n return dom.children(ge.canvas).filter(isSection);\n }\n\n function label(width) {\n if (width === 'fixed') { return ge.t('section.fixed'); }\n if (width === 'fluid') { return ge.t('section.fluid'); }\n\n return ge.t('section.from', { breakpoint: width });\n }\n\n /**\n * Change a section's width, announced like a utility: the width is its\n * one container class, the same at every breakpoint.\n */\n function setWidth(section, width, source) {\n var from = widthOf(section);\n if (from === width || !WIDTHS[width]) { return false; }\n\n return ge.operate(function() {\n var payload = ge.payloadFor('section', section, {\n family: 'section',\n breakpoint: 'all',\n tiers: [],\n from: from,\n to: width,\n source: source || 'api',\n });\n\n if (!ge.emit('before-utility', payload)) {\n var select = dom.one(ge.detailsOf(section), '.ge-section-width select');\n if (select) { select.value = from; }\n return false;\n }\n\n dom.removeClass(section, WIDTHS[from]);\n dom.addClass(section, WIDTHS[width]);\n ge.emit('after-utility', payload);\n\n return true;\n });\n }\n\n function widthField(section) {\n var select = dom.element('select', { 'class': 'form-select form-select-sm' });\n var current = widthOf(section);\n var offered = options.widths.indexOf(current) === -1 ? options.widths.concat([current]) : options.widths;\n\n ORDER.forEach(function(width) {\n if (offered.indexOf(width) === -1) { return; }\n select.appendChild(dom.element('option', { value: width }, label(width)));\n });\n\n select.value = current;\n select.addEventListener('change', function() { setWidth(section, this.value, 'panel'); });\n\n var field = dom.element('label', { 'class': 'ge-utility ge-section-width' });\n field.appendChild(dom.element('span', { 'class': 'ge-utility-label' }, ge.t('section.width')));\n field.appendChild(select);\n\n return field;\n }\n\n function createControls(section) {\n var drawer = dom.element('div', { 'class': 'ge-tools-drawer ge-section-drawer' });\n section.insertBefore(drawer, section.firstChild);\n\n ge.createMoveTool(drawer);\n ge.addSettingsTool(drawer, section, ge.settings.section_classes || []).appendChild(widthField(section));\n\n ge.createTool(drawer, ge.t('tool.delete_section'), 'ge-delete-section', 'bi bi-trash', function() {\n ge.deleteNode('section', section, ge.t('confirm.delete_section'), function(removed) {\n dom.slideUp(section, removed);\n });\n });\n\n ge.createTool(drawer, ge.t('tool.add_row_to_section'), 'ge-add-row', 'bi bi-plus-circle', function() {\n ge.place(ge.rowFromLayout([12]), 'row', { appendTo: section });\n });\n }\n\n function mark() {\n sections().forEach(function(section) {\n dom.addClass(section, 'ge-section');\n if (!dom.child(section, '.ge-tools-drawer')) { createControls(section); }\n });\n }\n\n function unmark() {\n dom.children(ge.canvas, '.ge-section').forEach(function(section) {\n dom.removeClass(section, 'ge-section');\n });\n }\n\n /** createSection(options): a section, detached unless a placement is given. */\n function createSection(settings) {\n settings = settings || {};\n\n var section = dom.element('div', { 'class': WIDTHS[settings.width] || WIDTHS.fixed });\n\n (settings.rows || [[12]]).forEach(function(layout) {\n section.appendChild(ge.rowFromLayout(layout));\n });\n\n return ge.place(section, 'section', settings);\n }\n\n return {\n methods: {\n createSection: createSection,\n },\n\n kindOf: function(node) {\n return dom.hasClass(node, 'ge-section') ? 'section' : null;\n },\n\n // A section is a block the canvas moves, and a region rows move in\n blocks: '.ge-section',\n regions: '.ge-section',\n\n /** A section goes on the canvas and nowhere else, and holds rows and nothing else. */\n accepts: function(region, node) {\n if (dom.hasClass(node, 'ge-section') || isSectionMade(node)) { return region === ge.canvas; }\n if (dom.hasClass(region, 'ge-section')) { return dom.hasClass(node, 'row'); }\n\n return true;\n },\n\n toolbar: [{\n labelKey: 'section.add',\n kind: 'section',\n create: function() { return createSection(); },\n }],\n\n onInit: mark,\n onDeinit: unmark,\n };\n\n /** A section the toolbar just made, before init has marked it. */\n function isSectionMade(node) {\n return !node.parentElement && widthOf(node) !== null;\n }\n};\n"],
|
|
5
|
-
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM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EACX,EAEA,QAAS,CAAC,CACN,SAAU,cACV,KAAM,UACN,OAAQ,UAAW,CAAE,OAAOwB,EAAc,CAAG,CACjD,CAAC,EAED,OAAQH,EACR,SAAUE,CACd,EAGA,SAASK,EAAc5B,EAAM,CACzB,MAAO,CAACA,EAAK,eAAiBN,EAAQM,CAAI,IAAM,IACpD,CACJ",
|
|
4
|
+
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are jQuery's: 400 ms unless the caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Sections for grid-editor.\n *\n * A feature plugin: load this file after the editor and the canvas can hold\n * sections - Bootstrap's .container, .container-fluid and .container-{bp} -\n * each grouping rows at a width of its own. What it can ask the editor for is\n * the handle its factory is called with, described in docs/plugins.md.\n *\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.sections.min.js\"></script>\n *\n * Called sections, not containers, because a container is what the tabs,\n * accordion, popup and card plugins make. A section is recognised by its\n * Bootstrap class alone, and only as a child of the canvas: a .container\n * somewhere inside an element's markup is that element's business.\n *\n * sections.widths narrows the widths the field offers.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\nObject.assign(GridEditor.locales.en, {\n 'section.add': 'Section',\n 'section.width': 'Width',\n 'section.fixed': 'Fixed',\n 'section.fluid': 'Full width',\n 'section.from': 'Fixed from {breakpoint}',\n 'tool.add_row_to_section': 'Add row',\n 'tool.delete_section': 'Remove section',\n 'confirm.delete_section': 'Delete this section and everything in it?',\n});\n\n/** Each width, and the class that gives it. */\nvar WIDTHS = {\n fixed: 'container',\n fluid: 'container-fluid',\n sm: 'container-sm',\n md: 'container-md',\n lg: 'container-lg',\n xl: 'container-xl',\n xxl: 'container-xxl',\n};\n\nvar ORDER = ['fixed', 'sm', 'md', 'lg', 'xl', 'xxl', 'fluid'];\n\nGridEditor.features.sections = function(ge) {\n\n var options = Object.assign({ widths: ORDER }, ge.settings.sections);\n\n function widthOf(section) {\n var found = null;\n\n Object.keys(WIDTHS).forEach(function(width) {\n if (!found && dom.hasClass(section, WIDTHS[width])) { found = width; }\n });\n\n return found;\n }\n\n function isSection(node) {\n return node.parentElement === ge.canvas && widthOf(node) !== null;\n }\n\n function sections() {\n return dom.children(ge.canvas).filter(isSection);\n }\n\n function label(width) {\n if (width === 'fixed') { return ge.t('section.fixed'); }\n if (width === 'fluid') { return ge.t('section.fluid'); }\n\n return ge.t('section.from', { breakpoint: width });\n }\n\n /**\n * Change a section's width, announced like a utility: the width is its\n * one container class, the same at every breakpoint.\n */\n function setWidth(section, width, source) {\n var from = widthOf(section);\n if (from === width || !WIDTHS[width]) { return false; }\n\n return ge.operate(function() {\n var payload = ge.payloadFor('section', section, {\n family: 'section',\n breakpoint: 'all',\n tiers: [],\n from: from,\n to: width,\n source: source || 'api',\n });\n\n if (!ge.emit('before-utility', payload)) {\n var select = dom.one(ge.detailsOf(section), '.ge-section-width select');\n if (select) { select.value = from; }\n return false;\n }\n\n dom.removeClass(section, WIDTHS[from]);\n dom.addClass(section, WIDTHS[width]);\n ge.emit('after-utility', payload);\n\n return true;\n });\n }\n\n function widthField(section) {\n var select = dom.element('select', { 'class': 'form-select form-select-sm' });\n var current = widthOf(section);\n var offered = options.widths.indexOf(current) === -1 ? options.widths.concat([current]) : options.widths;\n\n ORDER.forEach(function(width) {\n if (offered.indexOf(width) === -1) { return; }\n select.appendChild(dom.element('option', { value: width }, label(width)));\n });\n\n select.value = current;\n select.addEventListener('change', function() { setWidth(section, this.value, 'panel'); });\n\n var field = dom.element('label', { 'class': 'ge-utility ge-section-width' });\n field.appendChild(dom.element('span', { 'class': 'ge-utility-label' }, ge.t('section.width')));\n field.appendChild(select);\n\n return field;\n }\n\n function createControls(section) {\n var drawer = dom.element('div', { 'class': 'ge-tools-drawer ge-section-drawer' });\n section.insertBefore(drawer, section.firstChild);\n\n ge.createMoveTool(drawer);\n ge.addSettingsTool(drawer, section, ge.settings.section_classes || []).appendChild(widthField(section));\n\n ge.createTool(drawer, ge.t('tool.delete_section'), 'ge-delete-section', 'bi bi-trash', function() {\n ge.deleteNode('section', section, ge.t('confirm.delete_section'), function(removed) {\n dom.slideUp(section, removed);\n });\n });\n\n ge.createTool(drawer, ge.t('tool.add_row_to_section'), 'ge-add-row', 'bi bi-plus-circle', function() {\n ge.place(ge.rowFromLayout([12]), 'row', { appendTo: section });\n });\n }\n\n function mark() {\n sections().forEach(function(section) {\n dom.addClass(section, 'ge-section');\n if (!dom.child(section, '.ge-tools-drawer')) { createControls(section); }\n });\n }\n\n function unmark() {\n dom.children(ge.canvas, '.ge-section').forEach(function(section) {\n dom.removeClass(section, 'ge-section');\n });\n }\n\n /** createSection(options): a section, detached unless a placement is given. */\n function createSection(settings) {\n settings = settings || {};\n\n var section = dom.element('div', { 'class': WIDTHS[settings.width] || WIDTHS.fixed });\n\n (settings.rows || [[12]]).forEach(function(layout) {\n section.appendChild(ge.rowFromLayout(layout));\n });\n\n return ge.place(section, 'section', settings);\n }\n\n return {\n methods: {\n createSection: createSection,\n },\n\n kindOf: function(node) {\n return dom.hasClass(node, 'ge-section') ? 'section' : null;\n },\n\n // A section is a block the canvas moves, and a region rows move in\n blocks: '.ge-section',\n regions: '.ge-section',\n\n /** A section goes on the canvas and nowhere else, and holds rows and nothing else. */\n accepts: function(region, node) {\n if (dom.hasClass(node, 'ge-section') || isSectionMade(node)) { return region === ge.canvas; }\n if (dom.hasClass(region, 'ge-section')) { return dom.hasClass(node, 'row'); }\n\n return true;\n },\n\n toolbar: [{\n labelKey: 'section.add',\n kind: 'section',\n group: 'content',\n create: function() { return createSection(); },\n }],\n\n onInit: mark,\n onDeinit: unmark,\n };\n\n /** A section the toolbar just made, before init has marked it. */\n function isSectionMade(node) {\n return !node.parentElement && widthOf(node) !== null;\n }\n};\n"],
|
|
5
|
+
"mappings": "MASA,IAAIA,EAAa,OAAO,W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G,OAC5EM,EAAS6B,EAAQ,YAAY,EAAgB7B,EAASE,EAAM,KAAK,EAElE,EACX,EAEA,QAAS,CAAC,CACN,SAAU,cACV,KAAM,UACN,MAAO,UACP,OAAQ,UAAW,CAAE,OAAOwB,EAAc,CAAG,CACjD,CAAC,EAED,OAAQH,EACR,SAAUE,CACd,EAGA,SAASK,EAAc5B,EAAM,CACzB,MAAO,CAACA,EAAK,eAAiBN,EAAQM,CAAI,IAAM,IACpD,CACJ",
|
|
6
6
|
"names": ["GridEditor", "one", "root", "selector", "children", "node", "selector", "each", "child", "element", "tag", "attributes", "text", "node", "name", "value", "addClass", "node", "names", "split", "name", "removeClass", "hasClass", "node", "name", "split", "names", "hide", "node", "visible", "node", "DEFAULT_DURATION", "animateAway", "node", "frames", "duration", "done", "finish", "hide", "visible", "animation", "called", "once", "slideUp", "style", "GridEditor", "WIDTHS", "ORDER", "ge", "options", "widthOf", "section", "found", "width", "hasClass", "isSection", "node", "sections", "children", "label", "setWidth", "source", "from", "payload", "select", "one", "removeClass", "addClass", "widthField", "element", "current", "offered", "field", "createControls", "drawer", "removed", "slideUp", "mark", "child", "unmark", "createSection", "settings", "layout", "region", "isSectionMade"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var p=window.GridEditor;if(!p||typeof p.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");function _(e,i){return e?Array.prototype.slice.call(e.querySelectorAll(i)):[]}function X(e,i){return e?Array.prototype.filter.call(e.children,function(r){return!i||r.matches(i)}):[]}function b(e,i){return X(e,i)[0]||null}function Y(e,i,r){var o=e&&e.nodeType===1?e.closest(i):null;return o&&r&&o!==r&&!r.contains(o)?null:o}function w(e,i,r){var o=document.createElement(e);return Object.keys(i||{}).forEach(function(n){var
|
|
1
|
+
(()=>{var p=window.GridEditor;if(!p||typeof p.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");function _(e,i){return e?Array.prototype.slice.call(e.querySelectorAll(i)):[]}function X(e,i){return e?Array.prototype.filter.call(e.children,function(r){return!i||r.matches(i)}):[]}function b(e,i){return X(e,i)[0]||null}function Y(e,i,r){var o=e&&e.nodeType===1?e.closest(i):null;return o&&r&&o!==r&&!r.contains(o)?null:o}function w(e,i,r){var o=document.createElement(e);return Object.keys(i||{}).forEach(function(n){var u=i[n];u!=null&&u!==!1&&o.setAttribute(n,u)}),r!=null&&(o.textContent=r),o}function Q(e,i){return e.innerHTML=i==null?"":String(i),e}function A(e,i){return N(i).forEach(function(r){e.classList.add(r)}),e}function L(e,i){return N(i).forEach(function(r){e.classList.remove(r)}),e}function E(e,i){return!!e&&e.nodeType===1&&e.classList.contains(i)}function N(e){return String(e||"").split(/\s+/).filter(Boolean)}function J(e){return e.style.display="none",e}function H(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function $(e,i,r,o,n){var u=function(s){var l=Y(s.target,r,e);if(l&&e.contains(l))return o.call(l,s)};return N(i).forEach(function(s){e.addEventListener(s,u,n)}),u}var V=400;function Z(e,i,r,o){r=r===void 0?V:r;var n=function(){J(e),o&&o()};if(!H(e)||!e.animate||r<=0){window.setTimeout(n,0);return}var u=e.animate(i(getComputedStyle(e)),{duration:r,easing:"ease-in-out"}),s=!1,l=function(){s||(s=!0,n())};u.onfinish=l,u.oncancel=l}function F(e,i,r){typeof i=="function"&&(r=i,i=void 0),e.style.overflow="hidden",Z(e,function(o){return[{height:o.height,paddingTop:o.paddingTop,paddingBottom:o.paddingBottom,marginTop:o.marginTop,marginBottom:o.marginBottom},{height:"0px",paddingTop:"0px",paddingBottom:"0px",marginTop:"0px",marginBottom:"0px"}]},i,function(){e.style.removeProperty("overflow"),r&&r()})}if(!p.features.text){let e=function(n){var u={};return Array.prototype.slice.call(n.attributes).forEach(function(s){u[s.name]=s.value}),u},i=function(n){return(n||"").split(/\s+/).filter(function(u){return u!==""&&!I.test(u)})},r=function(n,u,s,l){var m=Object.assign({},u);Object.keys(Object.assign({},s,l)).forEach(function(f){f==="class"||U.test(f)||s[f]===l[f]||(l[f]===void 0?delete m[f]:m[f]=l[f])});var v=i(s.class),T=i(l.class),x=i(u.class).filter(function(f){return T.indexOf(f)!==-1||v.indexOf(f)===-1});T.forEach(function(f){v.indexOf(f)===-1&&x.indexOf(f)===-1&&x.push(f)}),x.length?m.class=x.join(" "):delete m.class,Object.keys(e(n)).forEach(function(f){n.removeAttribute(f)}),Object.keys(m).forEach(function(f){n.setAttribute(f,m[f])})},o=function(n){var u=n.settings,s={},l={};Object.keys(p.texts).forEach(function(t){s[t]=p.texts[t](n)}),Array.isArray(u.content_types)||(u.content_types=Object.keys(s)),Array.isArray(u.text_tools)||(u.text_tools=[]),Array.isArray(u.text_classes)||(u.text_classes=[]);function m(){return u.content_types.filter(function(t){return!!s[t]})}function v(t){var a=s[t];return a&&a.labelKey?n.t(a.labelKey):t}function T(t,a){var c=s[t],d=w("div",{class:"ge-content ge-content-type-"+t,"data-ge-content-type":t});return a&&a.nodeType?d.appendChild(a):Q(d,a!==void 0?a:c&&c.initialContent||""),d}function x(t,a){return t&&typeof t=="object"&&(a=t,t=void 0),a=a||{},t=t||m()[0],!t||!s[t]?(l["createText:"+t]||(l["createText:"+t]=!0,n.warn('createText: no text editor "'+t+'" is loaded; load its plugin and name it in content_types')),null):n.place(T(t,a.content),"text",a)}function f(t){return!!s[t.getAttribute("data-ge-content-type")]}function K(t){if(!E(t,"ge-rte-active")&&H(t)){var a=s[t.getAttribute("data-ge-content-type")];if(a){if(a.available&&!a.available()){a.missingKey&&console.error(n.t(a.missingKey));return}j.set(t,e(t)),C.delete(t),A(t,"ge-rte-active"),a.start([t])}}}function D(){K(this)}function k(t){var a=s[t.getAttribute("data-ge-content-type")],c=j.get(t),d=c?e(t):null;a&&a.stop([t]),L(t,"ge-rte-active"),c&&(r(t,c,C.get(t)||c,d),j.delete(t),C.delete(t))}function B(t){var a=b(t,".ge-content"),c=a.getAttribute("data-ge-content-type"),d=w("div",{class:"ge-tools-drawer ge-text-drawer"});t.insertBefore(d,t.firstChild),n.createMoveTool(d);var O=n.addSettingsTool(d,a,u.text_classes),h=b(O,".ge-details-general"),S=w("div",{class:"ge-field ge-text-editor"});S.appendChild(w("span",{class:"ge-field-label"},n.t("panel.editor"))),S.appendChild(w("span",{class:"ge-field-value"},v(c))),h.insertBefore(S,h.firstChild),u.text_tools.forEach(function(y){n.createTool(d,y.title||"",y.className||"",y.iconClass||"bi bi-wrench",y.on)}),n.createTool(d,n.t("tool.delete_text"),"ge-delete-text","bi bi-trash",function(){n.deleteNode("text",a,n.t("confirm.delete_text"),function(y){k(a),F(t,function(){t.remove(),y()})})})}function z(){_(n.canvas,".ge-text-block").forEach(function(t){if(!b(t,".ge-tools-drawer")){var a=b(t,".ge-content");!a||!f(a)||B(t)}})}var P=m(),g=null;return{methods:{createText:x},textTypes:function(){var t=m(),a=Object.keys(s).filter(function(c){return t.indexOf(c)===-1});return t.concat(a).map(function(c){var d=s[c];return{type:c,label:v(c),offered:t.indexOf(c)!==-1,available:d.available?function(){return d.available()}:null,missingKey:d.missingKey,edit:function(O){var h=O.parentElement;E(h,"ge-text-block")&&!b(h,".ge-tools-drawer")&&B(h),K(O)}}})},toolbar:P.map(function(t){return{label:function(){return P.length>1?n.t("text.add_type",{editor:v(t)}):n.t("text.add")},iconClass:s[t].iconClass,className:"ge-add-text-button",kind:"text",group:"content",inColumn:!0,create:function(){return T(t)}}}),onInit:function(){z(),g&&n.canvas.removeEventListener("click",g),g=$(n.canvas,"click",".ge-content",D)},onBeforeDeinit:function(){_(n.canvas,".ge-content").forEach(function(t){f(t)&&k(t)})},onDeinit:function(){g&&n.canvas.removeEventListener("click",g),g=null},onContentReady:function(t){j.has(t)&&!C.has(t)&&C.set(t,e(t))}}};Object.assign(p.locales.en,{"text.add":"Text","text.add_type":"Text ({editor})","panel.editor":"Editor","panel.kind_text":"Text"}),j=new WeakMap,C=new WeakMap,I=/^(mce-|cke|ck-|note-)|^(ck|active|ge-rte-active)$/,U=/^(data-mce-|contenteditable$|spellcheck$)/,o.always=!0,p.features.text=o}var j,C,I,U;Object.assign(p.locales.en,{"text.summernote":"Summernote"});var W="<p>Lorem ipsum dolores</p>";function q(e){return!!e&&Object.prototype.toString.call(e)==="[object Object]"}function M(e){return Array.prototype.slice.call(arguments,1).forEach(function(i){Object.keys(i||{}).forEach(function(r){var o=i[r];o===void 0||o===e||(Array.isArray(o)?e[r]=M(Array.isArray(e[r])?e[r]:[],o):q(o)?e[r]=M(q(e[r])?e[r]:{},o):e[r]=o)})}),e}p.texts.summernote=function(e){return{labelKey:"text.summernote",initialContent:W,missingKey:"error.summernote_missing",available:function(){return!!(window.jQuery&&window.jQuery.fn&&window.jQuery.fn.summernote)},start:function(i){var r=e.settings,o=window.jQuery;o.now||(o.now=Date.now),i.forEach(function(n){if(!E(n,"active")){n.innerHTML==W&&(n.innerHTML=""),A(n,"active");var u=M({},r.summernote&&r.summernote.config?r.summernote.config:{},{tabsize:2,airMode:!0,callbacks:{onInit:function(){var s;try{s=r.summernote.config.callbacks.onInit}catch(l){}s&&s.call(this),e.textReady(n),o(n).summernote("focus")}}});o(n).summernote(u)}})},stop:function(i){var r=window.jQuery;i.filter(function(o){return E(o,"active")}).forEach(function(o){r&&r.fn.summernote&&r(o).summernote("destroy"),L(o,"active"),["id","style","spellcheck"].forEach(function(n){o.removeAttribute(n)})})}}};})();
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/js/register.js", "../../src/js/dom.js", "../../src/js/text/grideditor.text.js", "../../src/js/plugins/grideditor.summernote.js"],
|
|
4
|
-
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are jQuery's: 400 ms unless the caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Text for grid-editor: what the text editor plugins share.\n *\n * Not a file a page loads. The build puts it at the top of each text editor\n * plugin - grideditor.tinymce.js, grideditor.ckeditor.js,\n * grideditor.summernote.js - and whichever of them loads first installs it:\n * a page with two editors has one of these.\n *\n * It is a feature plugin, `text`, that the `plugins` setting does not choose\n * (content_types does), and it is everything a text is to the editor: the\n * text block's drawer, the Text buttons in the toolbar, createText, opening\n * an editor on a click and closing it again with the host's attributes put\n * back, and making the host's plain content a text through the core's\n * `textTypes` hook.\n *\n * Each editor registers under GridEditor.texts, which is this file's own\n * registry and not a contract: an editor of a host's own is a feature plugin\n * of its own, as example/custom_editor.html shows.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\n// However many editors a page loads, each with a copy of this file in its\n// classic script: the first one installs it\nif (!GridEditor.features.text) {\n\n Object.assign(GridEditor.locales.en, {\n 'text.add': 'Text',\n 'text.add_type': 'Text ({editor})',\n 'panel.editor': 'Editor',\n 'panel.kind_text': 'Text',\n });\n\n /**\n * What a content area's attributes were before its editor opened, and\n * once it had: the two readings closeText plays the host's changes\n * back from. Shared by every editor on the page, like the nodes.\n */\n var readBefore = new WeakMap();\n var readReady = new WeakMap();\n\n /** What a text editor puts on a content area while it is open, whenever it likes. */\n var EDITOR_CLASS = /^(mce-|cke|ck-|note-)|^(ck|active|ge-rte-active)$/;\n var EDITOR_ATTRIBUTE = /^(data-mce-|contenteditable$|spellcheck$)/;\n\n function attributesOf(element) {\n var found = {};\n Array.prototype.slice.call(element.attributes).forEach(function(attribute) {\n found[attribute.name] = attribute.value;\n });\n return found;\n }\n\n function classesIn(value) {\n return (value || '').split(/\\s+/).filter(function(name) {\n return name !== '' && !EDITOR_CLASS.test(name);\n });\n }\n\n /** The host's markup, with what changed from `ready` to `open` played back onto it. */\n function restoreAttributes(block, before, ready, open) {\n var result = Object.assign({}, before);\n\n Object.keys(Object.assign({}, ready, open)).forEach(function(name) {\n if (name === 'class' || EDITOR_ATTRIBUTE.test(name) || ready[name] === open[name]) { return; }\n\n if (open[name] === undefined) {\n delete result[name];\n } else {\n result[name] = open[name];\n }\n });\n\n var readyClasses = classesIn(ready['class']);\n var openClasses = classesIn(open['class']);\n var classes = classesIn(before['class']).filter(function(name) {\n return openClasses.indexOf(name) !== -1 || readyClasses.indexOf(name) === -1;\n });\n openClasses.forEach(function(name) {\n if (readyClasses.indexOf(name) === -1 && classes.indexOf(name) === -1) { classes.push(name); }\n });\n\n // In the host's order, class where it was: getHtml should not\n // shuffle a node's attributes because it was edited\n if (classes.length) { result['class'] = classes.join(' '); } else { delete result['class']; }\n\n Object.keys(attributesOf(block)).forEach(function(name) { block.removeAttribute(name); });\n Object.keys(result).forEach(function(name) { block.setAttribute(name, result[name]); });\n }\n\n function textFeature(ge) {\n\n var settings = ge.settings;\n var TEXTS = {};\n var warned = {};\n\n Object.keys(GridEditor.texts).forEach(function(type) {\n TEXTS[type] = GridEditor.texts[type](ge);\n });\n\n // Every editor loaded, in the order the page loaded them, unless the\n // host names the ones it wants\n if (!Array.isArray(settings.content_types)) { settings.content_types = Object.keys(TEXTS); }\n if (!Array.isArray(settings.text_tools)) { settings.text_tools = []; }\n if (!Array.isArray(settings.text_classes)) { settings.text_classes = []; }\n\n /** The text editors this editor offers, in content_types order: the ones loaded. */\n function offeredTexts() {\n return settings.content_types.filter(function(type) { return !!TEXTS[type]; });\n }\n\n /** What a text editor is called: its plugin's label, or its type. */\n function textLabel(type) {\n var text = TEXTS[type];\n return text && text.labelKey ? ge.t(text.labelKey) : type;\n }\n\n /** A detached content area of `type`, holding `content` or the editor's initial content. */\n function makeText(type, content) {\n var text = TEXTS[type];\n var block = dom.element('div', {\n 'class': 'ge-content ge-content-type-' + type,\n 'data-ge-content-type': type,\n });\n\n if (content && content.nodeType) {\n block.appendChild(content);\n } else {\n dom.setHtml(block, content !== undefined ? content : (text && text.initialContent) || '');\n }\n return block;\n }\n\n /**\n * createText(type?, options?): a content area of a text editor's,\n * detached unless a placement is given. The type is the first one\n * offered by default. `options.content` is its html.\n */\n function apiCreateText(type, options) {\n if (type && typeof type === 'object') {\n options = type;\n type = undefined;\n }\n options = options || {};\n type = type || offeredTexts()[0];\n\n if (!type || !TEXTS[type]) {\n if (!warned['createText:' + type]) {\n warned['createText:' + type] = true;\n ge.warn('createText: no text editor \"' + type + '\" is loaded; ' +\n 'load its plugin and name it in content_types');\n }\n return null;\n }\n\n return ge.place(makeText(type, options.content), 'text', options);\n }\n\n /** Whether a content area is a text of one of the editors loaded here. */\n function isOurs(block) {\n return !!TEXTS[block.getAttribute('data-ge-content-type')];\n }\n\n /** Open the editor on a text, once: until it is closed again. */\n function startText(block) {\n if (dom.hasClass(block, 'ge-rte-active')) { return; }\n\n // A content area nobody can see - a tab that is not the open one,\n // a closed accordion item - has no geometry for an editor to lay\n // its toolbar out against, and nothing anyone can type into\n if (!dom.visible(block)) { return; }\n\n // The attribute: it is markup, and the drawer reads it the same way\n var text = TEXTS[block.getAttribute('data-ge-content-type')];\n if (!text) { return; }\n\n // Not marked active, so the next click tries again: the library\n // may be loaded by then\n if (text.available && !text.available()) {\n if (text.missingKey) { console.error(ge.t(text.missingKey)); }\n return;\n }\n\n readBefore.set(block, attributesOf(block));\n readReady.delete(block);\n dom.addClass(block, 'ge-rte-active');\n text.start([block]);\n }\n\n function onClick() {\n startText(this);\n }\n\n /**\n * Close the text editor on one content area, and leave the content\n * area's own attributes as the host left them.\n *\n * An editor adds attributes of its own while it is open, and takes\n * them off again, more or less: CKEditor leaves aria-readonly behind.\n * tinyMCE does worse, and puts back every attribute as it was when it\n * opened, so an id, a class or a plugin's attribute given while it was\n * open is lost. So the attributes are read three times - before the\n * editor opens, once it has opened, and before it closes - and what\n * changed between the second and the third, the host's doing, is\n * played back onto the first, the host's markup. What the editor did\n * is left out either way.\n */\n function closeText(block) {\n var text = TEXTS[block.getAttribute('data-ge-content-type')];\n var before = readBefore.get(block);\n var open = before ? attributesOf(block) : null;\n\n // Every content area is told: one whose editor never\n // started is the plugin's to ignore\n if (text) { text.stop([block]); }\n\n // After stop, not before: an editor that restores the class\n // attribute it snapshotted would put ge-rte-active back\n dom.removeClass(block, 'ge-rte-active');\n\n if (before) {\n restoreAttributes(block, before, readReady.get(block) || before, open);\n readBefore.delete(block);\n readReady.delete(block);\n }\n }\n\n function createTextControls(textBlock) {\n var block = dom.child(textBlock, '.ge-content');\n var type = block.getAttribute('data-ge-content-type');\n var drawer = dom.element('div', { 'class': 'ge-tools-drawer ge-text-drawer' });\n textBlock.insertBefore(drawer, textBlock.firstChild);\n\n ge.createMoveTool(drawer);\n\n var details = ge.addSettingsTool(drawer, block, settings.text_classes);\n\n // Which editor edits it, first in its settings: something to\n // know about it, not something to do with it\n var general = dom.child(details, '.ge-details-general');\n var editor = dom.element('div', { 'class': 'ge-field ge-text-editor' });\n editor.appendChild(dom.element('span', { 'class': 'ge-field-label' }, ge.t('panel.editor')));\n editor.appendChild(dom.element('span', { 'class': 'ge-field-value' }, textLabel(type)));\n general.insertBefore(editor, general.firstChild);\n\n settings.text_tools.forEach(function(hostTool) {\n ge.createTool(drawer, hostTool.title || '', hostTool.className || '',\n hostTool.iconClass || 'bi bi-wrench', hostTool.on);\n });\n\n ge.createTool(drawer, ge.t('tool.delete_text'), 'ge-delete-text', 'bi bi-trash', function() {\n ge.deleteNode('text', block, ge.t('confirm.delete_text'), function(removed) {\n // Its editor lets go first: removed while open, it would\n // be left behind, attached to nothing\n closeText(block);\n dom.slideUp(textBlock, function() {\n textBlock.remove();\n removed();\n });\n });\n });\n }\n\n /** A drawer for each text of ours in a text block that has none yet. */\n function markTexts() {\n dom.all(ge.canvas, '.ge-text-block').forEach(function(textBlock) {\n if (dom.child(textBlock, '.ge-tools-drawer')) { return; }\n\n var block = dom.child(textBlock, '.ge-content');\n if (!block || !isOurs(block)) { return; }\n\n createTextControls(textBlock);\n });\n }\n\n var texts = offeredTexts();\n var clicks = null; // The delegated click listener, while editing\n\n return {\n methods: {\n createText: apiCreateText,\n },\n\n /**\n * The types this plugin edits, for the core: every editor loaded\n * is the owner of its texts, and the ones offered are what the\n * host's plain content can be made.\n */\n textTypes: function() {\n var offered = offeredTexts();\n var others = Object.keys(TEXTS).filter(function(type) { return offered.indexOf(type) === -1; });\n\n return offered.concat(others).map(function(type) {\n var text = TEXTS[type];\n\n return {\n type: type,\n label: textLabel(type),\n offered: offered.indexOf(type) !== -1,\n available: text.available ? function() { return text.available(); } : null,\n missingKey: text.missingKey,\n edit: function(block) {\n var textBlock = block.parentElement;\n if (dom.hasClass(textBlock, 'ge-text-block') && !dom.child(textBlock, '.ge-tools-drawer')) {\n createTextControls(textBlock);\n }\n\n startText(block);\n },\n };\n });\n },\n\n // A text block of each editor offered. Like a container, it goes\n // into a row of its own when clicked, or where it is dropped\n toolbar: texts.map(function(type) {\n return {\n label: function() {\n return texts.length > 1 ? ge.t('text.add_type', { editor: textLabel(type) }) : ge.t('text.add');\n },\n iconClass: TEXTS[type].iconClass,\n className: 'ge-add-text-button',\n kind: 'text',\n inColumn: true,\n create: function() { return makeText(type); },\n };\n }),\n\n onInit: function() {\n markTexts();\n\n if (clicks) { ge.canvas.removeEventListener('click', clicks); }\n clicks = dom.delegate(ge.canvas, 'click', '.ge-content', onClick);\n },\n\n // While the drawers and the text blocks are still there, as the\n // editors left them\n onBeforeDeinit: function() {\n dom.all(ge.canvas, '.ge-content').forEach(function(block) {\n if (isOurs(block)) { closeText(block); }\n });\n },\n\n onDeinit: function() {\n if (clicks) { ge.canvas.removeEventListener('click', clicks); }\n clicks = null;\n },\n\n // The first time only: an undo says ready again, and by then the\n // host may have changed the content area itself\n onContentReady: function(area) {\n if (readBefore.has(area) && !readReady.has(area)) {\n readReady.set(area, attributesOf(area));\n }\n },\n };\n }\n\n // Whatever the plugins setting says: content_types chooses the editors\n textFeature.always = true;\n\n GridEditor.features.text = textFeature;\n\n}\n", "/**\n * Summernote for grid-editor's content areas.\n *\n * A text editor plugin: load this file after the editor, and summernote\n * after or before it, and a text of the summernote type is edited with\n * summernote in air mode. What it can ask the editor for is the\n * handle its factory is called with, described in docs/plugins.md.\n *\n * <script src=\"jquery/jquery.min.js\"></script>\n * <script src=\"summernote/summernote-bs5.min.js\"></script>\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.summernote.min.js\"></script>\n *\n * Summernote is a jQuery plugin, so this is the one plugin that needs jQuery\n * on the page: it calls summernote on a content area through it, and\n * nothing else. Towards the editor it is plain DOM, like every plugin, and\n * it needs no jQuery adapter.\n *\n * It imports what every text editor shares - text blocks, the Text button,\n * createText, making the host's plain content a text - from\n * src/js/text/grideditor.text.js, which the build puts in its classic\n * script, installed once however many editors a page loads.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\nimport '../text/grideditor.text.js';\n\nObject.assign(GridEditor.locales.en, {\n 'text.summernote': 'Summernote',\n});\n\nvar INITIAL_CONTENT = '<p>Lorem ipsum dolores</p>';\n\nfunction isPlainObject(value) {\n return !!value && Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * `sources` merged into `target`, objects and arrays copied all the way\n * down rather than shared: what jQuery's deep extend did for summernote's\n * options, whose callbacks the host's config and this file both fill in.\n */\nfunction deepMerge(target) {\n Array.prototype.slice.call(arguments, 1).forEach(function(source) {\n Object.keys(source || {}).forEach(function(key) {\n var value = source[key];\n\n if (value === undefined || value === target) { return; }\n\n if (Array.isArray(value)) {\n target[key] = deepMerge(Array.isArray(target[key]) ? target[key] : [], value);\n } else if (isPlainObject(value)) {\n target[key] = deepMerge(isPlainObject(target[key]) ? target[key] : {}, value);\n } else {\n target[key] = value;\n }\n });\n });\n\n return target;\n}\n\nGridEditor.texts.summernote = function(ge) {\n return {\n labelKey: 'text.summernote',\n initialContent: INITIAL_CONTENT,\n missingKey: 'error.summernote_missing',\n\n available: function() { return !!(window.jQuery && window.jQuery.fn && window.jQuery.fn.summernote); },\n\n start: function(contentAreas) {\n var settings = ge.settings;\n var $ = window.jQuery;\n\n // Summernote 0.9.1 calls $.now(), which jQuery 4 removed, and\n // cannot open without it. Given back only where it is missing,\n // and only once summernote is actually used.\n if (!$.now) { $.now = Date.now; }\n\n contentAreas.forEach(function(contentArea) {\n if (dom.hasClass(contentArea, 'active')) { return; }\n\n if (contentArea.innerHTML == INITIAL_CONTENT) {\n contentArea.innerHTML = '';\n }\n dom.addClass(contentArea, 'active');\n\n var configuration = deepMerge(\n {},\n (settings.summernote && settings.summernote.config ? settings.summernote.config : {}),\n {\n tabsize: 2,\n airMode: true,\n // Focus editor on creation\n callbacks: {\n onInit: function() {\n\n // Call original oninit function, if one was passed in the config\n var callback;\n try {\n callback = settings.summernote.config.callbacks.onInit;\n } catch (err) {\n // No callback passed\n }\n if (callback) {\n callback.call(this);\n }\n\n // The editor owns what is inside the\n // content area now, so the grid editor is\n // told to put its own furniture back\n ge.textReady(contentArea);\n\n $(contentArea).summernote('focus');\n }\n }\n }\n );\n $(contentArea).summernote(configuration);\n });\n },\n\n stop: function(contentAreas) {\n var $ = window.jQuery;\n\n contentAreas.filter(function(contentArea) {\n return dom.hasClass(contentArea, 'active');\n }).forEach(function(contentArea) {\n if ($ && $.fn.summernote) { $(contentArea).summernote('destroy'); }\n\n dom.removeClass(contentArea, 'active');\n ['id', 'style', 'spellcheck'].forEach(function(name) {\n contentArea.removeAttribute(name);\n });\n });\n },\n };\n};\n"],
|
|
5
|
-
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECCvC,SAASC,EAAIC,EAAMC,EAAU,CAChC,OAAOD,EAAO,MAAM,UAAU,MAAM,KAAKA,EAAK,iBAAiBC,CAAQ,CAAC,EAAI,CAAC,CACjF,CAiBO,SAASC,EAASC,EAAMC,EAAU,CACrC,OAAKD,EAEE,MAAM,UAAU,OAAO,KAAKA,EAAK,SAAU,SAASE,EAAM,CAC7D,MAAO,CAACD,GAAYC,EAAK,QAAQD,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CACrC,CACJ,CACJ,CACJ,EACAD,EAAEC,CAAW,EAAE,WAAWG,CAAa,EAC3C,CAAC,CACL,EAEA,KAAM,SAASN,EAAc,CACzB,IAAIE,EAAI,OAAO,OAEfF,EAAa,OAAO,SAASG,EAAa,CACtC,OAAWC,EAASD,EAAa,QAAQ,CAC7C,CAAC,EAAE,QAAQ,SAASA,EAAa,CACzBD,GAAKA,EAAE,GAAG,YAAcA,EAAEC,CAAW,EAAE,WAAW,SAAS,EAE3DM,EAAYN,EAAa,QAAQ,EACrC,CAAC,KAAM,QAAS,YAAY,EAAE,QAAQ,SAASO,EAAM,CACjDP,EAAY,gBAAgBO,CAAI,CACpC,CAAC,CACL,CAAC,CACL,CACJ,CACJ",
|
|
4
|
+
"sourcesContent": ["/**\n * What a plugin's or a locale's classic script imports in place of the\n * editor: the GridEditor the page already loaded.\n *\n * The build points `import { GridEditor } from '../grideditor.js'` here for\n * the classic scripts, so each registers on the editor the page has rather\n * than bringing its own. Loaded before the editor there is nothing to\n * register on, and saying so is better than a TypeError three calls later.\n */\nvar GridEditor = window.GridEditor;\n\nif (!GridEditor || typeof GridEditor.get !== 'function') {\n throw new Error('grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, ' +\n 'its locales and grideditor.jquery.js');\n}\n\nexport { GridEditor };\nexport default GridEditor;\n", "/**\n * The DOM, the way grid-editor uses it.\n *\n * Small helpers over the browser's own API, for the core and the shipped\n * plugins. Not a public API: a plugin of a host's own is free to write its\n * DOM code however it likes, and this file makes no promise to it.\n *\n * Stateless on purpose. The build puts a copy of this file in each plugin's\n * classic script, so anything kept here would be kept once per copy; a\n * module that needs to remember something about a node keeps its own\n * WeakMap.\n */\n\n/** Every element under `root` matching `selector`, as an array. */\nexport function all(root, selector) {\n return root ? Array.prototype.slice.call(root.querySelectorAll(selector)) : [];\n}\n\n/** The first element under `root` matching `selector`, or null. */\nexport function one(root, selector) {\n return root ? root.querySelector(selector) : null;\n}\n\n/** `root` itself when it matches, then every element under it that does. */\nexport function selfAndAll(root, selector) {\n if (!root) { return []; }\n\n var found = all(root, selector);\n if (root.nodeType === 1 && root.matches(selector)) { found.unshift(root); }\n return found;\n}\n\n/** The element children of `node`, those matching `selector` if one is given. */\nexport function children(node, selector) {\n if (!node) { return []; }\n\n return Array.prototype.filter.call(node.children, function(each) {\n return !selector || each.matches(selector);\n });\n}\n\n/** The first element child matching `selector`, or null. */\nexport function child(node, selector) {\n return children(node, selector)[0] || null;\n}\n\n/** The nearest ancestor-or-self matching `selector` below `stopAt`, or null. */\nexport function closest(node, selector, stopAt) {\n var found = node && node.nodeType === 1 ? node.closest(selector) : null;\n\n if (found && stopAt && found !== stopAt && !stopAt.contains(found)) { return null; }\n return found;\n}\n\n/** Whether `node` is an element matching `selector`. */\nexport function is(node, selector) {\n return !!node && node.nodeType === 1 && node.matches(selector);\n}\n\n/** Whether `node` is in the document. */\nexport function attached(node) {\n return !!node && document.documentElement.contains(node);\n}\n\n/** The element siblings after `node` that match `selector`. */\nexport function nextAll(node, selector) {\n var found = [];\n\n for (var next = node.nextElementSibling; next; next = next.nextElementSibling) {\n if (!selector || next.matches(selector)) { found.push(next); }\n }\n return found;\n}\n\n/** The ancestors of `node` up to, and not including, `stop`, nearest first. */\nexport function parentsUntil(node, stop) {\n var found = [];\n\n for (var parent = node.parentElement; parent && parent !== stop; parent = parent.parentElement) {\n found.push(parent);\n }\n return found;\n}\n\n/**\n * The nodes the html parses into, detached. Parsed the way innerHTML parses,\n * so a <script> in it never runs, here or once it is in the page.\n */\nexport function parse(html) {\n var template = document.createElement('template');\n template.innerHTML = html;\n return Array.prototype.slice.call(template.content.childNodes);\n}\n\n/** The one element the html is, detached. */\nexport function create(html) {\n var nodes = parse(html.trim());\n\n for (var i = 0; i < nodes.length; i++) {\n if (nodes[i].nodeType === 1) { return nodes[i]; }\n }\n return null;\n}\n\n/** An element of `tag`, with `attributes` and `text`. */\nexport function element(tag, attributes, text) {\n var node = document.createElement(tag);\n\n Object.keys(attributes || {}).forEach(function(name) {\n var value = attributes[name];\n if (value !== null && value !== undefined && value !== false) { node.setAttribute(name, value); }\n });\n if (text !== undefined && text !== null) { node.textContent = text; }\n\n return node;\n}\n\n/** Replace what `node` holds with `html`. A <script> in it does not run. */\nexport function setHtml(node, html) {\n node.innerHTML = html === undefined || html === null ? '' : String(html);\n return node;\n}\n\n/** Add one or several space separated classes. */\nexport function addClass(node, names) {\n split(names).forEach(function(name) { node.classList.add(name); });\n return node;\n}\n\nexport function removeClass(node, names) {\n split(names).forEach(function(name) { node.classList.remove(name); });\n return node;\n}\n\n/** Each class on, or off, or flipped when `on` is not given. */\nexport function toggleClass(node, names, state) {\n split(names).forEach(function(name) {\n if (state === undefined) {\n node.classList.toggle(name);\n } else {\n node.classList.toggle(name, !!state);\n }\n });\n return node;\n}\n\nexport function hasClass(node, name) {\n return !!node && node.nodeType === 1 && node.classList.contains(name);\n}\n\nfunction split(names) {\n return String(names || '').split(/\\s+/).filter(Boolean);\n}\n\n/** Take the class attribute off when there is nothing left in it. */\nexport function dropEmptyClass(node) {\n if (!node.getAttribute('class')) { node.removeAttribute('class'); }\n return node;\n}\n\n/** Take the style attribute off when there is nothing left in it. */\nexport function dropEmptyStyle(node) {\n if (!node.getAttribute('style')) { node.removeAttribute('style'); }\n return node;\n}\n\n/** Set attributes; a null or undefined value takes the attribute off. */\nexport function attr(node, attributes) {\n Object.keys(attributes).forEach(function(name) {\n var value = attributes[name];\n\n if (value === null || value === undefined) {\n node.removeAttribute(name);\n } else {\n node.setAttribute(name, value);\n }\n });\n return node;\n}\n\n/**\n * Inline styles, by css property name. A number is pixels for the properties\n * that take a length, as jQuery had it; an empty string takes one off.\n */\nexport function css(node, styles) {\n Object.keys(styles).forEach(function(property) {\n var value = styles[property];\n\n if (typeof value === 'number' && !UNITLESS[property]) { value = value + 'px'; }\n node.style.setProperty(property, value === null || value === undefined ? '' : String(value));\n });\n return node;\n}\n\nvar UNITLESS = { opacity: true, 'z-index': true, 'flex-grow': true, 'flex-shrink': true, order: true };\n\n/** What an element of this tag shows as when nothing hides it. */\nvar defaultDisplays = {};\n\nfunction defaultDisplay(node) {\n var tag = node.nodeName;\n\n if (!defaultDisplays[tag]) {\n var probe = document.body.appendChild(document.createElement(tag));\n defaultDisplays[tag] = getComputedStyle(probe).display;\n probe.remove();\n if (defaultDisplays[tag] === 'none') { defaultDisplays[tag] = 'block'; }\n }\n return defaultDisplays[tag];\n}\n\n/** Show a node: its inline display:none off, and a display of its own if a stylesheet hides it. */\nexport function show(node) {\n node.style.removeProperty('display');\n if (getComputedStyle(node).display === 'none') { node.style.display = defaultDisplay(node); }\n return node;\n}\n\nexport function hide(node) {\n node.style.display = 'none';\n return node;\n}\n\n/** Show or hide; flip when `on` is not given. */\nexport function toggle(node, state) {\n if (state === undefined) { state = !visible(node); }\n return state ? show(node) : hide(node);\n}\n\n/** Whether a node takes up room: what jQuery's :visible meant. */\nexport function visible(node) {\n return !!(node.offsetWidth || node.offsetHeight || node.getClientRects().length);\n}\n\n/** The border box's width, fractions included. */\nexport function outerWidth(node) {\n return node.getBoundingClientRect().width;\n}\n\nexport function outerHeight(node) {\n return node.getBoundingClientRect().height;\n}\n\n/** The content box's height, which is what jQuery's height() gave. */\nexport function contentHeight(node) {\n var style = getComputedStyle(node);\n return node.clientHeight - parseFloat(style.paddingTop) - parseFloat(style.paddingBottom);\n}\n\n/** Where a node is on the page, not in the window. */\nexport function offset(node) {\n var box = node.getBoundingClientRect();\n return { top: box.top + window.pageYOffset, left: box.left + window.pageXOffset };\n}\n\n/** Its index among its parent's element children, those matching `selector` if given. */\nexport function indexIn(node, selector) {\n return children(node.parentElement, selector).indexOf(node);\n}\n\n/** Put `node` right after `reference`. */\nexport function insertAfter(node, reference) {\n reference.parentNode.insertBefore(node, reference.nextSibling);\n return node;\n}\n\n/** Replace `node` with what it holds. */\nexport function unwrap(node) {\n var parent = node.parentNode;\n\n while (node.firstChild) { parent.insertBefore(node.firstChild, node); }\n node.remove();\n}\n\n/** Put `node` inside `wrapper`, where `node` was. */\nexport function wrap(node, wrapper) {\n node.parentNode.insertBefore(wrapper, node);\n wrapper.appendChild(node);\n return wrapper;\n}\n\n/**\n * Listen on `root` for `types` (space separated) on descendants that match\n * `selector`, with `this` the matched element, as jQuery's delegated\n * handlers had it. Hands back the listener, for removeEventListener; a\n * signal in `options` removes it too.\n */\nexport function delegate(root, types, selector, handler, options) {\n var listener = function(event) {\n var match = closest(event.target, selector, root);\n if (match && root.contains(match)) { return handler.call(match, event); }\n return undefined;\n };\n\n split(types).forEach(function(type) { root.addEventListener(type, listener, options); });\n return listener;\n}\n\n/** Listen for several space separated event types with one handler. */\nexport function on(target, types, handler, options) {\n split(types).forEach(function(type) { target.addEventListener(type, handler, options); });\n return handler;\n}\n\nexport function off(target, types, handler, options) {\n split(types).forEach(function(type) { target.removeEventListener(type, handler, options); });\n}\n\n/** A mouse event of `type` sent to `node`, the way a pointer would. */\nexport function fire(node, type) {\n node.dispatchEvent(new MouseEvent(type, { bubbles: type !== 'mouseenter' && type !== 'mouseleave' }));\n}\n\n/* ------------------------------------------------------------------\n * Taking a node away, visibly.\n *\n * The durations are jQuery's: 400 ms unless the caller says otherwise. `done` runs once the node is out of sight, which is\n * when the caller removes it; a node that is already out of sight is done at\n * once, on the next task, as jQuery had it.\n * ------------------------------------------------------------------ */\n\nvar DEFAULT_DURATION = 400;\n\nfunction animateAway(node, frames, duration, done) {\n duration = duration === undefined ? DEFAULT_DURATION : duration;\n\n var finish = function() {\n hide(node);\n if (done) { done(); }\n };\n\n if (!visible(node) || !node.animate || duration <= 0) {\n window.setTimeout(finish, 0);\n return;\n }\n\n var animation = node.animate(frames(getComputedStyle(node)), {\n duration: duration,\n easing: 'ease-in-out',\n });\n var called = false;\n var once = function() {\n if (called) { return; }\n called = true;\n finish();\n };\n\n animation.onfinish = once;\n animation.oncancel = once;\n}\n\n/** Fold a node up to nothing, then hide it. */\nexport function slideUp(node, duration, done) {\n if (typeof duration === 'function') {\n done = duration;\n duration = undefined;\n }\n\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n return [\n {\n height: style.height,\n paddingTop: style.paddingTop,\n paddingBottom: style.paddingBottom,\n marginTop: style.marginTop,\n marginBottom: style.marginBottom,\n },\n { height: '0px', paddingTop: '0px', paddingBottom: '0px', marginTop: '0px', marginBottom: '0px' },\n ];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n\n/** Fade a node out, then hide it. */\nexport function fadeOut(node, duration, done) {\n animateAway(node, function(style) {\n return [{ opacity: style.opacity }, { opacity: 0 }];\n }, duration, done);\n}\n\n/** Fade and fold a node, in height and, with `width`, sideways too, then hide it. */\nexport function shrinkAway(node, duration, done, width) {\n node.style.overflow = 'hidden';\n animateAway(node, function(style) {\n var from = { opacity: style.opacity, height: style.height };\n var to = { opacity: 0, height: '0px' };\n\n if (width) {\n from.width = style.width;\n to.width = '0px';\n }\n return [from, to];\n }, duration, function() {\n node.style.removeProperty('overflow');\n if (done) { done(); }\n });\n}\n", "/**\n * Text for grid-editor: what the text editor plugins share.\n *\n * Not a file a page loads. The build puts it at the top of each text editor\n * plugin - grideditor.tinymce.js, grideditor.ckeditor.js,\n * grideditor.summernote.js - and whichever of them loads first installs it:\n * a page with two editors has one of these.\n *\n * It is a feature plugin, `text`, that the `plugins` setting does not choose\n * (content_types does), and it is everything a text is to the editor: the\n * text block's drawer, the Text buttons in the toolbar, createText, opening\n * an editor on a click and closing it again with the host's attributes put\n * back, and making the host's plain content a text through the core's\n * `textTypes` hook.\n *\n * Each editor registers under GridEditor.texts, which is this file's own\n * registry and not a contract: an editor of a host's own is a feature plugin\n * of its own, as example/custom_editor.html shows.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\n\n// However many editors a page loads, each with a copy of this file in its\n// classic script: the first one installs it\nif (!GridEditor.features.text) {\n\n Object.assign(GridEditor.locales.en, {\n 'text.add': 'Text',\n 'text.add_type': 'Text ({editor})',\n 'panel.editor': 'Editor',\n 'panel.kind_text': 'Text',\n });\n\n /**\n * What a content area's attributes were before its editor opened, and\n * once it had: the two readings closeText plays the host's changes\n * back from. Shared by every editor on the page, like the nodes.\n */\n var readBefore = new WeakMap();\n var readReady = new WeakMap();\n\n /** What a text editor puts on a content area while it is open, whenever it likes. */\n var EDITOR_CLASS = /^(mce-|cke|ck-|note-)|^(ck|active|ge-rte-active)$/;\n var EDITOR_ATTRIBUTE = /^(data-mce-|contenteditable$|spellcheck$)/;\n\n function attributesOf(element) {\n var found = {};\n Array.prototype.slice.call(element.attributes).forEach(function(attribute) {\n found[attribute.name] = attribute.value;\n });\n return found;\n }\n\n function classesIn(value) {\n return (value || '').split(/\\s+/).filter(function(name) {\n return name !== '' && !EDITOR_CLASS.test(name);\n });\n }\n\n /** The host's markup, with what changed from `ready` to `open` played back onto it. */\n function restoreAttributes(block, before, ready, open) {\n var result = Object.assign({}, before);\n\n Object.keys(Object.assign({}, ready, open)).forEach(function(name) {\n if (name === 'class' || EDITOR_ATTRIBUTE.test(name) || ready[name] === open[name]) { return; }\n\n if (open[name] === undefined) {\n delete result[name];\n } else {\n result[name] = open[name];\n }\n });\n\n var readyClasses = classesIn(ready['class']);\n var openClasses = classesIn(open['class']);\n var classes = classesIn(before['class']).filter(function(name) {\n return openClasses.indexOf(name) !== -1 || readyClasses.indexOf(name) === -1;\n });\n openClasses.forEach(function(name) {\n if (readyClasses.indexOf(name) === -1 && classes.indexOf(name) === -1) { classes.push(name); }\n });\n\n // In the host's order, class where it was: getHtml should not\n // shuffle a node's attributes because it was edited\n if (classes.length) { result['class'] = classes.join(' '); } else { delete result['class']; }\n\n Object.keys(attributesOf(block)).forEach(function(name) { block.removeAttribute(name); });\n Object.keys(result).forEach(function(name) { block.setAttribute(name, result[name]); });\n }\n\n function textFeature(ge) {\n\n var settings = ge.settings;\n var TEXTS = {};\n var warned = {};\n\n Object.keys(GridEditor.texts).forEach(function(type) {\n TEXTS[type] = GridEditor.texts[type](ge);\n });\n\n // Every editor loaded, in the order the page loaded them, unless the\n // host names the ones it wants\n if (!Array.isArray(settings.content_types)) { settings.content_types = Object.keys(TEXTS); }\n if (!Array.isArray(settings.text_tools)) { settings.text_tools = []; }\n if (!Array.isArray(settings.text_classes)) { settings.text_classes = []; }\n\n /** The text editors this editor offers, in content_types order: the ones loaded. */\n function offeredTexts() {\n return settings.content_types.filter(function(type) { return !!TEXTS[type]; });\n }\n\n /** What a text editor is called: its plugin's label, or its type. */\n function textLabel(type) {\n var text = TEXTS[type];\n return text && text.labelKey ? ge.t(text.labelKey) : type;\n }\n\n /** A detached content area of `type`, holding `content` or the editor's initial content. */\n function makeText(type, content) {\n var text = TEXTS[type];\n var block = dom.element('div', {\n 'class': 'ge-content ge-content-type-' + type,\n 'data-ge-content-type': type,\n });\n\n if (content && content.nodeType) {\n block.appendChild(content);\n } else {\n dom.setHtml(block, content !== undefined ? content : (text && text.initialContent) || '');\n }\n return block;\n }\n\n /**\n * createText(type?, options?): a content area of a text editor's,\n * detached unless a placement is given. The type is the first one\n * offered by default. `options.content` is its html.\n */\n function apiCreateText(type, options) {\n if (type && typeof type === 'object') {\n options = type;\n type = undefined;\n }\n options = options || {};\n type = type || offeredTexts()[0];\n\n if (!type || !TEXTS[type]) {\n if (!warned['createText:' + type]) {\n warned['createText:' + type] = true;\n ge.warn('createText: no text editor \"' + type + '\" is loaded; ' +\n 'load its plugin and name it in content_types');\n }\n return null;\n }\n\n return ge.place(makeText(type, options.content), 'text', options);\n }\n\n /** Whether a content area is a text of one of the editors loaded here. */\n function isOurs(block) {\n return !!TEXTS[block.getAttribute('data-ge-content-type')];\n }\n\n /** Open the editor on a text, once: until it is closed again. */\n function startText(block) {\n if (dom.hasClass(block, 'ge-rte-active')) { return; }\n\n // A content area nobody can see - a tab that is not the open one,\n // a closed accordion item - has no geometry for an editor to lay\n // its toolbar out against, and nothing anyone can type into\n if (!dom.visible(block)) { return; }\n\n // The attribute: it is markup, and the drawer reads it the same way\n var text = TEXTS[block.getAttribute('data-ge-content-type')];\n if (!text) { return; }\n\n // Not marked active, so the next click tries again: the library\n // may be loaded by then\n if (text.available && !text.available()) {\n if (text.missingKey) { console.error(ge.t(text.missingKey)); }\n return;\n }\n\n readBefore.set(block, attributesOf(block));\n readReady.delete(block);\n dom.addClass(block, 'ge-rte-active');\n text.start([block]);\n }\n\n function onClick() {\n startText(this);\n }\n\n /**\n * Close the text editor on one content area, and leave the content\n * area's own attributes as the host left them.\n *\n * An editor adds attributes of its own while it is open, and takes\n * them off again, more or less: CKEditor leaves aria-readonly behind.\n * tinyMCE does worse, and puts back every attribute as it was when it\n * opened, so an id, a class or a plugin's attribute given while it was\n * open is lost. So the attributes are read three times - before the\n * editor opens, once it has opened, and before it closes - and what\n * changed between the second and the third, the host's doing, is\n * played back onto the first, the host's markup. What the editor did\n * is left out either way.\n */\n function closeText(block) {\n var text = TEXTS[block.getAttribute('data-ge-content-type')];\n var before = readBefore.get(block);\n var open = before ? attributesOf(block) : null;\n\n // Every content area is told: one whose editor never\n // started is the plugin's to ignore\n if (text) { text.stop([block]); }\n\n // After stop, not before: an editor that restores the class\n // attribute it snapshotted would put ge-rte-active back\n dom.removeClass(block, 'ge-rte-active');\n\n if (before) {\n restoreAttributes(block, before, readReady.get(block) || before, open);\n readBefore.delete(block);\n readReady.delete(block);\n }\n }\n\n function createTextControls(textBlock) {\n var block = dom.child(textBlock, '.ge-content');\n var type = block.getAttribute('data-ge-content-type');\n var drawer = dom.element('div', { 'class': 'ge-tools-drawer ge-text-drawer' });\n textBlock.insertBefore(drawer, textBlock.firstChild);\n\n ge.createMoveTool(drawer);\n\n var details = ge.addSettingsTool(drawer, block, settings.text_classes);\n\n // Which editor edits it, first in its settings: something to\n // know about it, not something to do with it\n var general = dom.child(details, '.ge-details-general');\n var editor = dom.element('div', { 'class': 'ge-field ge-text-editor' });\n editor.appendChild(dom.element('span', { 'class': 'ge-field-label' }, ge.t('panel.editor')));\n editor.appendChild(dom.element('span', { 'class': 'ge-field-value' }, textLabel(type)));\n general.insertBefore(editor, general.firstChild);\n\n settings.text_tools.forEach(function(hostTool) {\n ge.createTool(drawer, hostTool.title || '', hostTool.className || '',\n hostTool.iconClass || 'bi bi-wrench', hostTool.on);\n });\n\n ge.createTool(drawer, ge.t('tool.delete_text'), 'ge-delete-text', 'bi bi-trash', function() {\n ge.deleteNode('text', block, ge.t('confirm.delete_text'), function(removed) {\n // Its editor lets go first: removed while open, it would\n // be left behind, attached to nothing\n closeText(block);\n dom.slideUp(textBlock, function() {\n textBlock.remove();\n removed();\n });\n });\n });\n }\n\n /** A drawer for each text of ours in a text block that has none yet. */\n function markTexts() {\n dom.all(ge.canvas, '.ge-text-block').forEach(function(textBlock) {\n if (dom.child(textBlock, '.ge-tools-drawer')) { return; }\n\n var block = dom.child(textBlock, '.ge-content');\n if (!block || !isOurs(block)) { return; }\n\n createTextControls(textBlock);\n });\n }\n\n var texts = offeredTexts();\n var clicks = null; // The delegated click listener, while editing\n\n return {\n methods: {\n createText: apiCreateText,\n },\n\n /**\n * The types this plugin edits, for the core: every editor loaded\n * is the owner of its texts, and the ones offered are what the\n * host's plain content can be made.\n */\n textTypes: function() {\n var offered = offeredTexts();\n var others = Object.keys(TEXTS).filter(function(type) { return offered.indexOf(type) === -1; });\n\n return offered.concat(others).map(function(type) {\n var text = TEXTS[type];\n\n return {\n type: type,\n label: textLabel(type),\n offered: offered.indexOf(type) !== -1,\n available: text.available ? function() { return text.available(); } : null,\n missingKey: text.missingKey,\n edit: function(block) {\n var textBlock = block.parentElement;\n if (dom.hasClass(textBlock, 'ge-text-block') && !dom.child(textBlock, '.ge-tools-drawer')) {\n createTextControls(textBlock);\n }\n\n startText(block);\n },\n };\n });\n },\n\n // A text block of each editor offered. Like a container, it goes\n // into a row of its own when clicked, or where it is dropped\n toolbar: texts.map(function(type) {\n return {\n label: function() {\n return texts.length > 1 ? ge.t('text.add_type', { editor: textLabel(type) }) : ge.t('text.add');\n },\n iconClass: TEXTS[type].iconClass,\n className: 'ge-add-text-button',\n kind: 'text',\n group: 'content',\n inColumn: true,\n create: function() { return makeText(type); },\n };\n }),\n\n onInit: function() {\n markTexts();\n\n if (clicks) { ge.canvas.removeEventListener('click', clicks); }\n clicks = dom.delegate(ge.canvas, 'click', '.ge-content', onClick);\n },\n\n // While the drawers and the text blocks are still there, as the\n // editors left them\n onBeforeDeinit: function() {\n dom.all(ge.canvas, '.ge-content').forEach(function(block) {\n if (isOurs(block)) { closeText(block); }\n });\n },\n\n onDeinit: function() {\n if (clicks) { ge.canvas.removeEventListener('click', clicks); }\n clicks = null;\n },\n\n // The first time only: an undo says ready again, and by then the\n // host may have changed the content area itself\n onContentReady: function(area) {\n if (readBefore.has(area) && !readReady.has(area)) {\n readReady.set(area, attributesOf(area));\n }\n },\n };\n }\n\n // Whatever the plugins setting says: content_types chooses the editors\n textFeature.always = true;\n\n GridEditor.features.text = textFeature;\n\n}\n", "/**\n * Summernote for grid-editor's content areas.\n *\n * A text editor plugin: load this file after the editor, and summernote\n * after or before it, and a text of the summernote type is edited with\n * summernote in air mode. What it can ask the editor for is the\n * handle its factory is called with, described in docs/plugins.md.\n *\n * <script src=\"jquery/jquery.min.js\"></script>\n * <script src=\"summernote/summernote-bs5.min.js\"></script>\n * <script src=\"dist/grideditor.min.js\"></script>\n * <script src=\"dist/plugins/grideditor.summernote.min.js\"></script>\n *\n * Summernote is a jQuery plugin, so this is the one plugin that needs jQuery\n * on the page: it calls summernote on a content area through it, and\n * nothing else. Towards the editor it is plain DOM, like every plugin, and\n * it needs no jQuery adapter.\n *\n * It imports what every text editor shares - text blocks, the Text button,\n * createText, making the host's plain content a text - from\n * src/js/text/grideditor.text.js, which the build puts in its classic\n * script, installed once however many editors a page loads.\n */\nimport { GridEditor } from '../grideditor.js';\nimport * as dom from '../dom.js';\nimport '../text/grideditor.text.js';\n\nObject.assign(GridEditor.locales.en, {\n 'text.summernote': 'Summernote',\n});\n\nvar INITIAL_CONTENT = '<p>Lorem ipsum dolores</p>';\n\nfunction isPlainObject(value) {\n return !!value && Object.prototype.toString.call(value) === '[object Object]';\n}\n\n/**\n * `sources` merged into `target`, objects and arrays copied all the way\n * down rather than shared: what jQuery's deep extend did for summernote's\n * options, whose callbacks the host's config and this file both fill in.\n */\nfunction deepMerge(target) {\n Array.prototype.slice.call(arguments, 1).forEach(function(source) {\n Object.keys(source || {}).forEach(function(key) {\n var value = source[key];\n\n if (value === undefined || value === target) { return; }\n\n if (Array.isArray(value)) {\n target[key] = deepMerge(Array.isArray(target[key]) ? target[key] : [], value);\n } else if (isPlainObject(value)) {\n target[key] = deepMerge(isPlainObject(target[key]) ? target[key] : {}, value);\n } else {\n target[key] = value;\n }\n });\n });\n\n return target;\n}\n\nGridEditor.texts.summernote = function(ge) {\n return {\n labelKey: 'text.summernote',\n initialContent: INITIAL_CONTENT,\n missingKey: 'error.summernote_missing',\n\n available: function() { return !!(window.jQuery && window.jQuery.fn && window.jQuery.fn.summernote); },\n\n start: function(contentAreas) {\n var settings = ge.settings;\n var $ = window.jQuery;\n\n // Summernote 0.9.1 calls $.now(), which jQuery 4 removed, and\n // cannot open without it. Given back only where it is missing,\n // and only once summernote is actually used.\n if (!$.now) { $.now = Date.now; }\n\n contentAreas.forEach(function(contentArea) {\n if (dom.hasClass(contentArea, 'active')) { return; }\n\n if (contentArea.innerHTML == INITIAL_CONTENT) {\n contentArea.innerHTML = '';\n }\n dom.addClass(contentArea, 'active');\n\n var configuration = deepMerge(\n {},\n (settings.summernote && settings.summernote.config ? settings.summernote.config : {}),\n {\n tabsize: 2,\n airMode: true,\n // Focus editor on creation\n callbacks: {\n onInit: function() {\n\n // Call original oninit function, if one was passed in the config\n var callback;\n try {\n callback = settings.summernote.config.callbacks.onInit;\n } catch (err) {\n // No callback passed\n }\n if (callback) {\n callback.call(this);\n }\n\n // The editor owns what is inside the\n // content area now, so the grid editor is\n // told to put its own furniture back\n ge.textReady(contentArea);\n\n $(contentArea).summernote('focus');\n }\n }\n }\n );\n $(contentArea).summernote(configuration);\n });\n },\n\n stop: function(contentAreas) {\n var $ = window.jQuery;\n\n contentAreas.filter(function(contentArea) {\n return dom.hasClass(contentArea, 'active');\n }).forEach(function(contentArea) {\n if ($ && $.fn.summernote) { $(contentArea).summernote('destroy'); }\n\n dom.removeClass(contentArea, 'active');\n ['id', 'style', 'spellcheck'].forEach(function(name) {\n contentArea.removeAttribute(name);\n });\n });\n },\n };\n};\n"],
|
|
5
|
+
"mappings": "MASA,IAAIA,EAAa,OAAO,WAExB,GAAI,CAACA,GAAc,OAAOA,EAAW,KAAQ,WACzC,MAAM,IAAI,MAAM,wHAC0B,ECCvC,SAASC,EAAIC,EAAMC,EAAU,CAChC,OAAOD,EAAO,MAAM,UAAU,MAAM,KAAKA,EAAK,iBAAiBC,CAAQ,CAAC,EAAI,CAAC,CACjF,CAiBO,SAASC,EAASC,EAAMC,EAAU,CACrC,OAAKD,EAEE,MAAM,UAAU,OAAO,KAAKA,EAAK,SAAU,SAASE,EAAM,CAC7D,MAAO,CAACD,GAAYC,EAAK,QAAQD,CAAQ,CAC7C,CAAC,EAJmB,CAAC,CAKzB,CAGO,SAASE,EAAMH,EAAMC,EAAU,CAClC,OAAOF,EAASC,EAAMC,CAAQ,EAAE,CAAC,GAAK,IAC1C,CAGO,SAASG,EAAQJ,EAAMC,EAAUI,EAAQ,CAC5C,IAAIC,EAAQN,GAAQA,EAAK,WAAa,EAAIA,EAAK,QAAQC,CAAQ,EAAI,KAEnE,OAAIK,GAASD,GAAUC,IAAUD,GAAU,CAACA,EAAO,SAASC,CAAK,EAAY,KACtEA,CACX,CAqDO,SAASC,EAAQC,EAAKC,EAAYC,EAAM,CAC3C,IAAIC,EAAO,SAAS,cAAcH,CAAG,EAErC,cAAO,KAAKC,GAAc,CAAC,CAAC,EAAE,QAAQ,SAASG,EAAM,CACjD,IAAIC,EAAQJ,EAAWG,CAAI,EACvBC,GAAU,MAA+BA,IAAU,IAASF,EAAK,aAAaC,EAAMC,CAAK,CACjG,CAAC,EACyBH,GAAS,OAAQC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OAAO,QAAU,OAAO,OAAO,IAAM,OAAO,OAAO,GAAG,WAAa,EAErG,MAAO,SAASQ,EAAc,CAC1B,IAAIC,EAAWF,EAAG,SACdG,EAAI,OAAO,OAKVA,EAAE,MAAOA,EAAE,IAAM,KAAK,KAE3BF,EAAa,QAAQ,SAASG,EAAa,CACvC,GAAI,CAAIC,EAASD,EAAa,QAAQ,EAEtC,CAAIA,EAAY,WAAaX,IACzBW,EAAY,UAAY,IAExBE,EAASF,EAAa,QAAQ,EAElC,IAAIG,EAAgBX,EAChB,CAAC,EACAM,EAAS,YAAcA,EAAS,WAAW,OAASA,EAAS,WAAW,OAAS,CAAC,EACnF,CACI,QAAS,EACT,QAAS,GAET,UAAW,CACP,OAAQ,UAAW,CAGf,IAAIM,EACJ,GAAI,CACAA,EAAWN,EAAS,WAAW,OAAO,UAAU,MACpD,OAASO,EAAK,CAEd,CACID,GACAA,EAAS,KAAK,IAAI,EAMtBR,EAAG,UAAUI,CAAW,EAExBD,EAAEC,CAAW,EAAE,WAAW,OAAO,CACrC,CACJ,CACJ,CACJ,EACAD,EAAEC,CAAW,EAAE,WAAWG,CAAa,EAC3C,CAAC,CACL,EAEA,KAAM,SAASN,EAAc,CACzB,IAAIE,EAAI,OAAO,OAEfF,EAAa,OAAO,SAASG,EAAa,CACtC,OAAWC,EAASD,EAAa,QAAQ,CAC7C,CAAC,EAAE,QAAQ,SAASA,EAAa,CACzBD,GAAKA,EAAE,GAAG,YAAcA,EAAEC,CAAW,EAAE,WAAW,SAAS,EAE3DM,EAAYN,EAAa,QAAQ,EACrC,CAAC,KAAM,QAAS,YAAY,EAAE,QAAQ,SAASO,EAAM,CACjDP,EAAY,gBAAgBO,CAAI,CACpC,CAAC,CACL,CAAC,CACL,CACJ,CACJ",
|
|
6
6
|
"names": ["GridEditor", "all", "root", "selector", "children", "node", "selector", "each", "child", "closest", "stopAt", "found", "element", "tag", "attributes", "text", "node", "name", "value", "setHtml", "html", "addClass", "names", "split", "removeClass", "hasClass", "node", "name", "split", "names", "hide", "node", "visible", "node", "delegate", "root", "types", "selector", "handler", "options", "listener", "event", "match", "closest", "split", "type", "DEFAULT_DURATION", "animateAway", "node", "frames", "duration", "done", "finish", "hide", "visible", "animation", "called", "once", "slideUp", "style", "GridEditor", "attributesOf", "element", "found", "attribute", "classesIn", "value", "name", "EDITOR_CLASS", "restoreAttributes", "block", "before", "ready", "open", "result", "EDITOR_ATTRIBUTE", "readyClasses", "openClasses", "classes", "textFeature", "ge", "settings", "TEXTS", "warned", "type", "offeredTexts", "textLabel", "text", "makeText", "content", "setHtml", "apiCreateText", "options", "isOurs", "startText", "hasClass", "visible", "readBefore", "readReady", "addClass", "onClick", "closeText", "removeClass", "createTextControls", "textBlock", "child", "drawer", "details", "general", "editor", "hostTool", "removed", "slideUp", "markTexts", "all", "texts", "clicks", "offered", "others", "delegate", "area", "GridEditor", "INITIAL_CONTENT", "isPlainObject", "value", "deepMerge", "target", "source", "key", "ge", "contentAreas", "settings", "$", "contentArea", "hasClass", "addClass", "configuration", "callback", "err", "removeClass", "name"]
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{var p=window.GridEditor;if(!p||typeof p.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");function k(e,r){return e?Array.prototype.slice.call(e.querySelectorAll(r)):[]}function J(e,r){return e?Array.prototype.filter.call(e.children,function(o){return!r||o.matches(r)}):[]}function b(e,r){return J(e,r)[0]||null}function Q(e,r,o){var u=e&&e.nodeType===1?e.closest(r):null;return u&&o&&u!==o&&!o.contains(u)?null:u}function w(e,r,o){var u=document.createElement(e);return Object.keys(r||{}).forEach(function(n){var s=r[n];s!=null&&s!==!1&&u.setAttribute(n,s)}),o!=null&&(u.textContent=o),u}function q(e,r){return e.innerHTML=r==null?"":String(r),e}function _(e,r){return S(r).forEach(function(o){e.classList.add(o)}),e}function A(e,r){return S(r).forEach(function(o){e.classList.remove(o)}),e}function E(e,r){return!!e&&e.nodeType===1&&e.classList.contains(r)}function S(e){return String(e||"").split(/\s+/).filter(Boolean)}function V(e){return e.style.display="none",e}function N(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function B(e,r,o,u,n){var s=function(i){var f=Q(i.target,o,e);if(f&&e.contains(f))return u.call(f,i)};return S(r).forEach(function(i){e.addEventListener(i,s,n)}),s}var Z=400;function R(e,r,o,u){o=o===void 0?Z:o;var n=function(){V(e),u&&u()};if(!N(e)||!e.animate||o<=0){window.setTimeout(n,0);return}var s=e.animate(r(getComputedStyle(e)),{duration:o,easing:"ease-in-out"}),i=!1,f=function(){i||(i=!0,n())};s.onfinish=f,s.oncancel=f}function G(e,r,o){typeof r=="function"&&(o=r,r=void 0),e.style.overflow="hidden",R(e,function(u){return[{height:u.height,paddingTop:u.paddingTop,paddingBottom:u.paddingBottom,marginTop:u.marginTop,marginBottom:u.marginBottom},{height:"0px",paddingTop:"0px",paddingBottom:"0px",marginTop:"0px",marginBottom:"0px"}]},r,function(){e.style.removeProperty("overflow"),o&&o()})}if(!p.features.text){let e=function(n){var s={};return Array.prototype.slice.call(n.attributes).forEach(function(i){s[i.name]=i.value}),s},r=function(n){return(n||"").split(/\s+/).filter(function(s){return s!==""&&!$.test(s)})},o=function(n,s,i,f){var m=Object.assign({},s);Object.keys(Object.assign({},i,f)).forEach(function(l){l==="class"||D.test(l)||i[l]===f[l]||(f[l]===void 0?delete m[l]:m[l]=f[l])});var v=r(i.class),T=r(f.class),x=r(s.class).filter(function(l){return T.indexOf(l)!==-1||v.indexOf(l)===-1});T.forEach(function(l){v.indexOf(l)===-1&&x.indexOf(l)===-1&&x.push(l)}),x.length?m.class=x.join(" "):delete m.class,Object.keys(e(n)).forEach(function(l){n.removeAttribute(l)}),Object.keys(m).forEach(function(l){n.setAttribute(l,m[l])})},u=function(n){var s=n.settings,i={},f={};Object.keys(p.texts).forEach(function(t){i[t]=p.texts[t](n)}),Array.isArray(s.content_types)||(s.content_types=Object.keys(i)),Array.isArray(s.text_tools)||(s.text_tools=[]),Array.isArray(s.text_classes)||(s.text_classes=[]);function m(){return s.content_types.filter(function(t){return!!i[t]})}function v(t){var a=i[t];return a&&a.labelKey?n.t(a.labelKey):t}function T(t,a){var c=i[t],d=w("div",{class:"ge-content ge-content-type-"+t,"data-ge-content-type":t});return a&&a.nodeType?d.appendChild(a):q(d,a!==void 0?a:c&&c.initialContent||""),d}function x(t,a){return t&&typeof t=="object"&&(a=t,t=void 0),a=a||{},t=t||m()[0],!t||!i[t]?(f["createText:"+t]||(f["createText:"+t]=!0,n.warn('createText: no text editor "'+t+'" is loaded; load its plugin and name it in content_types')),null):n.place(T(t,a.content),"text",a)}function l(t){return!!i[t.getAttribute("data-ge-content-type")]}function K(t){if(!E(t,"ge-rte-active")&&N(t)){var a=i[t.getAttribute("data-ge-content-type")];if(a){if(a.available&&!a.available()){a.missingKey&&console.error(n.t(a.missingKey));return}O.set(t,e(t)),C.delete(t),_(t,"ge-rte-active"),a.start([t])}}}function z(){K(this)}function F(t){var a=i[t.getAttribute("data-ge-content-type")],c=O.get(t),d=c?e(t):null;a&&a.stop([t]),A(t,"ge-rte-active"),c&&(o(t,c,C.get(t)||c,d),O.delete(t),C.delete(t))}function U(t){var a=b(t,".ge-content"),c=a.getAttribute("data-ge-content-type"),d=w("div",{class:"ge-tools-drawer ge-text-drawer"});t.insertBefore(d,t.firstChild),n.createMoveTool(d);var j=n.addSettingsTool(d,a,s.text_classes),h=b(j,".ge-details-general"),L=w("div",{class:"ge-field ge-text-editor"});L.appendChild(w("span",{class:"ge-field-label"},n.t("panel.editor"))),L.appendChild(w("span",{class:"ge-field-value"},v(c))),h.insertBefore(L,h.firstChild),s.text_tools.forEach(function(y){n.createTool(d,y.title||"",y.className||"",y.iconClass||"bi bi-wrench",y.on)}),n.createTool(d,n.t("tool.delete_text"),"ge-delete-text","bi bi-trash",function(){n.deleteNode("text",a,n.t("confirm.delete_text"),function(y){F(a),G(t,function(){t.remove(),y()})})})}function Y(){k(n.canvas,".ge-text-block").forEach(function(t){if(!b(t,".ge-tools-drawer")){var a=b(t,".ge-content");!a||!l(a)||U(t)}})}var W=m(),g=null;return{methods:{createText:x},textTypes:function(){var t=m(),a=Object.keys(i).filter(function(c){return t.indexOf(c)===-1});return t.concat(a).map(function(c){var d=i[c];return{type:c,label:v(c),offered:t.indexOf(c)!==-1,available:d.available?function(){return d.available()}:null,missingKey:d.missingKey,edit:function(j){var h=j.parentElement;E(h,"ge-text-block")&&!b(h,".ge-tools-drawer")&&U(h),K(j)}}})},toolbar:W.map(function(t){return{label:function(){return W.length>1?n.t("text.add_type",{editor:v(t)}):n.t("text.add")},iconClass:i[t].iconClass,className:"ge-add-text-button",kind:"text",inColumn:!0,create:function(){return T(t)}}}),onInit:function(){Y(),g&&n.canvas.removeEventListener("click",g),g=B(n.canvas,"click",".ge-content",z)},onBeforeDeinit:function(){k(n.canvas,".ge-content").forEach(function(t){l(t)&&F(t)})},onDeinit:function(){g&&n.canvas.removeEventListener("click",g),g=null},onContentReady:function(t){O.has(t)&&!C.has(t)&&C.set(t,e(t))}}};Object.assign(p.locales.en,{"text.add":"Text","text.add_type":"Text ({editor})","panel.editor":"Editor","panel.kind_text":"Text"}),O=new WeakMap,C=new WeakMap,$=/^(mce-|cke|ck-|note-)|^(ck|active|ge-rte-active)$/,D=/^(data-mce-|contenteditable$|spellcheck$)/,u.always=!0,p.features.text=u}var O,C,$,D;Object.assign(p.locales.en,{"text.tinymce":"tinyMCE"});function I(e){A(e,"active ge-rte-active"),["id","style","spellcheck","contenteditable","data-mce-style"].forEach(function(r){e.removeAttribute(r)})}var X="<p>Lorem ipsum dolores</p>",H=new WeakMap,M=new WeakSet;p.texts.tinymce=function(e){return{labelKey:"text.tinymce",initialContent:X,missingKey:"error.tinymce_missing",available:function(){return!!window.tinymce},start:function(r){var o=e.settings,u=o.tinymce&&o.tinymce.config?o.tinymce.config:{};r.forEach(function(n){if(!E(n,"active")){n.innerHTML==X&&(n.innerHTML=""),_(n,"active");var s=Object.assign({promotion:!1},u,{target:n,inline:!0,init_instance_callback:function(i){if(M.has(n)){M.delete(n),i.remove(),I(n);return}H.set(n,i),e.textReady(n),i.on("Undo Redo",function(){e.textReady(n)}),window.requestAnimationFrame(function(){i.removed||!i.ui||!i.ui.show||i.ui.show()}),i.on("focus",function(){window.requestAnimationFrame(function(){i.removed||!i.ui||!i.ui.show||i.ui.show()})}),i.focus(),u.init_instance_callback&&u.init_instance_callback.call(this,i)}});delete s.selector,window.tinymce.init(s)}})},stop:function(r){r.filter(function(o){return E(o,"active")}).forEach(function(o){var u=H.get(o);u?(H.delete(o),u.remove()):M.add(o),I(o)})}}};})();
|
|
1
|
+
(()=>{var p=window.GridEditor;if(!p||typeof p.get!="function")throw new Error("grid-editor: load grideditor.js (or grideditor.bundle.min.js) before its plugins, its locales and grideditor.jquery.js");function k(e,r){return e?Array.prototype.slice.call(e.querySelectorAll(r)):[]}function J(e,r){return e?Array.prototype.filter.call(e.children,function(o){return!r||o.matches(r)}):[]}function b(e,r){return J(e,r)[0]||null}function Q(e,r,o){var u=e&&e.nodeType===1?e.closest(r):null;return u&&o&&u!==o&&!o.contains(u)?null:u}function w(e,r,o){var u=document.createElement(e);return Object.keys(r||{}).forEach(function(n){var s=r[n];s!=null&&s!==!1&&u.setAttribute(n,s)}),o!=null&&(u.textContent=o),u}function q(e,r){return e.innerHTML=r==null?"":String(r),e}function _(e,r){return S(r).forEach(function(o){e.classList.add(o)}),e}function A(e,r){return S(r).forEach(function(o){e.classList.remove(o)}),e}function E(e,r){return!!e&&e.nodeType===1&&e.classList.contains(r)}function S(e){return String(e||"").split(/\s+/).filter(Boolean)}function V(e){return e.style.display="none",e}function N(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)}function B(e,r,o,u,n){var s=function(i){var f=Q(i.target,o,e);if(f&&e.contains(f))return u.call(f,i)};return S(r).forEach(function(i){e.addEventListener(i,s,n)}),s}var Z=400;function R(e,r,o,u){o=o===void 0?Z:o;var n=function(){V(e),u&&u()};if(!N(e)||!e.animate||o<=0){window.setTimeout(n,0);return}var s=e.animate(r(getComputedStyle(e)),{duration:o,easing:"ease-in-out"}),i=!1,f=function(){i||(i=!0,n())};s.onfinish=f,s.oncancel=f}function G(e,r,o){typeof r=="function"&&(o=r,r=void 0),e.style.overflow="hidden",R(e,function(u){return[{height:u.height,paddingTop:u.paddingTop,paddingBottom:u.paddingBottom,marginTop:u.marginTop,marginBottom:u.marginBottom},{height:"0px",paddingTop:"0px",paddingBottom:"0px",marginTop:"0px",marginBottom:"0px"}]},r,function(){e.style.removeProperty("overflow"),o&&o()})}if(!p.features.text){let e=function(n){var s={};return Array.prototype.slice.call(n.attributes).forEach(function(i){s[i.name]=i.value}),s},r=function(n){return(n||"").split(/\s+/).filter(function(s){return s!==""&&!$.test(s)})},o=function(n,s,i,f){var m=Object.assign({},s);Object.keys(Object.assign({},i,f)).forEach(function(l){l==="class"||D.test(l)||i[l]===f[l]||(f[l]===void 0?delete m[l]:m[l]=f[l])});var v=r(i.class),T=r(f.class),x=r(s.class).filter(function(l){return T.indexOf(l)!==-1||v.indexOf(l)===-1});T.forEach(function(l){v.indexOf(l)===-1&&x.indexOf(l)===-1&&x.push(l)}),x.length?m.class=x.join(" "):delete m.class,Object.keys(e(n)).forEach(function(l){n.removeAttribute(l)}),Object.keys(m).forEach(function(l){n.setAttribute(l,m[l])})},u=function(n){var s=n.settings,i={},f={};Object.keys(p.texts).forEach(function(t){i[t]=p.texts[t](n)}),Array.isArray(s.content_types)||(s.content_types=Object.keys(i)),Array.isArray(s.text_tools)||(s.text_tools=[]),Array.isArray(s.text_classes)||(s.text_classes=[]);function m(){return s.content_types.filter(function(t){return!!i[t]})}function v(t){var a=i[t];return a&&a.labelKey?n.t(a.labelKey):t}function T(t,a){var c=i[t],d=w("div",{class:"ge-content ge-content-type-"+t,"data-ge-content-type":t});return a&&a.nodeType?d.appendChild(a):q(d,a!==void 0?a:c&&c.initialContent||""),d}function x(t,a){return t&&typeof t=="object"&&(a=t,t=void 0),a=a||{},t=t||m()[0],!t||!i[t]?(f["createText:"+t]||(f["createText:"+t]=!0,n.warn('createText: no text editor "'+t+'" is loaded; load its plugin and name it in content_types')),null):n.place(T(t,a.content),"text",a)}function l(t){return!!i[t.getAttribute("data-ge-content-type")]}function K(t){if(!E(t,"ge-rte-active")&&N(t)){var a=i[t.getAttribute("data-ge-content-type")];if(a){if(a.available&&!a.available()){a.missingKey&&console.error(n.t(a.missingKey));return}O.set(t,e(t)),C.delete(t),_(t,"ge-rte-active"),a.start([t])}}}function z(){K(this)}function F(t){var a=i[t.getAttribute("data-ge-content-type")],c=O.get(t),d=c?e(t):null;a&&a.stop([t]),A(t,"ge-rte-active"),c&&(o(t,c,C.get(t)||c,d),O.delete(t),C.delete(t))}function U(t){var a=b(t,".ge-content"),c=a.getAttribute("data-ge-content-type"),d=w("div",{class:"ge-tools-drawer ge-text-drawer"});t.insertBefore(d,t.firstChild),n.createMoveTool(d);var j=n.addSettingsTool(d,a,s.text_classes),h=b(j,".ge-details-general"),L=w("div",{class:"ge-field ge-text-editor"});L.appendChild(w("span",{class:"ge-field-label"},n.t("panel.editor"))),L.appendChild(w("span",{class:"ge-field-value"},v(c))),h.insertBefore(L,h.firstChild),s.text_tools.forEach(function(y){n.createTool(d,y.title||"",y.className||"",y.iconClass||"bi bi-wrench",y.on)}),n.createTool(d,n.t("tool.delete_text"),"ge-delete-text","bi bi-trash",function(){n.deleteNode("text",a,n.t("confirm.delete_text"),function(y){F(a),G(t,function(){t.remove(),y()})})})}function Y(){k(n.canvas,".ge-text-block").forEach(function(t){if(!b(t,".ge-tools-drawer")){var a=b(t,".ge-content");!a||!l(a)||U(t)}})}var W=m(),g=null;return{methods:{createText:x},textTypes:function(){var t=m(),a=Object.keys(i).filter(function(c){return t.indexOf(c)===-1});return t.concat(a).map(function(c){var d=i[c];return{type:c,label:v(c),offered:t.indexOf(c)!==-1,available:d.available?function(){return d.available()}:null,missingKey:d.missingKey,edit:function(j){var h=j.parentElement;E(h,"ge-text-block")&&!b(h,".ge-tools-drawer")&&U(h),K(j)}}})},toolbar:W.map(function(t){return{label:function(){return W.length>1?n.t("text.add_type",{editor:v(t)}):n.t("text.add")},iconClass:i[t].iconClass,className:"ge-add-text-button",kind:"text",group:"content",inColumn:!0,create:function(){return T(t)}}}),onInit:function(){Y(),g&&n.canvas.removeEventListener("click",g),g=B(n.canvas,"click",".ge-content",z)},onBeforeDeinit:function(){k(n.canvas,".ge-content").forEach(function(t){l(t)&&F(t)})},onDeinit:function(){g&&n.canvas.removeEventListener("click",g),g=null},onContentReady:function(t){O.has(t)&&!C.has(t)&&C.set(t,e(t))}}};Object.assign(p.locales.en,{"text.add":"Text","text.add_type":"Text ({editor})","panel.editor":"Editor","panel.kind_text":"Text"}),O=new WeakMap,C=new WeakMap,$=/^(mce-|cke|ck-|note-)|^(ck|active|ge-rte-active)$/,D=/^(data-mce-|contenteditable$|spellcheck$)/,u.always=!0,p.features.text=u}var O,C,$,D;Object.assign(p.locales.en,{"text.tinymce":"tinyMCE"});function I(e){A(e,"active ge-rte-active"),["id","style","spellcheck","contenteditable","data-mce-style"].forEach(function(r){e.removeAttribute(r)})}var X="<p>Lorem ipsum dolores</p>",H=new WeakMap,M=new WeakSet;p.texts.tinymce=function(e){return{labelKey:"text.tinymce",initialContent:X,missingKey:"error.tinymce_missing",available:function(){return!!window.tinymce},start:function(r){var o=e.settings,u=o.tinymce&&o.tinymce.config?o.tinymce.config:{};r.forEach(function(n){if(!E(n,"active")){n.innerHTML==X&&(n.innerHTML=""),_(n,"active");var s=Object.assign({promotion:!1},u,{target:n,inline:!0,init_instance_callback:function(i){if(M.has(n)){M.delete(n),i.remove(),I(n);return}H.set(n,i),e.textReady(n),i.on("Undo Redo",function(){e.textReady(n)}),window.requestAnimationFrame(function(){i.removed||!i.ui||!i.ui.show||i.ui.show()}),i.on("focus",function(){window.requestAnimationFrame(function(){i.removed||!i.ui||!i.ui.show||i.ui.show()})}),i.focus(),u.init_instance_callback&&u.init_instance_callback.call(this,i)}});delete s.selector,window.tinymce.init(s)}})},stop:function(r){r.filter(function(o){return E(o,"active")}).forEach(function(o){var u=H.get(o);u?(H.delete(o),u.remove()):M.add(o),I(o)})}}};})();
|