markupeditor 0.9.13 → 0.9.14
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/config/keymapconfig.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"undo": "Mod-z",
|
|
3
|
-
"redo": "Shift-
|
|
3
|
+
"redo": "Mod-Shift-z",
|
|
4
4
|
"link": ["Mod-K", "Mod-k"],
|
|
5
5
|
"p": "Ctrl-Shift-0",
|
|
6
6
|
"h1": "Ctrl-Shift-1",
|
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
"h6": "Ctrl-Shift-6",
|
|
12
12
|
"bullet": ["Ctrl-U", "Ctrl-u"],
|
|
13
13
|
"number": ["Ctrl-O", "Ctrl-o"],
|
|
14
|
-
"indent": ["Mod
|
|
15
|
-
"outdent": ["Mod
|
|
14
|
+
"indent": ["Mod->", "Mod-]"],
|
|
15
|
+
"outdent": ["Mod-<", "Mod-["],
|
|
16
16
|
"bold": ["Mod-B", "Mod-b"],
|
|
17
17
|
"italic": ["Mod-I", "Mod-i"],
|
|
18
18
|
"underline": ["Mod-U", "Mod-u"],
|
|
@@ -16,6 +16,11 @@
|
|
|
16
16
|
"formatBar": 50,
|
|
17
17
|
"search": 60
|
|
18
18
|
},
|
|
19
|
+
"menus": {
|
|
20
|
+
"styleName": true,
|
|
21
|
+
"tableHeader": true,
|
|
22
|
+
"tableBorder": true
|
|
23
|
+
},
|
|
19
24
|
"insertBar": {
|
|
20
25
|
"link": true,
|
|
21
26
|
"image": true,
|
|
@@ -44,10 +49,6 @@
|
|
|
44
49
|
"list": true,
|
|
45
50
|
"dent": true
|
|
46
51
|
},
|
|
47
|
-
"tableMenu": {
|
|
48
|
-
"header": true,
|
|
49
|
-
"border": true
|
|
50
|
-
},
|
|
51
52
|
"help": {
|
|
52
53
|
"style": "Set paragraph style",
|
|
53
54
|
"bold": "Toggle bold",
|
package/dist/markup-editor.js
CHANGED
|
@@ -2,7 +2,7 @@ const sheet$2 = new CSSStyleSheet();sheet$2.replaceSync("/**\n The CSS here was
|
|
|
2
2
|
|
|
3
3
|
const sheet$1 = new CSSStyleSheet();sheet$1.replaceSync("#editor, .editor {\n font-family: system-ui, sans-serif;\n background: white;\n color: black;\n background-clip: padding-box;\n margin: -8px; /* Set so that the .ProseMirror padding starts from edges */\n --padBottom: 0; /* MU.padBottom() sets this value in px based on fullHeight */\n padding-block: 0 var(--padBottom);\n overflow-x: clip;\n overflow-y: scroll;\n height: 100vh;\n padding-right: 12px;\n}\n@media (prefers-color-scheme: dark) {\n #editor, .editor {\n background: black;\n color: white;\n }\n}\n\nbody {\n font-family: system-ui, sans-serif;\n}\n\na {\n color: blue;\n text-decoration: none;\n}\n@media (prefers-color-scheme: dark) {\n a {\n color: #4183c4;\n }\n}\n\na:hover {\n text-decoration: underline;\n}\n\np, pre {\n font-size: 1.0rem;\n}\n\np, ul, ol, dl, table, pre {\n margin: 0 0 15px;\n}\n\nul, ol {\n padding-left: 30px;\n}\n\nh1 {\n font-size: 2.5rem;\n}\n\nh2 {\n font-size: 2.0rem;\n}\n\nh3 {\n font-size: 1.5rem;\n}\n\nh4 {\n font-size: 1.2rem;\n}\n\nh5 {\n font-size: 1.0rem;\n}\n\nh6 {\n font-size: .83rem;\n}\n\nh1, h2, h3, h4, h5, h6 {\n font-weight: bold;\n margin: 0 0 10px 0;\n}\n\nh1 + p, h2 + p, h3 + p {\n margin-top: 10px;\n}\n\ntable {\n table-layout: fixed;\n border-collapse: collapse;\n width: 100%;\n}\n\ntable th, table td {\n padding: 4px;\n}\n\ntable th {\n font-weight: normal; /* The default is bold, but we want to use paragraph styles and formatting */\n}\n\n/* Make the styling compact inside of a table */\ntable p, table h1, table h2, table h3, table h4, table h5, table h6 {\n margin: 0;\n}\n\n/* Table bordering options */\n.bordered-table-none {\n border: none;\n}\n\n.bordered-table-outer, .bordered-table-header, .bordered-table-cell {\n border: 1px solid #DDD;\n}\n\n.bordered-table-header th { /* border th not thead to refresh properly */\n border: 1px solid #DDD;\n}\n\n.bordered-table-cell th, .bordered-table-cell td {\n border: 1px solid #DDD;\n}\n\n/* Default table bordering is same as .bordered-table-cell but is only used when not specified */\ntable:not(.bordered-table-none, .bordered-table-outer, .bordered-table-header, .bordered-table-cell) {\n border: 1px solid #DDD;\n}\n\ntable:not(.bordered-table-none, .bordered-table-outer, .bordered-table-header, .bordered-table-cell) td {\n border: 1px solid #DDD;\n}\n\ntable:not(.bordered-table-none, .bordered-table-outer, .bordered-table-header, .bordered-table-cell) th {\n border: 1px solid #DDD;\n}\n\nli p {\n margin: 0px 0;\n}\n\nblockquote {\n margin-right: 0px; /* Because nested blockquotes just keep getting narrower */\n}\n\ncode {\n overflow-x: scroll;\n display: block;\n background-color: #F8F8F8;\n border-radius: 3px;\n font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;\n white-space: pre;\n}\n@media (prefers-color-scheme: dark) {\n code {\n background-color: #808080;\n }\n}\n\np code, h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {\n display: inline;\n}\n\n.resize-container {\n position: relative;\n display: inline-block;\n margin: 0;\n}\n\nimg {\n max-width: 100%;\n height: auto;\n}\n\n/* Provide a slightly darkened or lightened overlay while search is active */\n.searching {\n background-color: rgba(0, 0, 0, 0.10);\n}\n@media (prefers-color-scheme: dark) {\n .searching {\n background: rgba(255, 255, 255, 0.10);\n }\n}\n\n.resize-container img {\n display: block;\n outline: 1px black dashed;\n outline-offset: 4px;\n outline-width: 1px;\n}\n@media (prefers-color-scheme: dark) {\n .resize-container img {\n outline: 1px white dashed;\n }\n}\n\n.resize-handle-nw,\n.resize-handle-ne,\n.resize-handle-sw,\n.resize-handle-se {\n position: absolute;\n display: block;\n width: 6px;\n height: 6px;\n outline: 1px black solid;\n background: white;\n z-index: 999;\n}\n@media (prefers-color-scheme: dark) {\n .resize-handle-nw,\n .resize-handle-ne,\n .resize-handle-sw,\n .resize-handle-se {\n outline: 1px white solid;\n background: black;\n }\n}\n\n/* A transparent child for each resize-handle that expands the clickable area */\n.resize-handle-nw:after,\n.resize-handle-ne:after,\n.resize-handle-sw:after,\n.resize-handle-se:after {\n content: \"\";\n position: absolute;\n left: -5px;\n top: -5px;\n width: 16px;\n height: 16px;\n}\n\n/* The *-resize cursors do not work, at least in MacCatalyst.\n * Still specifying them below. They default to a pointer instead\n */\n.resize-handle-nw {\n cursor: nw-resize;\n top: -8px;\n left: -7px;\n}\n\n.resize-handle-ne {\n cursor: ne-resize;\n top: -8px;\n right: -7px;\n}\n\n.resize-handle-sw {\n cursor: sw-resize;\n bottom: -8px;\n left: -7px;\n}\n\n.resize-handle-se {\n cursor: se-resize;\n bottom: -8px;\n right: -7px;\n}\n\n.placeholder[placeholder]:before {\n content: attr(placeholder);\n position: absolute;\n color: #ccc;\n}\n\n/* Classes set by prosemirror-search module, modified for MarkupEditor */\n/* Note the dark and light mode are the same */\n\n.ProseMirror-search-match {\n background-color: yellow;\n color: black;\n}\n\n.ProseMirror-active-search-match {\n background-color: orange;\n color: black;\n outline: 1px orangered solid;\n z-index: 2;\n}");
|
|
4
4
|
|
|
5
|
-
const sheet = new CSSStyleSheet();sheet.replaceSync("/* Spacing at the top */\n/* Note that toolbar-overlay below is also set to these values */\n\n.Markup-searchbar-showing {\n height: 38px;\n top: 76px;\n}\n\n/* The wrapper lets us automatically embed a toolbar and scroll under it */\n.Markup-toolbar-wrapper {\n margin-right: -12px; /* Prevent side scroll even when menu fits */\n height: inherit;\n overflow-y: scroll;\n position: relative; \n}\n\n/* We add Markup-prompt-showing to the wrapper to prevent scroll, and remove it when done */\n.Markup-prompt-showing {\n overflow-y: hidden;\n}\n\n/* Z-indexes in one place */\n\n.body-content { \n z-index: 1; \n}\n\n.Markup-prompt-overlay { \n z-index: 2; \n}\n\n.Markup-prompt, .Markup-selection {\n z-index: 3;\n}\n\n.Markup-searchbar {\n z-index: 4;\n}\n\n.Markup-toolbar, .Markup-toolbar-more {\n z-index: 5;\n}\n\n.Markup-toolbar-overlay { \n z-index: 6; \n}\n\n.Markup-menu-dropdown-menu {\n z-index: 7;\n}\n\n/* Toolbar, menu item, and dropdown styling */\n\n.Markup-toolbar {\n display: inline-flex;\n position: sticky;\n overflow: visible;\n width: 100%;\n font-size: 24px;\n vertical-align: middle;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n top: 0;\n max-height: 38px;\n padding: 2px 8px;\n color: blue;\n background: rgba(250, 249, 246, 0.95);\n border-bottom: 1px solid lightgray;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar {\n color: rgb(250, 249, 246);\n background: rgba(40, 40, 43, 0.9);\n border-bottom: 1px solid gray;\n }\n}\n\n.Markup-menuitem {\n display: inline-block;\n flex-shrink: 0; /* Otherwise, the drop-downs with icons shrink */\n overflow-y: visible;\n vertical-align: middle;\n min-width: 28px;\n height: 28px;\n cursor: pointer;\n margin-right: 4px;\n border-radius: 4px;\n color: blue;\n border: 1px solid blue;\n background: white;\n fill: blue;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem {\n color: lightblue;\n border: 1px solid lightblue; \n /* border: 1px solid #4183c4; */\n background: black;\n fill: lightblue;\n }\n}\n\n.Markup-menuitem-active {\n fill: white;\n color: white;\n background: blue;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem-active {\n fill: black;\n color: black;\n background: lightblue;\n }\n}\n\n.Markup-menuitem-disabled {\n cursor: default;\n opacity: .3;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem-disabled {\n opacity: .6;\n }\n}\n\n.Markup-icon {\n display: inline-block;\n width: 28px;\n height: 28px;\n border: 0;\n}\n\n.Markup-icon span {\n vertical-align: middle;\n}\n\n.Markup-icon svg {\n padding: 2px;\n border: 0;\n fill: inherit;\n}\n\n.Markup-menuseparator {\n display: inline-block;\n vertical-align: middle;\n height: 28px;\n border-right: 1px solid lightgray;\n margin-right: 4px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuseparator {\n border-right: 1px solid gray;\n }\n}\n\n.Markup-menu-disabled .Markup-icon {\n cursor: default;\n}\n\n.Markup-menu-dropdown, .Markup-menu-dropdown-menu {\n background: inherit;\n text-align: left;\n white-space: nowrap;\n}\n\n.Markup-menu-dropdown span {\n vertical-align: middle;\n}\n\n.Markup-menu-dropdown-icon span {\n vertical-align: middle;\n}\n\n.Markup-menu-dropdown-wrap {\n display: flex;\n justify-content: space-between;\n padding: 0 4px;\n height: inherit;\n border-radius: 4px;\n background: inherit;\n}\n\n.Markup-menu-dropdown-icon-wrap {\n display: flex;\n justify-content: space-between;\n padding-right: 4px;\n width: 1.8em;\n height: inherit;\n border-radius: 4px;\n background: inherit;\n}\n\n.Markup-menu-dropdown-icon-wrap-noindicator {\n display: inline-flex;\n padding-right: 4px;\n width: 1em;\n height: inherit;\n border-radius: 4px;\n background: inherit;\n}\n\n/* For the paragraph style dropdown with a label, make the font smaller */\n.Markup-menu-dropdown {\n display: flex;\n justify-content: space-between;\n align-items: center;\n box-sizing: border-box;\n font-size: 0.8em;\n width: inherit;\n height: inherit;\n background: inherit;\n position: absolute;\n}\n\n/* But for the indicator, bump size up to match the icon-style dropdown */\n.Markup-menu-dropdown .Markup-menu-dropdown-indicator {\n font-size: 1.25em;\n}\n\n.Markup-menu-dropdown-icon {\n display: inline-flex;\n justify-content: space-between;\n font-size: inherit;\n width: inherit;\n cursor: pointer;\n position: absolute;\n}\n\n.Markup-menu-dropdown-indicator {\n opacity: .6;\n}\n\n.Markup-tooltip .Markup-menu {\n width: -webkit-fit-content;\n width: fit-content;\n white-space: pre;\n}\n\n.Markup-menu-dropdown-menu, .Markup-menu-submenu {\n position: absolute;\n background: inherit;\n padding: 2px;\n background: inherit;\n border: 1px solid gray;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid lightgray;\n }\n}\n\n.Markup-menu-dropdown-menu {\n margin-top: calc(1em + 6px);\n min-width: 4em;\n}\n\n.Markup-menu-dropdown-item {\n cursor: pointer;\n padding: 2px 8px 2px 4px;\n}\n\n/* Used to overlfow and ellipsis-truncate text in Dropdown menu items */\n.Markup-menuitem-clipped {\n white-space: nowrap; /* Required for text-overflow */\n overflow-x: hidden; /* Required for text-overflow */\n max-width: 30em;\n text-overflow: ellipsis;\n}\n\n.Markup-menu-dropdown-item:hover, .Markup-menu-submenu-wrap:hover {\n background: #f2f2f2;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-item:hover, .Markup-menu-submenu-wrap:hover {\n background: rgb(80, 80, 80);\n }\n}\n\n.Markup-menu-dropdown-item p, \n.Markup-menu-dropdown-item h1, \n.Markup-menu-dropdown-item h2, \n.Markup-menu-dropdown-item h3, \n.Markup-menu-dropdown-item h4, \n.Markup-menu-dropdown-item h5, \n.Markup-menu-dropdown-item h6, \n.Markup-menu-dropdown-item pre {\n padding: 0;\n margin: 0;\n min-height: 24px;\n}\n\n.Markup-stylelabel {\n display: flex;\n justify-content: space-between;\n align-items: center;\n white-space: pre;\n width: 100%;\n}\n\n.Markup-stylelabel-keymap {\n display: flex;\n justify-content: flex-end;\n font-size: 1.0rem;\n font-weight: normal;\n color: gray;\n}\n\n.Markup-menu-submenu-wrap:hover .Markup-menu-submenu, .Markup-menu-submenu-wrap-active .Markup-menu-submenu {\n display: block;\n}\n\n.Markup-menu-submenu-wrap {\n position: relative;\n margin-right: -4px;\n background: inherit;\n}\n\n.Markup-menu-submenu {\n display: none;\n min-width: 4em;\n left: 100%;\n top: -5px;\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: white;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-submenu {\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: black;\n }\n}\n\n.Markup-menu-submenu-label:after {\n content: \"\";\n border-top: 4px solid transparent;\n border-bottom: 4px solid transparent;\n border-left: 4px solid currentColor;\n opacity: .6;\n position: absolute;\n right: 4px;\n top: calc(50% - 4px);\n}\n\n.Markup-selection {\n position: absolute;\n border: 1px solid blue;\n background: transparent;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-selection {\n border: 1px solid lightblue;\n }\n}\n\n/* Toolbar-more styling */\n\n.Markup-toolbar-more {\n display: inline-flex;\n position: sticky;\n overflow: visible;\n width: 100%;\n font-size: 24px;\n vertical-align: middle;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n top: 35px;\n max-height: 38px;\n padding: 2px 8px;\n color: blue;\n background: rgba(250, 249, 246, 0.95);\n border-bottom: 1px solid lightgray;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar-more {\n color: rgb(250, 249, 246);\n background: rgba(40, 40, 43, 0.9);\n border-bottom: 1px solid gray;\n }\n}\n\n/* Searchbar styling */\n\n.Markup-searchbar {\n display: inline-block;\n font-size: 24px;\n vertical-align: middle;\n position: sticky;\n top: 35px;\n width: 100%;\n line-height: 30px;\n height: 37px;\n color: blue;\n background: rgba(250, 249, 246, 0.95);\n border-bottom: 1px solid lightgray;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n overflow: hidden;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-searchbar {\n color: rgb(250, 249, 246);\n background: rgba(40, 40, 43, 0.9);\n border-bottom: 1px solid gray;\n }\n}\n\n.Markup-searchbar input {\n appearance: none; /* Otherwise, in Safari/WebKit, the height is small and fixed */\n position: relative;\n font-size: 18px;\n line-height: 30px;\n height: 30px;\n width: calc(100% - 128px);\n margin: 0 8px;\n padding: 0 4px;\n outline: none;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid lightgray;\n border-radius: 6px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-searchbar input {\n color: rgb(250, 249, 246);\n background: rgb(40, 40, 43);\n border: 1px solid gray;\n }\n}\n\n.Markup-searchbar .Markup-searchbar-status {\n position: absolute;\n display: flex;\n justify-content: flex-end;\n align-items: center;\n white-space: nowrap;\n font-size: 12px;\n overflow-x: visible;\n height: 28px;\n top: 5px;\n left: calc(100% - 13em);\n width: 1px;\n color: gray;\n user-select: none;\n}\n\n/* Dialog/prompt styling for insert/edit actions */\n\n.Markup-prompt-overlay {\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: rgba(0, 0, 0, 0.2);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt-overlay {\n background-color: rgba(255, 255, 255, 0.2);\n }\n}\n\n.Markup-toolbar-overlay {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\tbackground-color: rgba(0, 0, 0, 0.1);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar-overlay {\n background-color: rgba(255, 255, 255, 0.1);\n }\n}\n\n.Markup-toolbar-overlay.Markup-searchbar-hidden {\n height: 38px;\n}\n\n.Markup-toolbar-overlay.Markup-searchbar-showing {\n height: 76px;\n}\n\n.Markup-prompt {\n margin: 0;\n font-size: 18px;\n background: white;\n padding: 8px;\n border: 1px solid silver;\n position: absolute;\n border-radius: 3px;\n box-shadow: -.5px 2px 5px rgba(0, 0, 0, 0.2);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt {\n background: black;\n box-shadow: -.5px 2px 5px rgba(255, 255, 255, 0.8);\n }\n}\n\n.Markup-prompt-link {\n height: 96px;\n width: 300px;\n}\n\n.Markup-prompt-image {\n height: 130px;\n width: 300px;\n}\n\n.Markup-prompt img {\n display: inline-block;\n vertical-align: middle;\n min-width: 28px;\n height: 28px;\n margin-right: 4px;\n}\n\n.Markup-prompt p {\n margin: 0 0 4px 0;\n font-weight: normal;\n color: black;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt p {\n color: white;\n }\n}\n\n.Markup-prompt input[type=\"text\"] {\n font-size: 100%;\n line-height: 28px;\n margin-top: 2px;\n padding: 1px 4px;\n width: 100%;\n appearance: none;\n background: #eee;\n outline: none;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid lightgray;\n border-radius: 6px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt input[type=\"text\"] {\n color: rgb(250, 249, 246);\n background: rgb(40, 40, 43);\n border: 1px solid gray;\n }\n}\n\n.Markup-prompt input.invalid {\n color: red;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt input.invalid {\n color: pink;\n }\n}\n\n.Markup-prompt-buttons {\n display: flex;\n vertical-align: middle;\n justify-content: space-between;\n justify-items: center;\n line-height: 28px;\n height: 28px;\n margin-top: 8px;\n margin-bottom: 8px;\n}\n\n.Markup-prompt-buttongroup {\n flex-shrink: 0;\n}\n\n.Markup-prompt-buttons img {\n aspect-ratio: auto;\n height: auto;\n object-fit: contain;\n}\n\n.Markup-prompt-buttons .Markup-menuitem {\n display: inline-flex;\n padding-right: 4px;\n padding-left: 4px;\n}\n\n/* The buttongroup contains OK and Cancel menuitems on the right */\n.Markup-prompt-buttongroup .Markup-menuitem {\n margin-right: 0;\n margin-left: 4px;\n}\n\n/* .Markup-menu-tablesizer is a specialized submenu */\n.Markup-menu-tablesizer {\n display: none;\n grid-template-columns: repeat(4, 1fr);\n grid-auto-rows: 18px;\n row-gap: 1px;\n column-gap: 1px;\n padding: 0;\n left: 100%;\n top: -5px;\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: white;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer {\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: black;\n }\n}\n\n.Markup-menu-submenu-wrap:hover .Markup-menu-tablesizer, .Markup-menu-submenu-wrap-active .Markup-menu-tablesizer {\n display: grid;\n}\n\n.Markup-menu-dropdown-menu, .Markup-menu-tablesizer {\n position: absolute;\n background: inherit;\n padding: 2px;\n background: inherit;\n border: 1px solid gray;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid lightgray;\n }\n}\n\n.Markup-menu-tablesizer .Markup-menu-dropdown-item {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid blue;\n width: 18px;\n height: 18px;\n padding: 0;\n font-size: 13px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer .Markup-menu-dropdown-item {\n border: 1px solid lightblue;\n }\n}\n\n.Markup-menu-tablesizer .Markup-menuitem-active {\n height: 13px;\n padding-top: 3px;\n fill: black;\n color: black;\n background: blue;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer .Markup-menuitem-active {\n fill: black;\n color: black;\n background: lightblue;\n }\n}");
|
|
5
|
+
const sheet = new CSSStyleSheet();sheet.replaceSync("/* Spacing at the top */\n/* Note that toolbar-overlay below is also set to these values */\n\n.Markup-searchbar-showing {\n height: 38px;\n top: 76px;\n}\n\n/* The wrapper lets us automatically embed a toolbar and scroll under it */\n.Markup-toolbar-wrapper {\n margin-right: -12px; /* Prevent side scroll even when menu fits */\n height: inherit;\n overflow-y: scroll;\n position: relative; \n}\n\n/* We add Markup-prompt-showing to the wrapper to prevent scroll, and remove it when done */\n.Markup-prompt-showing {\n overflow-y: hidden;\n}\n\n/* Z-indexes in one place */\n\n.body-content { \n z-index: 1; \n}\n\n.Markup-prompt-overlay { \n z-index: 2; \n}\n\n.Markup-prompt, .Markup-selection {\n z-index: 3;\n}\n\n.Markup-searchbar {\n z-index: 4;\n}\n\n.Markup-toolbar, .Markup-toolbar-more {\n z-index: 5;\n}\n\n.Markup-toolbar-overlay { \n z-index: 6; \n}\n\n.Markup-menu-dropdown-menu {\n z-index: 7;\n}\n\n/* Toolbar, menu item, and dropdown styling */\n\n.Markup-toolbar {\n display: inline-flex;\n position: sticky;\n overflow: visible;\n width: 100%;\n font-size: 24px;\n vertical-align: middle;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n top: 0;\n max-height: 38px;\n padding: 2px 8px;\n color: blue;\n background: rgba(250, 249, 246, 0.95);\n border-bottom: 1px solid lightgray;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar {\n color: rgb(250, 249, 246);\n background: rgba(40, 40, 43, 0.9);\n border-bottom: 1px solid gray;\n }\n}\n\n.Markup-toolbar-hidden {\n display: none;\n}\n\n.Markup-menuitem {\n display: inline-block;\n flex-shrink: 0; /* Otherwise, the drop-downs with icons shrink */\n overflow-y: visible;\n vertical-align: middle;\n min-width: 28px;\n height: 28px;\n cursor: pointer;\n margin-right: 4px;\n border-radius: 4px;\n color: blue;\n border: 1px solid blue;\n background: white;\n fill: blue;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem {\n color: lightblue;\n border: 1px solid lightblue; \n /* border: 1px solid #4183c4; */\n background: black;\n fill: lightblue;\n }\n}\n\n.Markup-menuitem-active {\n fill: white;\n color: white;\n background: blue;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem-active {\n fill: black;\n color: black;\n background: lightblue;\n }\n}\n\n.Markup-menuitem-disabled {\n cursor: default;\n opacity: .3;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem-disabled {\n opacity: .6;\n }\n}\n\n.Markup-icon {\n display: inline-block;\n width: 28px;\n height: 28px;\n border: 0;\n}\n\n.Markup-icon span {\n vertical-align: middle;\n}\n\n.Markup-icon svg {\n padding: 2px;\n border: 0;\n fill: inherit;\n}\n\n.Markup-menuseparator {\n display: inline-block;\n vertical-align: middle;\n height: 28px;\n border-right: 1px solid lightgray;\n margin-right: 4px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuseparator {\n border-right: 1px solid gray;\n }\n}\n\n.Markup-menu-disabled .Markup-icon {\n cursor: default;\n}\n\n.Markup-menu-dropdown, .Markup-menu-dropdown-menu {\n background: inherit;\n text-align: left;\n white-space: nowrap;\n}\n\n.Markup-menu-dropdown span {\n vertical-align: middle;\n}\n\n.Markup-menu-dropdown-icon span {\n vertical-align: middle;\n}\n\n.Markup-menu-dropdown-wrap {\n display: flex;\n justify-content: space-between;\n padding: 0 4px;\n height: inherit;\n border-radius: 4px;\n background: inherit;\n}\n\n.Markup-menu-dropdown-icon-wrap {\n display: flex;\n justify-content: space-between;\n padding-right: 4px;\n width: 1.8em;\n height: inherit;\n border-radius: 4px;\n background: inherit;\n}\n\n.Markup-menu-dropdown-icon-wrap-noindicator {\n display: inline-flex;\n padding-right: 4px;\n width: 1em;\n height: inherit;\n border-radius: 4px;\n background: inherit;\n}\n\n/* For the paragraph style dropdown with a label, make the font smaller */\n.Markup-menu-dropdown {\n display: flex;\n justify-content: space-between;\n align-items: center;\n box-sizing: border-box;\n font-size: 0.8em;\n width: inherit;\n height: inherit;\n background: inherit;\n position: absolute;\n}\n\n/* But for the indicator, bump size up to match the icon-style dropdown */\n.Markup-menu-dropdown .Markup-menu-dropdown-indicator {\n font-size: 1.25em;\n}\n\n.Markup-menu-dropdown-icon {\n display: inline-flex;\n justify-content: space-between;\n font-size: inherit;\n width: inherit;\n cursor: pointer;\n position: absolute;\n}\n\n.Markup-menu-dropdown-indicator {\n opacity: .6;\n}\n\n.Markup-tooltip .Markup-menu {\n width: -webkit-fit-content;\n width: fit-content;\n white-space: pre;\n}\n\n.Markup-menu-dropdown-menu, .Markup-menu-submenu {\n position: absolute;\n background: inherit;\n padding: 2px;\n background: inherit;\n border: 1px solid gray;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid lightgray;\n }\n}\n\n.Markup-menu-dropdown-menu {\n margin-top: calc(1em + 6px);\n min-width: 4em;\n}\n\n.Markup-menu-dropdown-item {\n cursor: pointer;\n padding: 2px 8px 2px 4px;\n}\n\n/* Used to overlfow and ellipsis-truncate text in Dropdown menu items */\n.Markup-menuitem-clipped {\n white-space: nowrap; /* Required for text-overflow */\n overflow-x: hidden; /* Required for text-overflow */\n max-width: 30em;\n text-overflow: ellipsis;\n}\n\n.Markup-menu-dropdown-item:hover, .Markup-menu-submenu-wrap:hover {\n background: #f2f2f2;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-item:hover, .Markup-menu-submenu-wrap:hover {\n background: rgb(80, 80, 80);\n }\n}\n\n.Markup-menu-dropdown-item p, \n.Markup-menu-dropdown-item h1, \n.Markup-menu-dropdown-item h2, \n.Markup-menu-dropdown-item h3, \n.Markup-menu-dropdown-item h4, \n.Markup-menu-dropdown-item h5, \n.Markup-menu-dropdown-item h6, \n.Markup-menu-dropdown-item pre {\n padding: 0;\n margin: 0;\n min-height: 24px;\n}\n\n.Markup-stylelabel {\n display: flex;\n justify-content: space-between;\n align-items: center;\n white-space: pre;\n width: 100%;\n}\n\n.Markup-stylelabel-keymap {\n display: flex;\n justify-content: flex-end;\n font-size: 1.0rem;\n font-weight: normal;\n color: gray;\n}\n\n.Markup-menu-submenu-wrap:hover .Markup-menu-submenu, .Markup-menu-submenu-wrap-active .Markup-menu-submenu {\n display: block;\n}\n\n.Markup-menu-submenu-wrap {\n position: relative;\n margin-right: -4px;\n background: inherit;\n}\n\n.Markup-menu-submenu {\n display: none;\n min-width: 4em;\n left: 100%;\n top: -5px;\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: white;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-submenu {\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: black;\n }\n}\n\n.Markup-menu-submenu-label:after {\n content: \"\";\n border-top: 4px solid transparent;\n border-bottom: 4px solid transparent;\n border-left: 4px solid currentColor;\n opacity: .6;\n position: absolute;\n right: 4px;\n top: calc(50% - 4px);\n}\n\n.Markup-selection {\n position: absolute;\n border: 1px solid blue;\n background: transparent;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-selection {\n border: 1px solid lightblue;\n }\n}\n\n/* Toolbar-more styling */\n\n.Markup-toolbar-more {\n display: inline-flex;\n position: sticky;\n overflow: visible;\n width: 100%;\n font-size: 24px;\n vertical-align: middle;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n top: 35px;\n max-height: 38px;\n padding: 2px 8px;\n color: blue;\n background: rgba(250, 249, 246, 0.95);\n border-bottom: 1px solid lightgray;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar-more {\n color: rgb(250, 249, 246);\n background: rgba(40, 40, 43, 0.9);\n border-bottom: 1px solid gray;\n }\n}\n\n/* Searchbar styling */\n\n.Markup-searchbar {\n display: inline-block;\n font-size: 24px;\n vertical-align: middle;\n position: sticky;\n top: 35px;\n width: 100%;\n line-height: 30px;\n height: 37px;\n color: blue;\n background: rgba(250, 249, 246, 0.95);\n border-bottom: 1px solid lightgray;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n overflow: hidden;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-searchbar {\n color: rgb(250, 249, 246);\n background: rgba(40, 40, 43, 0.9);\n border-bottom: 1px solid gray;\n }\n}\n\n.Markup-searchbar input {\n appearance: none; /* Otherwise, in Safari/WebKit, the height is small and fixed */\n position: relative;\n font-size: 18px;\n line-height: 30px;\n height: 30px;\n width: calc(100% - 128px);\n margin: 0 8px;\n padding: 0 4px;\n outline: none;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid lightgray;\n border-radius: 6px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-searchbar input {\n color: rgb(250, 249, 246);\n background: rgb(40, 40, 43);\n border: 1px solid gray;\n }\n}\n\n.Markup-searchbar .Markup-searchbar-status {\n position: absolute;\n display: flex;\n justify-content: flex-end;\n align-items: center;\n white-space: nowrap;\n font-size: 12px;\n overflow-x: visible;\n height: 28px;\n top: 5px;\n left: calc(100% - 13em);\n width: 1px;\n color: gray;\n user-select: none;\n}\n\n/* Dialog/prompt styling for insert/edit actions */\n\n.Markup-prompt-overlay {\n\tposition: fixed;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\theight: 100%;\n\tbackground-color: rgba(0, 0, 0, 0.2);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt-overlay {\n background-color: rgba(255, 255, 255, 0.2);\n }\n}\n\n.Markup-toolbar-overlay {\n\tposition: absolute;\n\ttop: 0;\n\tleft: 0;\n\twidth: 100%;\n\tbackground-color: rgba(0, 0, 0, 0.1);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar-overlay {\n background-color: rgba(255, 255, 255, 0.1);\n }\n}\n\n.Markup-toolbar-overlay.Markup-searchbar-hidden {\n height: 38px;\n}\n\n.Markup-toolbar-overlay.Markup-searchbar-showing {\n height: 76px;\n}\n\n.Markup-prompt {\n margin: 0;\n font-size: 18px;\n background: white;\n padding: 8px;\n border: 1px solid silver;\n position: absolute;\n border-radius: 3px;\n box-shadow: -.5px 2px 5px rgba(0, 0, 0, 0.2);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt {\n background: black;\n box-shadow: -.5px 2px 5px rgba(255, 255, 255, 0.8);\n }\n}\n\n.Markup-prompt-link {\n height: 96px;\n width: 300px;\n}\n\n.Markup-prompt-image {\n height: 130px;\n width: 300px;\n}\n\n.Markup-prompt img {\n display: inline-block;\n vertical-align: middle;\n min-width: 28px;\n height: 28px;\n margin-right: 4px;\n}\n\n.Markup-prompt p {\n margin: 0 0 4px 0;\n font-weight: normal;\n color: black;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt p {\n color: white;\n }\n}\n\n.Markup-prompt input[type=\"text\"] {\n font-size: 100%;\n line-height: 28px;\n margin-top: 2px;\n padding: 1px 4px;\n width: 100%;\n appearance: none;\n background: #eee;\n outline: none;\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid lightgray;\n border-radius: 6px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt input[type=\"text\"] {\n color: rgb(250, 249, 246);\n background: rgb(40, 40, 43);\n border: 1px solid gray;\n }\n}\n\n.Markup-prompt input.invalid {\n color: red;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-prompt input.invalid {\n color: pink;\n }\n}\n\n.Markup-prompt-buttons {\n display: flex;\n vertical-align: middle;\n justify-content: space-between;\n justify-items: center;\n line-height: 28px;\n height: 28px;\n margin-top: 8px;\n margin-bottom: 8px;\n}\n\n.Markup-prompt-buttongroup {\n flex-shrink: 0;\n}\n\n.Markup-prompt-buttons img {\n aspect-ratio: auto;\n height: auto;\n object-fit: contain;\n}\n\n.Markup-prompt-buttons .Markup-menuitem {\n display: inline-flex;\n padding-right: 4px;\n padding-left: 4px;\n}\n\n/* The buttongroup contains OK and Cancel menuitems on the right */\n.Markup-prompt-buttongroup .Markup-menuitem {\n margin-right: 0;\n margin-left: 4px;\n}\n\n/* .Markup-menu-tablesizer is a specialized submenu */\n.Markup-menu-tablesizer {\n display: none;\n grid-template-columns: repeat(4, 1fr);\n grid-auto-rows: 18px;\n row-gap: 1px;\n column-gap: 1px;\n padding: 0;\n left: 100%;\n top: -5px;\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: white;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer {\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: black;\n }\n}\n\n.Markup-menu-submenu-wrap:hover .Markup-menu-tablesizer, .Markup-menu-submenu-wrap-active .Markup-menu-tablesizer {\n display: grid;\n}\n\n.Markup-menu-dropdown-menu, .Markup-menu-tablesizer {\n position: absolute;\n background: inherit;\n padding: 2px;\n background: inherit;\n border: 1px solid gray;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid lightgray;\n }\n}\n\n.Markup-menu-tablesizer .Markup-menu-dropdown-item {\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n border: 1px solid blue;\n width: 18px;\n height: 18px;\n padding: 0;\n font-size: 13px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer .Markup-menu-dropdown-item {\n border: 1px solid lightblue;\n }\n}\n\n.Markup-menu-tablesizer .Markup-menuitem-active {\n height: 13px;\n padding-top: 3px;\n fill: black;\n color: black;\n background: blue;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer .Markup-menuitem-active {\n fill: black;\n color: black;\n background: lightblue;\n }\n}");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The registry used to hold delegates, configs, handlers, and
|
|
@@ -19574,6 +19574,11 @@ var ordering = {
|
|
|
19574
19574
|
formatBar: 50,
|
|
19575
19575
|
search: 60
|
|
19576
19576
|
};
|
|
19577
|
+
var menus = {
|
|
19578
|
+
styleName: true,
|
|
19579
|
+
tableHeader: true,
|
|
19580
|
+
tableBorder: true
|
|
19581
|
+
};
|
|
19577
19582
|
var insertBar = {
|
|
19578
19583
|
link: true,
|
|
19579
19584
|
image: true,
|
|
@@ -19602,10 +19607,6 @@ var styleBar = {
|
|
|
19602
19607
|
list: true,
|
|
19603
19608
|
dent: true
|
|
19604
19609
|
};
|
|
19605
|
-
var tableMenu = {
|
|
19606
|
-
header: true,
|
|
19607
|
-
border: true
|
|
19608
|
-
};
|
|
19609
19610
|
var help = {
|
|
19610
19611
|
style: "Set paragraph style",
|
|
19611
19612
|
bold: "Toggle bold",
|
|
@@ -19660,11 +19661,11 @@ var icons = {
|
|
|
19660
19661
|
var toolbarConfig = {
|
|
19661
19662
|
visibility: visibility,
|
|
19662
19663
|
ordering: ordering,
|
|
19664
|
+
menus: menus,
|
|
19663
19665
|
insertBar: insertBar,
|
|
19664
19666
|
formatBar: formatBar,
|
|
19665
19667
|
styleMenu: styleMenu,
|
|
19666
19668
|
styleBar: styleBar,
|
|
19667
|
-
tableMenu: tableMenu,
|
|
19668
19669
|
help: help,
|
|
19669
19670
|
augmentation: augmentation,
|
|
19670
19671
|
icons: icons
|
|
@@ -19721,6 +19722,11 @@ var toolbarConfig = {
|
|
|
19721
19722
|
* "formatBar": 50, // Format bar (b, i, u, etc) order if it is visible
|
|
19722
19723
|
* "search": 60, // Search item (hide/show search bar) order if it is visible
|
|
19723
19724
|
* },
|
|
19725
|
+
* "menus": {
|
|
19726
|
+
* "styleName": true // Whether to show the style name or just use a paragraph symbol
|
|
19727
|
+
* "tableHeader": true, // Whether the "Header" item is visible in the "Table->Add" menu
|
|
19728
|
+
* "tableBorder": true, // Whether the "Border" item is visible in the "Table" menu
|
|
19729
|
+
* },
|
|
19724
19730
|
* "insertBar": {
|
|
19725
19731
|
* "link": true, // Whether the link menu item is visible
|
|
19726
19732
|
* "image": true, // Whether the image menu item is visible
|
|
@@ -19749,10 +19755,6 @@ var toolbarConfig = {
|
|
|
19749
19755
|
* "list": true, // Whether bullet and numbered list items are visible
|
|
19750
19756
|
* "dent": true, // Whether indent and outdent items are visible
|
|
19751
19757
|
* },
|
|
19752
|
-
* "tableMenu": {
|
|
19753
|
-
* "header": true, // Whether the "Header" item is visible in the "Table->Add" menu
|
|
19754
|
-
* "border": true, // Whether the "Border" item is visible in the "Table" menu
|
|
19755
|
-
* },
|
|
19756
19758
|
* "augmentation": {
|
|
19757
19759
|
* "prepend": null, // Name of a registered array of cmdItems to prepend
|
|
19758
19760
|
* "append": null // Name of a registered array of cmdItems to append
|
|
@@ -19893,7 +19895,7 @@ class ToolbarConfig {
|
|
|
19893
19895
|
}
|
|
19894
19896
|
|
|
19895
19897
|
var undo = "Mod-z";
|
|
19896
|
-
var redo = "Shift-
|
|
19898
|
+
var redo = "Mod-Shift-z";
|
|
19897
19899
|
var link = [
|
|
19898
19900
|
"Mod-K",
|
|
19899
19901
|
"Mod-k"
|
|
@@ -19914,12 +19916,12 @@ var number = [
|
|
|
19914
19916
|
"Ctrl-o"
|
|
19915
19917
|
];
|
|
19916
19918
|
var indent = [
|
|
19917
|
-
"Mod
|
|
19918
|
-
"
|
|
19919
|
+
"Mod->",
|
|
19920
|
+
"Mod-]"
|
|
19919
19921
|
];
|
|
19920
19922
|
var outdent = [
|
|
19921
|
-
"Mod
|
|
19922
|
-
"
|
|
19923
|
+
"Mod-<",
|
|
19924
|
+
"Mod-["
|
|
19923
19925
|
];
|
|
19924
19926
|
var bold = [
|
|
19925
19927
|
"Mod-B",
|
|
@@ -20096,13 +20098,11 @@ var focusAfterLoad = true;
|
|
|
20096
20098
|
var selectImage = false;
|
|
20097
20099
|
var insertLink = false;
|
|
20098
20100
|
var insertImage = false;
|
|
20099
|
-
var showStyle = true;
|
|
20100
20101
|
var behaviorConfig = {
|
|
20101
20102
|
focusAfterLoad: focusAfterLoad,
|
|
20102
20103
|
selectImage: selectImage,
|
|
20103
20104
|
insertLink: insertLink,
|
|
20104
|
-
insertImage: insertImage
|
|
20105
|
-
showStyle: showStyle
|
|
20105
|
+
insertImage: insertImage
|
|
20106
20106
|
};
|
|
20107
20107
|
|
|
20108
20108
|
/**
|
|
@@ -20141,7 +20141,6 @@ var behaviorConfig = {
|
|
|
20141
20141
|
* "selectImage": false, // Whether to show a "Select..." button in the Insert Image dialog
|
|
20142
20142
|
* "insertLink": false, // Whether to defer to the MarkupDelegate rather than use the default LinkDialog
|
|
20143
20143
|
* "insertImage": false, // Whether to defer to the MarkupDelagate rather than use the default ImageDialog
|
|
20144
|
-
* "showStyle": true // Whether to show the selected style in a labeled drop-down rather than a (smaller) icon
|
|
20145
20144
|
* }
|
|
20146
20145
|
* ```
|
|
20147
20146
|
*/
|
|
@@ -22819,14 +22818,14 @@ function tableMenuItems(config) {
|
|
|
22819
22818
|
let icons = config.toolbar.icons;
|
|
22820
22819
|
let help = config.toolbar.help;
|
|
22821
22820
|
let items = [];
|
|
22822
|
-
let {
|
|
22821
|
+
let { tableHeader, tableBorder } = config.toolbar.menus;
|
|
22823
22822
|
items.push(new TableCreateSubmenu({title: 'Insert table', label: 'Insert'}));
|
|
22824
22823
|
let addItems = [];
|
|
22825
22824
|
addItems.push(tableEditItem(addRowCommand('BEFORE'), {label: 'Row above'}));
|
|
22826
22825
|
addItems.push(tableEditItem(addRowCommand('AFTER'), {label: 'Row below'}));
|
|
22827
22826
|
addItems.push(tableEditItem(addColCommand('BEFORE'), {label: 'Column before'}));
|
|
22828
22827
|
addItems.push(tableEditItem(addColCommand('AFTER'), {label: 'Column after'}));
|
|
22829
|
-
if (
|
|
22828
|
+
if (tableHeader) addItems.push(
|
|
22830
22829
|
tableEditItem(
|
|
22831
22830
|
addHeaderCommand(), {
|
|
22832
22831
|
label: 'Header',
|
|
@@ -22848,7 +22847,7 @@ function tableMenuItems(config) {
|
|
|
22848
22847
|
label: 'Delete',
|
|
22849
22848
|
enable: (state) => { return isTableSelected(state) }
|
|
22850
22849
|
}));
|
|
22851
|
-
if (
|
|
22850
|
+
if (tableBorder) {
|
|
22852
22851
|
let borderItems = [];
|
|
22853
22852
|
borderItems.push(tableBorderItem(setBorderCommand('cell'), {label: 'All'}));
|
|
22854
22853
|
borderItems.push(tableBorderItem(setBorderCommand('outer'), {label: 'Outer'}));
|
|
@@ -22999,9 +22998,10 @@ function formatItem(markType, markName, options) {
|
|
|
22999
22998
|
*/
|
|
23000
22999
|
function styleMenuItems(config, schema) {
|
|
23001
23000
|
let keymap = config.keymap;
|
|
23001
|
+
let toolbar = config.toolbar;
|
|
23002
23002
|
let help = config.toolbar.help;
|
|
23003
23003
|
let items = [];
|
|
23004
|
-
let { p, h1, h2, h3, h4, h5, h6, pre } =
|
|
23004
|
+
let { p, h1, h2, h3, h4, h5, h6, pre } = toolbar.styleMenu;
|
|
23005
23005
|
if (p) items.push(new ParagraphStyleItem(schema.nodes.paragraph, 'P', { label: p, keymap: baseKeyString('p', keymap) }));
|
|
23006
23006
|
if (h1) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H1', { label: h1, keymap: baseKeyString('h1', keymap), attrs: { level: 1 }}));
|
|
23007
23007
|
if (h2) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H2', { label: h2, keymap: baseKeyString('h2', keymap), attrs: { level: 2 }}));
|
|
@@ -23010,20 +23010,19 @@ function styleMenuItems(config, schema) {
|
|
|
23010
23010
|
if (h5) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H5', { label: h5, keymap: baseKeyString('h5', keymap), attrs: { level: 5 }}));
|
|
23011
23011
|
if (h6) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H6', { label: h6, keymap: baseKeyString('h6', keymap), attrs: { level: 6 }}));
|
|
23012
23012
|
if (pre) items.push(new ParagraphStyleItem(schema.nodes.code_block, 'PRE', { label: pre, keymap: baseKeyString('pre', keymap) }));
|
|
23013
|
-
if (
|
|
23013
|
+
if (toolbar.menus.styleName) {
|
|
23014
23014
|
let titleUpdate = (state) => {
|
|
23015
23015
|
let styleElement = paragraphStyle(state).toLowerCase();
|
|
23016
23016
|
// The paragraphStyle comes back with a trailing "+"" when across multiple styles
|
|
23017
23017
|
let multiple = styleElement[styleElement.length - 1] == '+';
|
|
23018
23018
|
let singleElement = multiple ? styleElement.slice(0, -1) : styleElement;
|
|
23019
|
-
let label =
|
|
23019
|
+
let label = toolbar.styleMenu[singleElement];
|
|
23020
23020
|
return label ? (multiple ? label + '+' : label) : styleElement
|
|
23021
23021
|
};
|
|
23022
23022
|
let allLabels = [p, h1, h2, h3, h4, h5, h6, pre].filter(Boolean).flatMap(l => [l, l + '+']);
|
|
23023
23023
|
return [new Dropdown(items, { title: help.style, label: 'Style', titleUpdate: titleUpdate, labels: allLabels})]
|
|
23024
23024
|
} else {
|
|
23025
|
-
|
|
23026
|
-
return [new Dropdown(items, { title: help.style, icon: icons.paragraphStyle })]
|
|
23025
|
+
return [new Dropdown(items, { title: help.style, icon: toolbar.icons.paragraphStyle })]
|
|
23027
23026
|
}
|
|
23028
23027
|
}
|
|
23029
23028
|
|
|
@@ -23340,9 +23339,9 @@ function buildKeymap(config, schema) {
|
|
|
23340
23339
|
*/
|
|
23341
23340
|
let toolbarView;
|
|
23342
23341
|
|
|
23343
|
-
function toolbar(content) {
|
|
23342
|
+
function toolbar(content, visible) {
|
|
23344
23343
|
let view = function view(editorView) {
|
|
23345
|
-
toolbarView = new ToolbarView(editorView, content);
|
|
23344
|
+
toolbarView = new ToolbarView(editorView, content, visible);
|
|
23346
23345
|
return toolbarView;
|
|
23347
23346
|
};
|
|
23348
23347
|
return new Plugin({view})
|
|
@@ -23350,7 +23349,7 @@ function toolbar(content) {
|
|
|
23350
23349
|
|
|
23351
23350
|
class ToolbarView {
|
|
23352
23351
|
|
|
23353
|
-
constructor(editorView, content) {
|
|
23352
|
+
constructor(editorView, content, visible) {
|
|
23354
23353
|
this.prefix = prefix + "-toolbar";
|
|
23355
23354
|
this.editorView = editorView;
|
|
23356
23355
|
this.content = content;
|
|
@@ -23358,11 +23357,13 @@ class ToolbarView {
|
|
|
23358
23357
|
|
|
23359
23358
|
// Embed the toolbar and editorView in a wrapper.
|
|
23360
23359
|
this.wrapper = crelt("div", {class: this.prefix + "-wrapper"});
|
|
23361
|
-
|
|
23360
|
+
|
|
23361
|
+
// Handle the case where the toolbar is hidden initially.
|
|
23362
|
+
let toolbarClass = visible ? this.prefix : this.prefix + "-hidden";
|
|
23363
|
+
this.toolbar = this.wrapper.appendChild(crelt("div", {class: toolbarClass, id: this.prefix}));
|
|
23362
23364
|
// Since the menu adjusts to fit using a `MoreItem` for contents that doesn't fit,
|
|
23363
23365
|
// we need to refresh how it is rendered when resizing takes place.
|
|
23364
23366
|
window.addEventListener('resize', ()=>{ this.refresh(); });
|
|
23365
|
-
this.toolbar.className = this.prefix;
|
|
23366
23367
|
if (editorView.dom.parentNode)
|
|
23367
23368
|
editorView.dom.parentNode.replaceChild(this.wrapper, editorView.dom);
|
|
23368
23369
|
this.wrapper.appendChild(editorView.dom);
|
|
@@ -23676,11 +23677,9 @@ function markupSetup(config, schema) {
|
|
|
23676
23677
|
gapCursor(),
|
|
23677
23678
|
];
|
|
23678
23679
|
|
|
23679
|
-
//
|
|
23680
|
-
|
|
23681
|
-
|
|
23682
|
-
plugins.push(toolbar(content));
|
|
23683
|
-
}
|
|
23680
|
+
// Always build the toolbar, but only show it if the config indicates it is visible
|
|
23681
|
+
let content = buildMenuItems(config, schema);
|
|
23682
|
+
plugins.push(toolbar(content, config.toolbar.visibility.toolbar));
|
|
23684
23683
|
|
|
23685
23684
|
plugins.push(history());
|
|
23686
23685
|
|
|
@@ -24877,6 +24876,17 @@ class MarkupEditor {
|
|
|
24877
24876
|
}
|
|
24878
24877
|
}
|
|
24879
24878
|
|
|
24879
|
+
/**
|
|
24880
|
+
* Set the visibility of the toolbarView using the display property.
|
|
24881
|
+
*
|
|
24882
|
+
* @param {boolean} visible True if the toolbar should be visible, else false.
|
|
24883
|
+
*/
|
|
24884
|
+
function setToolbarVisible(visible) {
|
|
24885
|
+
if (toolbarView) {
|
|
24886
|
+
toolbarView.toolbar.style.display = visible ? '' : 'none';
|
|
24887
|
+
}
|
|
24888
|
+
}
|
|
24889
|
+
|
|
24880
24890
|
/**
|
|
24881
24891
|
* The object whose methods comprise the MarkupEditor API.
|
|
24882
24892
|
*/
|
|
@@ -24934,6 +24944,7 @@ const MU = {
|
|
|
24934
24944
|
setHTML,
|
|
24935
24945
|
setStyle,
|
|
24936
24946
|
setTestHTML,
|
|
24947
|
+
setToolbarVisible,
|
|
24937
24948
|
setTopLevelAttributes,
|
|
24938
24949
|
testBlockquoteEnter,
|
|
24939
24950
|
testExtractContents,
|
package/package.json
CHANGED