@themarioga/grid-editor 9.2.6 → 9.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 +57 -0
- package/README.md +109 -5
- package/dist/grideditor.bundle.min.js +2 -2
- package/dist/grideditor.css +329 -0
- package/dist/grideditor.d.ts +125 -0
- package/dist/grideditor.esm.js +27 -5
- package/dist/grideditor.js +27 -5
- package/dist/grideditor.min.css +1 -1
- package/dist/grideditor.min.css.map +1 -1
- package/dist/grideditor.min.js +1 -1
- package/dist/grideditor.min.js.map +3 -3
- package/dist/locales/grideditor.es.esm.js +125 -0
- package/dist/locales/grideditor.es.js +125 -0
- package/dist/locales/grideditor.es.min.js +1 -1
- package/dist/locales/grideditor.es.min.js.map +2 -2
- package/dist/plugins/grideditor.dropdown.esm.js +2231 -0
- package/dist/plugins/grideditor.dropdown.js +2232 -0
- package/dist/plugins/grideditor.dropdown.min.js +1 -0
- package/dist/plugins/grideditor.dropdown.min.js.map +7 -0
- package/dist/plugins/grideditor.navbar.esm.js +2188 -0
- package/dist/plugins/grideditor.navbar.js +2189 -0
- package/dist/plugins/grideditor.navbar.min.js +1 -0
- package/dist/plugins/grideditor.navbar.min.js.map +7 -0
- package/dist/plugins/grideditor.sidenav.esm.js +2082 -0
- package/dist/plugins/grideditor.sidenav.js +2083 -0
- package/dist/plugins/grideditor.sidenav.min.js +1 -0
- package/dist/plugins/grideditor.sidenav.min.js.map +7 -0
- package/docs/events.md +5 -1
- package/docs/locale-keys.md +126 -1
- package/docs/plugins.md +24 -4
- package/example/containers.html +93 -2
- package/example/index.html +1 -1
- package/example/playground.html +3 -0
- package/package.json +1 -1
- package/src/js/grideditor.js +36 -4
- package/src/js/locales/grideditor.es.js +125 -0
- package/src/js/nav/browse.js +51 -0
- package/src/js/nav/canvas.js +170 -0
- package/src/js/nav/convert.js +179 -0
- package/src/js/nav/drawers.js +290 -0
- package/src/js/nav/dropdown.js +253 -0
- package/src/js/nav/feature.js +113 -0
- package/src/js/nav/locale.js +128 -0
- package/src/js/nav/markup.js +121 -0
- package/src/js/nav/panels.js +454 -0
- package/src/js/nav/pieces.js +253 -0
- package/src/js/plugins/grideditor.dropdown.js +335 -0
- package/src/js/plugins/grideditor.navbar.js +454 -0
- package/src/js/plugins/grideditor.sidenav.js +349 -0
- package/src/less/grideditor.less +231 -0
- package/types/grideditor.d.ts +125 -0
package/docs/locale-keys.md
CHANGED
|
@@ -105,7 +105,7 @@ title. `{kind}` is one of the `panel.kind_*` keys, or a container's own label.
|
|
|
105
105
|
container.*
|
|
106
106
|
-----------
|
|
107
107
|
|
|
108
|
-
The containers: tabs, accordions, popups, offcanvases, carousels and
|
|
108
|
+
The containers: tabs, accordions, popups, offcanvases, carousels, cards, navbars, sidebars and dropdowns, and the panes and pieces inside them.
|
|
109
109
|
|
|
110
110
|
| Key | English | Where |
|
|
111
111
|
| --- | --- | --- |
|
|
@@ -178,6 +178,131 @@ The containers: tabs, accordions, popups, offcanvases, carousels and cards, and
|
|
|
178
178
|
| `container.add_card` | Card | Toolbar button that adds a card |
|
|
179
179
|
| `container.card_title` | Card title | Title of a new card, in its header |
|
|
180
180
|
| `container.card_footer` | Card footer | Text of a new card's footer, when it has one |
|
|
181
|
+
| `container.add_navbar` | Navbar | Toolbar button that adds a navbar |
|
|
182
|
+
| `container.add_sidenav` | Sidebar | Toolbar button that adds a sidebar. The container is `sidenav`: `sidebar` is the settings panel's |
|
|
183
|
+
| `container.navbar_brand` | Brand | Text of a new navbar's brand |
|
|
184
|
+
| `container.sidenav_brand` | Brand | Text of a new sidebar's brand |
|
|
185
|
+
| `container.nav_link` | Link | Text of a new link, and what an emptied link goes back to |
|
|
186
|
+
| `container.nav_dropdown` | Dropdown | Text of a new dropdown, and what an emptied one goes back to. Also its choice in the add menu of a navbar's list |
|
|
187
|
+
| `container.nav_submenu` | Submenu | Text of a new collapsible submenu. Also its choice in the add menu of a sidebar's list |
|
|
188
|
+
| `container.nav_menu_link` | Action | Text of a new link in a menu, and its choice in the add menu of a dropdown |
|
|
189
|
+
| `container.nav_menu_header` | Header | Text of a new header in a menu, and its choice in the add menu of a dropdown |
|
|
190
|
+
| `container.nav_text` | Text | Text of a new text, and its choice in the add menu of a container or a dropdown |
|
|
191
|
+
| `container.navbar_toggle` | Toggle navigation | `aria-label` of a navbar's toggler, written in the interface's language when the navbar is made |
|
|
192
|
+
| `container.navbar_offcanvas_title` | Menu | Title of the header of a navbar that folds into an offcanvas |
|
|
193
|
+
| `container.sidenav_trigger` | Menu | Text of the button that opens a responsive sidebar |
|
|
194
|
+
| `tool.add_nav_piece` | Add… | Container drawer, the tool that adds a list, a text or a free zone |
|
|
195
|
+
| `tool.add_nav_link` | Add link or dropdown | List drawer, the tool that adds a link or a dropdown |
|
|
196
|
+
| `tool.add_nav_menu_item` | Add item | Dropdown drawer, the tool that adds a link, a divider, a header or a text |
|
|
197
|
+
| `tool.fold_nav_menu` | Fold this menu while editing | Dropdown drawer. Editing shows a menu open, and this folds it away |
|
|
198
|
+
| `confirm.delete_nav_piece` | Delete this and everything in it? | Asked before a piece of a navbar or a sidebar is deleted |
|
|
199
|
+
| `container.navbar_section` | Navbar | Heading of a navbar's section of its settings panel |
|
|
200
|
+
| `container.sidenav_section` | Sidebar | Heading of a sidebar's section of its settings panel |
|
|
201
|
+
| `container.nav_brand_show` | Brand | Its checkbox for having a brand |
|
|
202
|
+
| `container.nav_brand_image` | Image | Brand's field for the image's src |
|
|
203
|
+
| `container.nav_brand_alt` | Alt text | Brand's field for the image's alt |
|
|
204
|
+
| `container.nav_brand_height` | Height (px) | Brand's field for the image's height, in pixels |
|
|
205
|
+
| `container.navbar_expand` | Expand | Its select for the breakpoint from which the navbar is expanded |
|
|
206
|
+
| `container.navbar_expand_never` | Never | Expand: never, it is always folded |
|
|
207
|
+
| `container.navbar_expand_always` | Always | Expand: always, it is never folded |
|
|
208
|
+
| `container.navbar_expand_from` | From {breakpoint} | Expand: from that breakpoint up. `{breakpoint}` is `sm`, `md`… |
|
|
209
|
+
| `container.navbar_collapse` | Collapse | Its select for how the navbar folds |
|
|
210
|
+
| `container.navbar_collapse_collapse` | Collapse | Collapse: a collapse Bootstrap opens under the brand |
|
|
211
|
+
| `container.navbar_collapse_offcanvas` | Offcanvas | Collapse: an offcanvas that slides in |
|
|
212
|
+
| `container.navbar_collapse_none` | Not collapsed | Collapse: it does not fold, and has no toggler |
|
|
213
|
+
| `container.navbar_offcanvas_placement` | Side | Its select for the edge the offcanvas comes from |
|
|
214
|
+
| `container.nav_start` | Start | Side: the left in a left to right page |
|
|
215
|
+
| `container.nav_end` | End | Side: the right in a left to right page |
|
|
216
|
+
| `container.nav_bg` | Background | Its select for the background |
|
|
217
|
+
| `container.nav_bg_none` | None | Background: none |
|
|
218
|
+
| `container.nav_bg_body_tertiary` | Light grey | Background: `bg-body-tertiary` |
|
|
219
|
+
| `container.nav_bg_body` | Page | Background: `bg-body` |
|
|
220
|
+
| `container.nav_bg_primary` | Primary | Background: `bg-primary` |
|
|
221
|
+
| `container.nav_bg_secondary` | Secondary | Background: `bg-secondary` |
|
|
222
|
+
| `container.nav_bg_success` | Success | Background: `bg-success` |
|
|
223
|
+
| `container.nav_bg_danger` | Danger | Background: `bg-danger` |
|
|
224
|
+
| `container.nav_bg_warning` | Warning | Background: `bg-warning` |
|
|
225
|
+
| `container.nav_bg_info` | Info | Background: `bg-info` |
|
|
226
|
+
| `container.nav_bg_light` | Light | Background: `bg-light` |
|
|
227
|
+
| `container.nav_bg_dark` | Dark | Background: `bg-dark` |
|
|
228
|
+
| `container.nav_theme` | Theme | Its select for `data-bs-theme` |
|
|
229
|
+
| `container.nav_theme_auto` | Auto | Theme: the page's |
|
|
230
|
+
| `container.nav_theme_light` | Light | Theme: light |
|
|
231
|
+
| `container.nav_theme_dark` | Dark | Theme: dark |
|
|
232
|
+
| `container.navbar_position` | Position | Its select for the position |
|
|
233
|
+
| `container.navbar_position_none` | In the flow | Position: in the flow of the page |
|
|
234
|
+
| `container.navbar_position_fixed_top` | Fixed top | Position: `fixed-top` |
|
|
235
|
+
| `container.navbar_position_fixed_bottom` | Fixed bottom | Position: `fixed-bottom` |
|
|
236
|
+
| `container.navbar_position_sticky_top` | Sticky top | Position: `sticky-top` |
|
|
237
|
+
| `container.navbar_position_sticky_bottom` | Sticky bottom | Position: `sticky-bottom` |
|
|
238
|
+
| `container.navbar_width` | Inner width | Its select for the width of what is inside the navbar |
|
|
239
|
+
| `container.navbar_width_fluid` | Full | Inner width: `container-fluid` |
|
|
240
|
+
| `container.navbar_width_fixed` | Fixed | Inner width: `container` |
|
|
241
|
+
| `container.navbar_width_from` | Full up to {breakpoint} | Inner width: `container-{bp}`. `{breakpoint}` is the key |
|
|
242
|
+
| `container.sidenav_width` | Width | Its field for the width, a css length |
|
|
243
|
+
| `container.sidenav_style` | Link style | Its select for the style of the links |
|
|
244
|
+
| `container.sidenav_style_pills` | Pills | Link style: `nav-pills` |
|
|
245
|
+
| `container.sidenav_style_plain` | Plain | Link style: plain |
|
|
246
|
+
| `container.sidenav_full_height` | Full height | Its checkbox for the full height of the window |
|
|
247
|
+
| `container.sidenav_responsive` | Responsive | Its select for the breakpoint below which the sidebar is an offcanvas |
|
|
248
|
+
| `container.sidenav_responsive_never` | Always visible | Responsive: always visible |
|
|
249
|
+
| `container.sidenav_responsive_from` | Offcanvas below {breakpoint} | Responsive: an offcanvas below that breakpoint. `{breakpoint}` is `sm`, `md`… |
|
|
250
|
+
| `container.sidenav_offcanvas_title` | Menu | Title of the header of a responsive sidebar |
|
|
251
|
+
| `container.nav_close` | Close | `aria-label` of the close button of those headers |
|
|
252
|
+
| `container.nav_list_section` | List | Heading of a list's section, and what the panel calls it |
|
|
253
|
+
| `container.nav_link_section` | Link | Heading of a link's section, and what the panel calls it |
|
|
254
|
+
| `container.nav_dropdown_section` | Dropdown | Heading of a dropdown's section, and what the panel calls it |
|
|
255
|
+
| `container.nav_menu_item_section` | Item | Heading of a menu item's section, and what the panel calls it |
|
|
256
|
+
| `container.nav_text_section` | Text | Heading of a text's section, and what the panel calls it |
|
|
257
|
+
| `container.nav_zone_section` | Free zone | Heading of a free zone's section, and what the panel calls it |
|
|
258
|
+
| `container.nav_brand_section` | Brand | Heading of the brand's section, and what the panel calls it |
|
|
259
|
+
| `container.nav_align` | Alignment | Its select for where a piece sits in the navbar |
|
|
260
|
+
| `container.nav_align_after` | After the previous | Alignment: right after the previous piece |
|
|
261
|
+
| `container.nav_align_end` | At the end | Alignment: at the end (`ms-auto`) |
|
|
262
|
+
| `container.nav_align_center` | Centered | Alignment: centered (`mx-auto`) |
|
|
263
|
+
| `container.nav_scroll` | Scroll | Its checkbox for a list that scrolls |
|
|
264
|
+
| `container.nav_scroll_height` | Height | Its field for the height a list scrolls at |
|
|
265
|
+
| `container.nav_bottom` | At the bottom | Its checkbox for a piece of the sidebar at the bottom (`mt-auto`) |
|
|
266
|
+
| `container.nav_href` | URL | Its field for a link's URL |
|
|
267
|
+
| `container.nav_active` | Active | Its checkbox for the active link |
|
|
268
|
+
| `container.nav_disabled` | Disabled | Its checkbox for a disabled link |
|
|
269
|
+
| `container.nav_new_tab` | New tab | Its checkbox for opening a link in a new tab |
|
|
270
|
+
| `container.nav_menu_end` | Menu on the right | Its checkbox for a menu that opens to the right |
|
|
271
|
+
| `container.nav_submenu_type` | Type | Its select for the kind of menu a sidebar's dropdown is |
|
|
272
|
+
| `container.nav_submenu_type_collapse` | Collapsible | Type: a collapsible submenu |
|
|
273
|
+
| `container.nav_submenu_type_dropdown` | Dropdown | Type: a dropdown |
|
|
274
|
+
| `container.nav_submenu_open` | Open on load | Its checkbox for a submenu open when the page loads |
|
|
275
|
+
| `container.nav_menu_divider` | Divider | Choice in the add menu of a dropdown: a divider |
|
|
276
|
+
| `container.nav_zone` | Free zone | Choice in the add menu of a container: a free zone |
|
|
277
|
+
| `tool.add_nav_list` | Add list | Tooltip of that choice for a list |
|
|
278
|
+
| `tool.add_nav_text` | Add text | Tooltip of that choice for a text |
|
|
279
|
+
| `tool.add_nav_zone` | Add free zone | Tooltip of that choice for a free zone |
|
|
280
|
+
| `tool.unfold_nav_menu` | Unfold this menu | Dropdown drawer, the same tool once the menu is folded away |
|
|
281
|
+
| `container.nav_browse` | Browse… | Title of the button that opens the host's file browser |
|
|
282
|
+
| `tool.delete_nav_piece` | Delete | Delete tool of a piece of a navbar or a sidebar |
|
|
283
|
+
| `container.add_dropdown` | Dropdown | Toolbar button that adds a dropdown on its own |
|
|
284
|
+
| `container.dropdown_label` | Dropdown | Text of the button of a new dropdown, and what an emptied one goes back to |
|
|
285
|
+
| `container.dropdown_toggle` | Toggle Dropdown | Hidden text of the caret of a split dropdown, for screen readers, written in the interface's language when the button is made |
|
|
286
|
+
| `container.dropdown_section` | Dropdown | Heading of a dropdown's section of its settings panel |
|
|
287
|
+
| `container.dropdown_menu` | Menu | Its select: what the menu holds |
|
|
288
|
+
| `container.dropdown_menu_items` | Items | Its choice for a menu of links, dividers, headers and texts |
|
|
289
|
+
| `container.dropdown_menu_content` | Free content | Its choice for a menu of rows and columns |
|
|
290
|
+
| `container.dropdown_style` | Style | Its select for the button's Bootstrap style |
|
|
291
|
+
| `container.dropdown_outline` | Outline | Its checkbox for the outline version of the style |
|
|
292
|
+
| `container.dropdown_size` | Size | Its select for the button's size |
|
|
293
|
+
| `container.dropdown_size_sm` | Small | Its choice for `btn-sm` |
|
|
294
|
+
| `container.dropdown_size_default` | Normal | Its choice for no size class |
|
|
295
|
+
| `container.dropdown_size_lg` | Large | Its choice for `btn-lg` |
|
|
296
|
+
| `container.dropdown_direction` | Direction | Its select for the side the menu opens to |
|
|
297
|
+
| `container.dropdown_down` | Down | Its choice for `dropdown` |
|
|
298
|
+
| `container.dropdown_up` | Up | Its choice for `dropup` |
|
|
299
|
+
| `container.dropdown_end` | Right | Its choice for `dropend` |
|
|
300
|
+
| `container.dropdown_start` | Left | Its choice for `dropstart` |
|
|
301
|
+
| `container.dropdown_menu_end` | Menu on the right | Its checkbox for `dropdown-menu-end` |
|
|
302
|
+
| `container.dropdown_split` | Split button | Its checkbox for a button with an action and a caret |
|
|
303
|
+
| `container.dropdown_split_href` | Main button link | Its field for the address of the action of a split button |
|
|
304
|
+
| `container.dropdown_split_new_tab` | Open in a new tab | Its checkbox for the action of a split button |
|
|
305
|
+
| `confirm.dropdown_change_menu` | Change the menu? What it has now is removed. | Asked before a dropdown's menu is changed from items to free content, or back |
|
|
181
306
|
|
|
182
307
|
|
|
183
308
|
section.*
|
package/docs/plugins.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Writing a plugin
|
|
2
2
|
================
|
|
3
3
|
|
|
4
|
-
Tabs, accordions, popups, offcanvases, carousels, cards and the element level controls are not built
|
|
4
|
+
Tabs, accordions, popups, offcanvases, carousels, cards, navbars, sidebars, dropdowns and the element level controls are not built
|
|
5
5
|
into grid-editor: each is a file you load beside it, and loading the file is
|
|
6
6
|
what turns the feature on. `grideditor.card.js` is the shortest of them, and
|
|
7
7
|
the one to read first if you are about to write your own.
|
|
@@ -12,6 +12,9 @@ the one to read first if you are about to write your own.
|
|
|
12
12
|
<script src="dist/plugins/grideditor.popup.min.js"></script>
|
|
13
13
|
<script src="dist/plugins/grideditor.offcanvas.min.js"></script>
|
|
14
14
|
<script src="dist/plugins/grideditor.card.min.js"></script>
|
|
15
|
+
<script src="dist/plugins/grideditor.navbar.min.js"></script>
|
|
16
|
+
<script src="dist/plugins/grideditor.sidenav.min.js"></script>
|
|
17
|
+
<script src="dist/plugins/grideditor.dropdown.min.js"></script>
|
|
15
18
|
<script src="dist/plugins/grideditor.elements.min.js"></script>
|
|
16
19
|
```
|
|
17
20
|
|
|
@@ -164,8 +167,8 @@ element, and where there may be several, an array.
|
|
|
164
167
|
| `ge.detailsOf(node)` | A node's settings panel, wherever it is: in its drawer, or open in the offcanvas, popover, modal or sidebar `settings_panel` names, outside the canvas. Find a panel's fields through it, never through the drawer. Null for a node with none. Whole: the plugins' sections and *Responsive*, built only while the panel is open, are built if they were not. `ge.detailsOf(node, { build: false })` hands it back as it is, without building them - for a plugin that only refreshes what may be showing, or asks whether a node has a panel at all |
|
|
165
168
|
| `ge.deleteNode(kind, node, confirmText, animate)` | Remove a node: ask, animate, announce |
|
|
166
169
|
| `ge.place(node, kind, options)` | Put a created node where `appendTo` and friends say, through the add events. `options.source` is the payload's `source`, `api` by default |
|
|
167
|
-
| `ge.createPaneControls(pane, kind, hostTools, confirmText, remove)` | The drawer a pane gets: move, the host's tools, delete. Returns the drawer, for a plugin that wants other tools in it |
|
|
168
|
-
| `ge.makeLabelEditable(label)` | Rename in place, with the Bootstrap toggle suspended while typing |
|
|
170
|
+
| `ge.createPaneControls(pane, kind, hostTools, confirmText, remove, options?)` | The drawer a pane gets: move, the host's tools, delete. Returns the drawer, for a plugin that wants other tools in it. `options.presets` is the list of preset classes its settings panel offers, in place of the `pane_classes` setting: `[]` for a pane that has none |
|
|
171
|
+
| `ge.makeLabelEditable(label)` | Rename in place, with the Bootstrap toggle suspended while typing, and put back after only if it was this call that suspended it: a toggle already suspended - an accordion item's button, a navbar's dropdown - stays so |
|
|
169
172
|
| `ge.labelIn(button)` | The label span inside a button, wrapped if it is not already |
|
|
170
173
|
| `ge.unwrapLabels(scope)` | Take those wrappers off again, for `unmark` |
|
|
171
174
|
| `ge.suspendToggles(scope)` / `ge.resumeToggles(scope)` | Move the attributes Bootstrap's data api acts on - `data-bs-toggle`, `data-bs-dismiss`, `data-bs-slide`, `data-bs-slide-to` and `data-bs-ride` - aside while editing, and back on the way out. They take `scope` and everything under it: a plugin whose container holds others passes the elements that are its own |
|
|
@@ -258,7 +261,18 @@ needs to put a new kind of block on the canvas:
|
|
|
258
261
|
and containers always cut.
|
|
259
262
|
- **`accepts(region, node)`** can turn a block away from a list: `false` and the
|
|
260
263
|
drag will not drop it there, whoever's block and whoever's list. With none of
|
|
261
|
-
these hooks, every block goes everywhere, as before.
|
|
264
|
+
these hooks, every block goes everywhere, as before. Every way of adding a
|
|
265
|
+
block asks it: a drag, Ctrl+V, the toolbar's buttons and `ge.place` - so
|
|
266
|
+
`createContainer`, `createRow`, `createText`… with `appendTo`, `prependTo`,
|
|
267
|
+
`insertBefore` or `insertAfter`, and the clipboard's paste tool. What the
|
|
268
|
+
toolbar was going to add to a region that will not have it goes to the
|
|
269
|
+
canvas, just after the block the region is in. `ge.place` warns, adds
|
|
270
|
+
nothing, fires no add event and returns `null` - at once, even from an
|
|
271
|
+
event handler, whose adds are queued otherwise. Its `null` is then also
|
|
272
|
+
for a region that would not take the block, and not only for a handler
|
|
273
|
+
that canceled. The buttons of a feature plugin with `inColumn`, which wrap
|
|
274
|
+
what they make in a row and a column, and the markup `init` and `setHtml`
|
|
275
|
+
are given, are not asked.
|
|
262
276
|
- **`toolbar`** adds buttons beside the containers'. A click appends what
|
|
263
277
|
`create()` returns to the canvas, announced as `kind`; a drop puts it where it
|
|
264
278
|
was dropped, or, when that region will not have it, on the canvas just after
|
|
@@ -492,6 +506,12 @@ rather than remembering anything about it.
|
|
|
492
506
|
when the plugin is not loaded.
|
|
493
507
|
- **`kindOf(node)`** returns the `kind` an event should carry for a node the
|
|
494
508
|
plugin owns, or null.
|
|
509
|
+
- **`kindLabel(kind)`** returns the text the settings panel titles a node of a
|
|
510
|
+
kind the plugin made up with, or null. It is asked where the panel would
|
|
511
|
+
otherwise show the kind as it is - after a container's `labelKey` and its
|
|
512
|
+
panes' `paneLabelKey`, and the core's own kinds - and the first plugin that
|
|
513
|
+
answers wins. The `nav` feature the navbar, sidenav and dropdown plugins share uses it for
|
|
514
|
+
the kinds of their pieces.
|
|
495
515
|
|
|
496
516
|
The core's own lists and the plugins' are taken down together: every list made
|
|
497
517
|
through `sortable()` is registered, so `deinit` unmakes exactly those and a
|
package/example/containers.html
CHANGED
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
<script src="../dist/plugins/grideditor.offcanvas.min.js"></script>
|
|
26
26
|
<script src="../dist/plugins/grideditor.card.min.js"></script>
|
|
27
27
|
<script src="../dist/plugins/grideditor.carousel.min.js"></script>
|
|
28
|
+
<script src="../dist/plugins/grideditor.navbar.min.js"></script>
|
|
29
|
+
<script src="../dist/plugins/grideditor.sidenav.min.js"></script>
|
|
30
|
+
<script src="../dist/plugins/grideditor.dropdown.min.js"></script>
|
|
28
31
|
|
|
29
32
|
<script>
|
|
30
33
|
document.addEventListener('DOMContentLoaded', function() {
|
|
@@ -102,7 +105,7 @@
|
|
|
102
105
|
one: rows, columns, content areas and elements nest inside
|
|
103
106
|
it exactly as they do at the top level. The five buttons in
|
|
104
107
|
the toolbar add a tabs container, an accordion, a popup, an
|
|
105
|
-
offcanvas, a carousel and a
|
|
108
|
+
offcanvas, a carousel, a card, a navbar and a sidebar — tabs, accordion and carousel
|
|
106
109
|
hold a pane each, the others hold one region.
|
|
107
110
|
</p>
|
|
108
111
|
<p class="form-text">
|
|
@@ -123,7 +126,10 @@
|
|
|
123
126
|
one slide shows at a time, the arrows in its drawer move
|
|
124
127
|
between them, and the gear has a Carousel section for
|
|
125
128
|
fade, autoplay and the rest of Bootstrap's options, and a
|
|
126
|
-
slide’s own gear has its interval.
|
|
129
|
+
slide’s own gear has its interval. The navbar and the
|
|
130
|
+
sidebar after it are edited piece by piece, each with a drawer,
|
|
131
|
+
and so are the two dropdowns at the end: one with a menu of
|
|
132
|
+
items, and a split one whose menu holds rows and columns.
|
|
127
133
|
</p>
|
|
128
134
|
<button class="btn btn-sm btn-secondary" id="output" type="button">Show the html this produces</button>
|
|
129
135
|
<button class="btn btn-sm btn-primary" id="authored" type="button">Open that html as a real page</button>
|
|
@@ -370,6 +376,91 @@
|
|
|
370
376
|
</div>
|
|
371
377
|
</div>
|
|
372
378
|
|
|
379
|
+
<div class="row">
|
|
380
|
+
<div class="col-lg-12">
|
|
381
|
+
<div data-ge-container="navbar">
|
|
382
|
+
<nav class="navbar navbar-expand-lg bg-body-tertiary">
|
|
383
|
+
<div class="container-fluid">
|
|
384
|
+
<a class="navbar-brand" href="#">Example</a>
|
|
385
|
+
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#example-navbar" aria-controls="example-navbar" aria-expanded="false" aria-label="Toggle navigation"><span class="navbar-toggler-icon"></span></button>
|
|
386
|
+
<div class="collapse navbar-collapse" id="example-navbar">
|
|
387
|
+
<ul class="navbar-nav">
|
|
388
|
+
<li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Home</a></li>
|
|
389
|
+
<li class="nav-item"><a class="nav-link" href="#">Pricing</a></li>
|
|
390
|
+
<li class="nav-item dropdown">
|
|
391
|
+
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">Products</a>
|
|
392
|
+
<ul class="dropdown-menu">
|
|
393
|
+
<li><a class="dropdown-item" href="#">Editor</a></li>
|
|
394
|
+
<li><hr class="dropdown-divider"></li>
|
|
395
|
+
<li><a class="dropdown-item" href="#">Plugins</a></li>
|
|
396
|
+
</ul>
|
|
397
|
+
</li>
|
|
398
|
+
</ul>
|
|
399
|
+
<span class="navbar-text ms-auto">Signed out</span>
|
|
400
|
+
</div>
|
|
401
|
+
</div>
|
|
402
|
+
</nav>
|
|
403
|
+
</div>
|
|
404
|
+
</div>
|
|
405
|
+
</div>
|
|
406
|
+
|
|
407
|
+
<div class="row">
|
|
408
|
+
<div class="col-lg-4">
|
|
409
|
+
<div data-ge-container="sidenav">
|
|
410
|
+
<div class="d-flex flex-column flex-shrink-0 p-3 bg-body-tertiary" style="width: 280px;">
|
|
411
|
+
<a class="d-flex align-items-center mb-3 link-body-emphasis text-decoration-none fs-4" href="#" data-ge-nav="brand">Docs</a>
|
|
412
|
+
<ul class="nav nav-pills flex-column">
|
|
413
|
+
<li class="nav-item"><a class="nav-link active" aria-current="page" href="#">Start</a></li>
|
|
414
|
+
<li class="nav-item" data-ge-nav="submenu">
|
|
415
|
+
<a class="nav-link dropdown-toggle" href="#example-submenu" data-bs-toggle="collapse" role="button" aria-expanded="false" aria-controls="example-submenu">Guides</a>
|
|
416
|
+
<div class="collapse" id="example-submenu">
|
|
417
|
+
<ul class="nav flex-column ms-3">
|
|
418
|
+
<li class="nav-item"><a class="nav-link" href="#">Containers</a></li>
|
|
419
|
+
<li class="nav-item"><a class="nav-link" href="#">Plugins</a></li>
|
|
420
|
+
</ul>
|
|
421
|
+
</div>
|
|
422
|
+
</li>
|
|
423
|
+
<li class="nav-item"><a class="nav-link" href="#">Changelog</a></li>
|
|
424
|
+
</ul>
|
|
425
|
+
</div>
|
|
426
|
+
</div>
|
|
427
|
+
</div>
|
|
428
|
+
<div class="col-lg-8">
|
|
429
|
+
<div class="ge-content" data-ge-content-type="tinymce"><p>The sidebar is a column of its own here, with content next to it.</p></div>
|
|
430
|
+
</div>
|
|
431
|
+
</div>
|
|
432
|
+
|
|
433
|
+
<div class="row">
|
|
434
|
+
<div class="col-lg-4">
|
|
435
|
+
<div data-ge-container="dropdown">
|
|
436
|
+
<div class="dropdown">
|
|
437
|
+
<button class="btn btn-primary dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Actions</button>
|
|
438
|
+
<ul class="dropdown-menu">
|
|
439
|
+
<li><a class="dropdown-item" href="#">Edit</a></li>
|
|
440
|
+
<li><a class="dropdown-item" href="#">Duplicate</a></li>
|
|
441
|
+
<li><hr class="dropdown-divider"></li>
|
|
442
|
+
<li><h6 class="dropdown-header">Danger</h6></li>
|
|
443
|
+
<li><a class="dropdown-item" href="#">Delete</a></li>
|
|
444
|
+
</ul>
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
<div class="col-lg-8">
|
|
449
|
+
<div data-ge-container="dropdown">
|
|
450
|
+
<div class="btn-group">
|
|
451
|
+
<a class="btn btn-outline-success" href="#">Filters</a>
|
|
452
|
+
<button class="btn btn-outline-success dropdown-toggle dropdown-toggle-split" type="button" data-bs-toggle="dropdown" aria-expanded="false"><span class="visually-hidden">Toggle Dropdown</span></button>
|
|
453
|
+
<div class="dropdown-menu p-3">
|
|
454
|
+
<div class="row">
|
|
455
|
+
<div class="col-md-6"><div class="ge-content" data-ge-content-type="tinymce"><p>A menu can hold rows and columns.</p></div></div>
|
|
456
|
+
<div class="col-md-6"><div class="ge-content" data-ge-content-type="tinymce"><p>Each one is an ordinary region.</p></div></div>
|
|
457
|
+
</div>
|
|
458
|
+
</div>
|
|
459
|
+
</div>
|
|
460
|
+
</div>
|
|
461
|
+
</div>
|
|
462
|
+
</div>
|
|
463
|
+
|
|
373
464
|
</div> <!-- /#myGrid -->
|
|
374
465
|
</div> <!-- /.container -->
|
|
375
466
|
|
package/example/index.html
CHANGED
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
<strong>Containers</strong>
|
|
73
73
|
<code class="text-body-secondary">containers.html</code>
|
|
74
74
|
</div>
|
|
75
|
-
<span class="text-body-secondary">Tabs, accordions, popups, offcanvases and
|
|
75
|
+
<span class="text-body-secondary">Tabs, accordions, popups, offcanvases, cards, a navbar and a sidebar, two levels deep, and the export opened as a real page</span>
|
|
76
76
|
</a>
|
|
77
77
|
|
|
78
78
|
<a class="list-group-item list-group-item-action" href="elements.html">
|
package/example/playground.html
CHANGED
|
@@ -46,6 +46,9 @@
|
|
|
46
46
|
<script src="../dist/plugins/grideditor.offcanvas.min.js"></script>
|
|
47
47
|
<script src="../dist/plugins/grideditor.carousel.min.js"></script>
|
|
48
48
|
<script src="../dist/plugins/grideditor.card.min.js"></script>
|
|
49
|
+
<script src="../dist/plugins/grideditor.navbar.min.js"></script>
|
|
50
|
+
<script src="../dist/plugins/grideditor.sidenav.min.js"></script>
|
|
51
|
+
<script src="../dist/plugins/grideditor.dropdown.min.js"></script>
|
|
49
52
|
<script src="../dist/plugins/grideditor.order.min.js"></script>
|
|
50
53
|
<script src="../dist/plugins/grideditor.alignment.min.js"></script>
|
|
51
54
|
<script src="../dist/plugins/grideditor.gutters.min.js"></script>
|
package/package.json
CHANGED
package/src/js/grideditor.js
CHANGED
|
@@ -2006,6 +2006,15 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
2006
2006
|
// a column. A row in a row brings a column too
|
|
2007
2007
|
var placed = wrapFor(where.region, made);
|
|
2008
2008
|
|
|
2009
|
+
// What the region will not have goes to the canvas, as a feature's
|
|
2010
|
+
// button does: the column a container was wrapped in is one the
|
|
2011
|
+
// region will not take either
|
|
2012
|
+
var holder = placed === made ? null : made.parentElement;
|
|
2013
|
+
if (!acceptsBlock(where.region, placed) || (holder && !acceptsBlock(holder, made))) {
|
|
2014
|
+
where = canvasAfterTopOf(where.region);
|
|
2015
|
+
placed = wrapFor(where.region, made);
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2009
2018
|
return addNode(container ? type : 'row', made, function() {
|
|
2010
2019
|
if (where.before) {
|
|
2011
2020
|
where.before.parentNode.insertBefore(placed, where.before);
|
|
@@ -3766,11 +3775,11 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3766
3775
|
* A pane drawer: small, inline, and made the same way for every
|
|
3767
3776
|
* container type so a tab and an accordion item behave alike.
|
|
3768
3777
|
*/
|
|
3769
|
-
function createPaneControls(pane, kind, tools, confirmText, remove) {
|
|
3778
|
+
function createPaneControls(pane, kind, tools, confirmText, remove, options) {
|
|
3770
3779
|
var drawer = prependDrawer(pane, 'ge-tools-drawer ge-pane-drawer');
|
|
3771
3780
|
|
|
3772
3781
|
createMoveTool(drawer);
|
|
3773
|
-
addSettingsTool(drawer, pane, settings.pane_classes);
|
|
3782
|
+
addSettingsTool(drawer, pane, options && options.presets ? options.presets : settings.pane_classes);
|
|
3774
3783
|
|
|
3775
3784
|
hostTools(drawer, tools);
|
|
3776
3785
|
|
|
@@ -3839,12 +3848,17 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3839
3848
|
|
|
3840
3849
|
var toggle = dom.closest(label, '[data-bs-toggle], [data-ge-bs-toggle]');
|
|
3841
3850
|
|
|
3851
|
+
// A toggle already apart when the editing starts - an accordion
|
|
3852
|
+
// item's button - stays apart when it ends
|
|
3853
|
+
var keepApart = false;
|
|
3854
|
+
|
|
3842
3855
|
editableLabels.add(label);
|
|
3843
3856
|
label.setAttribute('title', t('tool.rename'));
|
|
3844
3857
|
label.addEventListener('dblclick', function(e) {
|
|
3845
3858
|
e.preventDefault();
|
|
3846
3859
|
e.stopPropagation();
|
|
3847
3860
|
|
|
3861
|
+
keepApart = !!toggle && toggle.hasAttribute('data-ge-bs-toggle');
|
|
3848
3862
|
suspendToggles(toggle);
|
|
3849
3863
|
label.setAttribute('contenteditable', 'true');
|
|
3850
3864
|
label.focus();
|
|
@@ -3860,7 +3874,7 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
3860
3874
|
});
|
|
3861
3875
|
label.addEventListener('blur', function() {
|
|
3862
3876
|
label.removeAttribute('contenteditable');
|
|
3863
|
-
resumeToggles(toggle);
|
|
3877
|
+
if (!keepApart) { resumeToggles(toggle); }
|
|
3864
3878
|
});
|
|
3865
3879
|
}
|
|
3866
3880
|
|
|
@@ -5295,10 +5309,21 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
5295
5309
|
case 'section': return t('panel.kind_section');
|
|
5296
5310
|
case 'tab': return t('panel.kind_tab');
|
|
5297
5311
|
case 'accordion-item': return t('panel.kind_accordion_item');
|
|
5298
|
-
default: return kind;
|
|
5312
|
+
default: return featureKindLabel(kind) || kind;
|
|
5299
5313
|
}
|
|
5300
5314
|
}
|
|
5301
5315
|
|
|
5316
|
+
/** What a feature plugin calls a kind it made up, or null when none does. */
|
|
5317
|
+
function featureKindLabel(kind) {
|
|
5318
|
+
var label = null;
|
|
5319
|
+
|
|
5320
|
+
pluginHooks('kindLabel').forEach(function(hook) {
|
|
5321
|
+
if (label === null) { label = hook(kind) || null; }
|
|
5322
|
+
});
|
|
5323
|
+
|
|
5324
|
+
return label;
|
|
5325
|
+
}
|
|
5326
|
+
|
|
5302
5327
|
/**
|
|
5303
5328
|
* Make sure every column is marked as one, and that a column with no
|
|
5304
5329
|
* sizing at all gets some.
|
|
@@ -6173,6 +6198,13 @@ function build(instance, baseElem, optionsOrMethod) {
|
|
|
6173
6198
|
? target
|
|
6174
6199
|
: target.parentElement;
|
|
6175
6200
|
|
|
6201
|
+
// Checked now, not when a queued add runs: a caller inside an
|
|
6202
|
+
// event handler gets its answer at once
|
|
6203
|
+
if (parent && !acceptsBlock(parent, node)) {
|
|
6204
|
+
warn(kind + ': ' + kindOf(parent) + ' does not take it; nothing is added');
|
|
6205
|
+
return null;
|
|
6206
|
+
}
|
|
6207
|
+
|
|
6176
6208
|
var add = function() {
|
|
6177
6209
|
return addNode(kind, node, function() {
|
|
6178
6210
|
if (placement === 'appendTo') {
|
|
@@ -132,6 +132,131 @@ GridEditor.locales.es = {
|
|
|
132
132
|
'container.add_accordion': 'Acordeón',
|
|
133
133
|
'container.add_accordion_item': 'Añadir apartado',
|
|
134
134
|
'container.accordion_label': 'Apartado {number}',
|
|
135
|
+
'container.add_navbar': 'Barra de navegación',
|
|
136
|
+
'container.add_sidenav': 'Barra lateral',
|
|
137
|
+
'container.navbar_brand': 'Marca',
|
|
138
|
+
'container.sidenav_brand': 'Marca',
|
|
139
|
+
'container.nav_link': 'Enlace',
|
|
140
|
+
'container.nav_dropdown': 'Desplegable',
|
|
141
|
+
'container.nav_submenu': 'Submenú',
|
|
142
|
+
'container.nav_menu_link': 'Acción',
|
|
143
|
+
'container.nav_menu_header': 'Encabezado',
|
|
144
|
+
'container.nav_text': 'Texto',
|
|
145
|
+
'container.navbar_toggle': 'Mostrar navegación',
|
|
146
|
+
'container.navbar_offcanvas_title': 'Menú',
|
|
147
|
+
'container.sidenav_trigger': 'Menú',
|
|
148
|
+
'tool.add_nav_piece': 'Añadir…',
|
|
149
|
+
'tool.add_nav_link': 'Añadir enlace o desplegable',
|
|
150
|
+
'tool.add_nav_menu_item': 'Añadir ítem',
|
|
151
|
+
'tool.fold_nav_menu': 'Plegar este menú mientras editas',
|
|
152
|
+
'confirm.delete_nav_piece': '¿Borrar esto y todo lo que contiene?',
|
|
153
|
+
'container.navbar_section': 'Barra de navegación',
|
|
154
|
+
'container.sidenav_section': 'Barra lateral',
|
|
155
|
+
'container.nav_brand_show': 'Marca',
|
|
156
|
+
'container.nav_brand_image': 'Imagen',
|
|
157
|
+
'container.nav_brand_alt': 'Texto alternativo',
|
|
158
|
+
'container.nav_brand_height': 'Alto (px)',
|
|
159
|
+
'container.navbar_expand': 'Expandir',
|
|
160
|
+
'container.navbar_expand_never': 'Nunca',
|
|
161
|
+
'container.navbar_expand_always': 'Siempre',
|
|
162
|
+
'container.navbar_expand_from': 'Desde {breakpoint}',
|
|
163
|
+
'container.navbar_collapse': 'Plegado',
|
|
164
|
+
'container.navbar_collapse_collapse': 'Collapse',
|
|
165
|
+
'container.navbar_collapse_offcanvas': 'Offcanvas',
|
|
166
|
+
'container.navbar_collapse_none': 'Sin plegar',
|
|
167
|
+
'container.navbar_offcanvas_placement': 'Lado',
|
|
168
|
+
'container.nav_start': 'Inicio',
|
|
169
|
+
'container.nav_end': 'Fin',
|
|
170
|
+
'container.nav_bg': 'Fondo',
|
|
171
|
+
'container.nav_bg_none': 'Ninguno',
|
|
172
|
+
'container.nav_bg_body_tertiary': 'Gris claro',
|
|
173
|
+
'container.nav_bg_body': 'Página',
|
|
174
|
+
'container.nav_bg_primary': 'Primario',
|
|
175
|
+
'container.nav_bg_secondary': 'Secundario',
|
|
176
|
+
'container.nav_bg_success': 'Éxito',
|
|
177
|
+
'container.nav_bg_danger': 'Peligro',
|
|
178
|
+
'container.nav_bg_warning': 'Aviso',
|
|
179
|
+
'container.nav_bg_info': 'Información',
|
|
180
|
+
'container.nav_bg_light': 'Claro',
|
|
181
|
+
'container.nav_bg_dark': 'Oscuro',
|
|
182
|
+
'container.nav_theme': 'Tema',
|
|
183
|
+
'container.nav_theme_auto': 'Automático',
|
|
184
|
+
'container.nav_theme_light': 'Claro',
|
|
185
|
+
'container.nav_theme_dark': 'Oscuro',
|
|
186
|
+
'container.navbar_position': 'Posición',
|
|
187
|
+
'container.navbar_position_none': 'En su sitio',
|
|
188
|
+
'container.navbar_position_fixed_top': 'Fija arriba',
|
|
189
|
+
'container.navbar_position_fixed_bottom': 'Fija abajo',
|
|
190
|
+
'container.navbar_position_sticky_top': 'Pegada arriba',
|
|
191
|
+
'container.navbar_position_sticky_bottom': 'Pegada abajo',
|
|
192
|
+
'container.navbar_width': 'Ancho interior',
|
|
193
|
+
'container.navbar_width_fluid': 'Completo',
|
|
194
|
+
'container.navbar_width_fixed': 'Fijo',
|
|
195
|
+
'container.navbar_width_from': 'Completo hasta {breakpoint}',
|
|
196
|
+
'container.sidenav_width': 'Ancho',
|
|
197
|
+
'container.sidenav_style': 'Estilo de enlaces',
|
|
198
|
+
'container.sidenav_style_pills': 'Pills',
|
|
199
|
+
'container.sidenav_style_plain': 'Sencillo',
|
|
200
|
+
'container.sidenav_full_height': 'Alto completo',
|
|
201
|
+
'container.sidenav_responsive': 'Responsive',
|
|
202
|
+
'container.sidenav_responsive_never': 'Siempre visible',
|
|
203
|
+
'container.sidenav_responsive_from': 'Offcanvas por debajo de {breakpoint}',
|
|
204
|
+
'container.sidenav_offcanvas_title': 'Menú',
|
|
205
|
+
'container.nav_close': 'Cerrar',
|
|
206
|
+
'container.nav_list_section': 'Lista',
|
|
207
|
+
'container.nav_link_section': 'Enlace',
|
|
208
|
+
'container.nav_dropdown_section': 'Desplegable',
|
|
209
|
+
'container.nav_menu_item_section': 'Ítem',
|
|
210
|
+
'container.nav_text_section': 'Texto',
|
|
211
|
+
'container.nav_zone_section': 'Zona libre',
|
|
212
|
+
'container.nav_brand_section': 'Marca',
|
|
213
|
+
'container.nav_align': 'Alineación',
|
|
214
|
+
'container.nav_align_after': 'Tras lo anterior',
|
|
215
|
+
'container.nav_align_end': 'Al final',
|
|
216
|
+
'container.nav_align_center': 'Centrada',
|
|
217
|
+
'container.nav_scroll': 'Scroll',
|
|
218
|
+
'container.nav_scroll_height': 'Alto',
|
|
219
|
+
'container.nav_bottom': 'Al pie',
|
|
220
|
+
'container.nav_href': 'URL',
|
|
221
|
+
'container.nav_active': 'Activo',
|
|
222
|
+
'container.nav_disabled': 'Desactivado',
|
|
223
|
+
'container.nav_new_tab': 'Pestaña nueva',
|
|
224
|
+
'container.nav_menu_end': 'Menú a la derecha',
|
|
225
|
+
'container.nav_submenu_type': 'Tipo',
|
|
226
|
+
'container.nav_submenu_type_collapse': 'Plegable',
|
|
227
|
+
'container.nav_submenu_type_dropdown': 'Dropdown',
|
|
228
|
+
'container.nav_submenu_open': 'Abierto al cargar',
|
|
229
|
+
'container.nav_menu_divider': 'Separador',
|
|
230
|
+
'container.nav_zone': 'Zona libre',
|
|
231
|
+
'tool.add_nav_list': 'Añadir lista',
|
|
232
|
+
'tool.add_nav_text': 'Añadir texto',
|
|
233
|
+
'tool.add_nav_zone': 'Añadir zona libre',
|
|
234
|
+
'tool.unfold_nav_menu': 'Desplegar este menú',
|
|
235
|
+
'container.nav_browse': 'Examinar…',
|
|
236
|
+
'tool.delete_nav_piece': 'Borrar',
|
|
237
|
+
'container.add_dropdown': 'Desplegable',
|
|
238
|
+
'container.dropdown_label': 'Desplegable',
|
|
239
|
+
'container.dropdown_toggle': 'Alternar desplegable',
|
|
240
|
+
'container.dropdown_section': 'Desplegable',
|
|
241
|
+
'container.dropdown_menu': 'Menú',
|
|
242
|
+
'container.dropdown_menu_items': 'Ítems',
|
|
243
|
+
'container.dropdown_menu_content': 'Contenido libre',
|
|
244
|
+
'container.dropdown_style': 'Estilo',
|
|
245
|
+
'container.dropdown_outline': 'Contorno',
|
|
246
|
+
'container.dropdown_size': 'Tamaño',
|
|
247
|
+
'container.dropdown_size_sm': 'Pequeño',
|
|
248
|
+
'container.dropdown_size_default': 'Normal',
|
|
249
|
+
'container.dropdown_size_lg': 'Grande',
|
|
250
|
+
'container.dropdown_direction': 'Dirección',
|
|
251
|
+
'container.dropdown_down': 'Abajo',
|
|
252
|
+
'container.dropdown_up': 'Arriba',
|
|
253
|
+
'container.dropdown_end': 'Derecha',
|
|
254
|
+
'container.dropdown_start': 'Izquierda',
|
|
255
|
+
'container.dropdown_menu_end': 'Menú a la derecha',
|
|
256
|
+
'container.dropdown_split': 'Botón dividido',
|
|
257
|
+
'container.dropdown_split_href': 'Enlace del botón principal',
|
|
258
|
+
'container.dropdown_split_new_tab': 'Abrir en pestaña nueva',
|
|
259
|
+
'confirm.dropdown_change_menu': '¿Cambiar el menú? Lo que tiene ahora se quita.',
|
|
135
260
|
'container.add_popup': 'Ventana emergente',
|
|
136
261
|
'container.popup_title': 'Título',
|
|
137
262
|
'container.popup_trigger': 'Abrir',
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The button that opens the host's file browser: `browse(done, { node,
|
|
3
|
+
* property, value })` in the navbar or sidenav setting, answered by
|
|
4
|
+
* `done(url)` or by the promise it returns, whichever comes first.
|
|
5
|
+
* Nothing, an empty text or a value that is not a text leaves the field as
|
|
6
|
+
* it was, and so does an answer that comes when the node or the editor is
|
|
7
|
+
* gone. Errors are the host's: not caught.
|
|
8
|
+
*/
|
|
9
|
+
import * as dom from '../dom.js';
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* `browse` is the host's function, `context.destroyed` says the editor is
|
|
13
|
+
* gone, and `current()` and `apply(url)` read and write the field. `node`
|
|
14
|
+
* is the node the answer is for, or a function that says which when asked.
|
|
15
|
+
* Nothing when the host gave no `browse`.
|
|
16
|
+
*/
|
|
17
|
+
export function browseButton(ge, context, browse, node, property, current, apply) {
|
|
18
|
+
if (typeof browse !== 'function') { return null; }
|
|
19
|
+
|
|
20
|
+
var button = dom.element('button', {
|
|
21
|
+
type: 'button',
|
|
22
|
+
'class': 'btn btn-outline-secondary ge-nav-browse',
|
|
23
|
+
title: ge.t('container.nav_browse'),
|
|
24
|
+
'aria-label': ge.t('container.nav_browse'),
|
|
25
|
+
});
|
|
26
|
+
button.appendChild(dom.element('i', { 'class': 'bi bi-folder2-open', 'aria-hidden': 'true' }));
|
|
27
|
+
|
|
28
|
+
button.addEventListener('click', function() {
|
|
29
|
+
var answered = false; // Each press takes one answer, the first
|
|
30
|
+
var target = typeof node === 'function' ? node() : node;
|
|
31
|
+
|
|
32
|
+
function answer(url) {
|
|
33
|
+
if (answered) { return; }
|
|
34
|
+
answered = true;
|
|
35
|
+
|
|
36
|
+
if (url === null || url === undefined) { return; }
|
|
37
|
+
if (typeof url !== 'string') {
|
|
38
|
+
ge.warn('navbar and sidenav browse gave ' + typeof url + ', not a text: ignored');
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
if (url.trim() === '' || context.destroyed || !ge.canvas.contains(target)) { return; }
|
|
42
|
+
|
|
43
|
+
apply(url.trim());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
var result = browse(answer, { node: target, property: property, value: current() });
|
|
47
|
+
if (result && typeof result.then === 'function') { result.then(answer); }
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return button;
|
|
51
|
+
}
|