markupeditor 0.9.12 → 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
|
|
@@ -16725,6 +16725,20 @@ function getDataImages() {
|
|
|
16725
16725
|
return dataImages
|
|
16726
16726
|
}
|
|
16727
16727
|
|
|
16728
|
+
/**
|
|
16729
|
+
* Return an array of `src` attributes for images that contain relative references, empty if there are none.
|
|
16730
|
+
*
|
|
16731
|
+
* @returns {Array<string>}
|
|
16732
|
+
*/
|
|
16733
|
+
function getLocalImages() {
|
|
16734
|
+
const isAbsoluteURL = src => { try { return !!new URL(src) } catch { return false } };
|
|
16735
|
+
const isRelative = src =>
|
|
16736
|
+
!!src && !isAbsoluteURL(src) && !src.startsWith('data:') && !src.startsWith('/');
|
|
16737
|
+
return Array.from(activeEditorElement().getElementsByTagName('img'))
|
|
16738
|
+
.map(img => img.getAttribute('src'))
|
|
16739
|
+
.filter(isRelative)
|
|
16740
|
+
}
|
|
16741
|
+
|
|
16728
16742
|
/**
|
|
16729
16743
|
* We saved an image at a new location or translated it from data to a file reference,
|
|
16730
16744
|
* so we need to update the document to reflect it.
|
|
@@ -17176,7 +17190,7 @@ function focusOn(id) {
|
|
|
17176
17190
|
const view = activeView();
|
|
17177
17191
|
const {node, pos} = _getNode(id);
|
|
17178
17192
|
if (node && (node.attrs.id !== selectedID())) {
|
|
17179
|
-
const selection =
|
|
17193
|
+
const selection = TextSelection.near(view.state.tr.doc.resolve(pos));
|
|
17180
17194
|
const transaction = view.state.tr.setSelection(selection).scrollIntoView();
|
|
17181
17195
|
view.dispatch(transaction);
|
|
17182
17196
|
}}
|
|
@@ -17451,7 +17465,7 @@ function toggleListItem$1(listType) {
|
|
|
17451
17465
|
command(view.state, (transaction) => {
|
|
17452
17466
|
const newState = view.state.apply(transaction);
|
|
17453
17467
|
view.updateState(newState);
|
|
17454
|
-
});
|
|
17468
|
+
}, view);
|
|
17455
17469
|
}}
|
|
17456
17470
|
/**
|
|
17457
17471
|
* Return the type of list the selection is in, else null.
|
|
@@ -19560,6 +19574,11 @@ var ordering = {
|
|
|
19560
19574
|
formatBar: 50,
|
|
19561
19575
|
search: 60
|
|
19562
19576
|
};
|
|
19577
|
+
var menus = {
|
|
19578
|
+
styleName: true,
|
|
19579
|
+
tableHeader: true,
|
|
19580
|
+
tableBorder: true
|
|
19581
|
+
};
|
|
19563
19582
|
var insertBar = {
|
|
19564
19583
|
link: true,
|
|
19565
19584
|
image: true,
|
|
@@ -19588,10 +19607,6 @@ var styleBar = {
|
|
|
19588
19607
|
list: true,
|
|
19589
19608
|
dent: true
|
|
19590
19609
|
};
|
|
19591
|
-
var tableMenu = {
|
|
19592
|
-
header: true,
|
|
19593
|
-
border: true
|
|
19594
|
-
};
|
|
19595
19610
|
var help = {
|
|
19596
19611
|
style: "Set paragraph style",
|
|
19597
19612
|
bold: "Toggle bold",
|
|
@@ -19646,11 +19661,11 @@ var icons = {
|
|
|
19646
19661
|
var toolbarConfig = {
|
|
19647
19662
|
visibility: visibility,
|
|
19648
19663
|
ordering: ordering,
|
|
19664
|
+
menus: menus,
|
|
19649
19665
|
insertBar: insertBar,
|
|
19650
19666
|
formatBar: formatBar,
|
|
19651
19667
|
styleMenu: styleMenu,
|
|
19652
19668
|
styleBar: styleBar,
|
|
19653
|
-
tableMenu: tableMenu,
|
|
19654
19669
|
help: help,
|
|
19655
19670
|
augmentation: augmentation,
|
|
19656
19671
|
icons: icons
|
|
@@ -19707,6 +19722,11 @@ var toolbarConfig = {
|
|
|
19707
19722
|
* "formatBar": 50, // Format bar (b, i, u, etc) order if it is visible
|
|
19708
19723
|
* "search": 60, // Search item (hide/show search bar) order if it is visible
|
|
19709
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
|
+
* },
|
|
19710
19730
|
* "insertBar": {
|
|
19711
19731
|
* "link": true, // Whether the link menu item is visible
|
|
19712
19732
|
* "image": true, // Whether the image menu item is visible
|
|
@@ -19735,10 +19755,6 @@ var toolbarConfig = {
|
|
|
19735
19755
|
* "list": true, // Whether bullet and numbered list items are visible
|
|
19736
19756
|
* "dent": true, // Whether indent and outdent items are visible
|
|
19737
19757
|
* },
|
|
19738
|
-
* "tableMenu": {
|
|
19739
|
-
* "header": true, // Whether the "Header" item is visible in the "Table->Add" menu
|
|
19740
|
-
* "border": true, // Whether the "Border" item is visible in the "Table" menu
|
|
19741
|
-
* },
|
|
19742
19758
|
* "augmentation": {
|
|
19743
19759
|
* "prepend": null, // Name of a registered array of cmdItems to prepend
|
|
19744
19760
|
* "append": null // Name of a registered array of cmdItems to append
|
|
@@ -19879,7 +19895,7 @@ class ToolbarConfig {
|
|
|
19879
19895
|
}
|
|
19880
19896
|
|
|
19881
19897
|
var undo = "Mod-z";
|
|
19882
|
-
var redo = "Shift-
|
|
19898
|
+
var redo = "Mod-Shift-z";
|
|
19883
19899
|
var link = [
|
|
19884
19900
|
"Mod-K",
|
|
19885
19901
|
"Mod-k"
|
|
@@ -19900,12 +19916,12 @@ var number = [
|
|
|
19900
19916
|
"Ctrl-o"
|
|
19901
19917
|
];
|
|
19902
19918
|
var indent = [
|
|
19903
|
-
"Mod
|
|
19904
|
-
"
|
|
19919
|
+
"Mod->",
|
|
19920
|
+
"Mod-]"
|
|
19905
19921
|
];
|
|
19906
19922
|
var outdent = [
|
|
19907
|
-
"Mod
|
|
19908
|
-
"
|
|
19923
|
+
"Mod-<",
|
|
19924
|
+
"Mod-["
|
|
19909
19925
|
];
|
|
19910
19926
|
var bold = [
|
|
19911
19927
|
"Mod-B",
|
|
@@ -20082,13 +20098,11 @@ var focusAfterLoad = true;
|
|
|
20082
20098
|
var selectImage = false;
|
|
20083
20099
|
var insertLink = false;
|
|
20084
20100
|
var insertImage = false;
|
|
20085
|
-
var showStyle = true;
|
|
20086
20101
|
var behaviorConfig = {
|
|
20087
20102
|
focusAfterLoad: focusAfterLoad,
|
|
20088
20103
|
selectImage: selectImage,
|
|
20089
20104
|
insertLink: insertLink,
|
|
20090
|
-
insertImage: insertImage
|
|
20091
|
-
showStyle: showStyle
|
|
20105
|
+
insertImage: insertImage
|
|
20092
20106
|
};
|
|
20093
20107
|
|
|
20094
20108
|
/**
|
|
@@ -20127,7 +20141,6 @@ var behaviorConfig = {
|
|
|
20127
20141
|
* "selectImage": false, // Whether to show a "Select..." button in the Insert Image dialog
|
|
20128
20142
|
* "insertLink": false, // Whether to defer to the MarkupDelegate rather than use the default LinkDialog
|
|
20129
20143
|
* "insertImage": false, // Whether to defer to the MarkupDelagate rather than use the default ImageDialog
|
|
20130
|
-
* "showStyle": true // Whether to show the selected style in a labeled drop-down rather than a (smaller) icon
|
|
20131
20144
|
* }
|
|
20132
20145
|
* ```
|
|
20133
20146
|
*/
|
|
@@ -22805,14 +22818,14 @@ function tableMenuItems(config) {
|
|
|
22805
22818
|
let icons = config.toolbar.icons;
|
|
22806
22819
|
let help = config.toolbar.help;
|
|
22807
22820
|
let items = [];
|
|
22808
|
-
let {
|
|
22821
|
+
let { tableHeader, tableBorder } = config.toolbar.menus;
|
|
22809
22822
|
items.push(new TableCreateSubmenu({title: 'Insert table', label: 'Insert'}));
|
|
22810
22823
|
let addItems = [];
|
|
22811
22824
|
addItems.push(tableEditItem(addRowCommand('BEFORE'), {label: 'Row above'}));
|
|
22812
22825
|
addItems.push(tableEditItem(addRowCommand('AFTER'), {label: 'Row below'}));
|
|
22813
22826
|
addItems.push(tableEditItem(addColCommand('BEFORE'), {label: 'Column before'}));
|
|
22814
22827
|
addItems.push(tableEditItem(addColCommand('AFTER'), {label: 'Column after'}));
|
|
22815
|
-
if (
|
|
22828
|
+
if (tableHeader) addItems.push(
|
|
22816
22829
|
tableEditItem(
|
|
22817
22830
|
addHeaderCommand(), {
|
|
22818
22831
|
label: 'Header',
|
|
@@ -22834,7 +22847,7 @@ function tableMenuItems(config) {
|
|
|
22834
22847
|
label: 'Delete',
|
|
22835
22848
|
enable: (state) => { return isTableSelected(state) }
|
|
22836
22849
|
}));
|
|
22837
|
-
if (
|
|
22850
|
+
if (tableBorder) {
|
|
22838
22851
|
let borderItems = [];
|
|
22839
22852
|
borderItems.push(tableBorderItem(setBorderCommand('cell'), {label: 'All'}));
|
|
22840
22853
|
borderItems.push(tableBorderItem(setBorderCommand('outer'), {label: 'Outer'}));
|
|
@@ -22985,9 +22998,10 @@ function formatItem(markType, markName, options) {
|
|
|
22985
22998
|
*/
|
|
22986
22999
|
function styleMenuItems(config, schema) {
|
|
22987
23000
|
let keymap = config.keymap;
|
|
23001
|
+
let toolbar = config.toolbar;
|
|
22988
23002
|
let help = config.toolbar.help;
|
|
22989
23003
|
let items = [];
|
|
22990
|
-
let { p, h1, h2, h3, h4, h5, h6, pre } =
|
|
23004
|
+
let { p, h1, h2, h3, h4, h5, h6, pre } = toolbar.styleMenu;
|
|
22991
23005
|
if (p) items.push(new ParagraphStyleItem(schema.nodes.paragraph, 'P', { label: p, keymap: baseKeyString('p', keymap) }));
|
|
22992
23006
|
if (h1) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H1', { label: h1, keymap: baseKeyString('h1', keymap), attrs: { level: 1 }}));
|
|
22993
23007
|
if (h2) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H2', { label: h2, keymap: baseKeyString('h2', keymap), attrs: { level: 2 }}));
|
|
@@ -22996,20 +23010,19 @@ function styleMenuItems(config, schema) {
|
|
|
22996
23010
|
if (h5) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H5', { label: h5, keymap: baseKeyString('h5', keymap), attrs: { level: 5 }}));
|
|
22997
23011
|
if (h6) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H6', { label: h6, keymap: baseKeyString('h6', keymap), attrs: { level: 6 }}));
|
|
22998
23012
|
if (pre) items.push(new ParagraphStyleItem(schema.nodes.code_block, 'PRE', { label: pre, keymap: baseKeyString('pre', keymap) }));
|
|
22999
|
-
if (
|
|
23013
|
+
if (toolbar.menus.styleName) {
|
|
23000
23014
|
let titleUpdate = (state) => {
|
|
23001
23015
|
let styleElement = paragraphStyle(state).toLowerCase();
|
|
23002
23016
|
// The paragraphStyle comes back with a trailing "+"" when across multiple styles
|
|
23003
23017
|
let multiple = styleElement[styleElement.length - 1] == '+';
|
|
23004
23018
|
let singleElement = multiple ? styleElement.slice(0, -1) : styleElement;
|
|
23005
|
-
let label =
|
|
23019
|
+
let label = toolbar.styleMenu[singleElement];
|
|
23006
23020
|
return label ? (multiple ? label + '+' : label) : styleElement
|
|
23007
23021
|
};
|
|
23008
23022
|
let allLabels = [p, h1, h2, h3, h4, h5, h6, pre].filter(Boolean).flatMap(l => [l, l + '+']);
|
|
23009
23023
|
return [new Dropdown(items, { title: help.style, label: 'Style', titleUpdate: titleUpdate, labels: allLabels})]
|
|
23010
23024
|
} else {
|
|
23011
|
-
|
|
23012
|
-
return [new Dropdown(items, { title: help.style, icon: icons.paragraphStyle })]
|
|
23025
|
+
return [new Dropdown(items, { title: help.style, icon: toolbar.icons.paragraphStyle })]
|
|
23013
23026
|
}
|
|
23014
23027
|
}
|
|
23015
23028
|
|
|
@@ -23326,9 +23339,9 @@ function buildKeymap(config, schema) {
|
|
|
23326
23339
|
*/
|
|
23327
23340
|
let toolbarView;
|
|
23328
23341
|
|
|
23329
|
-
function toolbar(content) {
|
|
23342
|
+
function toolbar(content, visible) {
|
|
23330
23343
|
let view = function view(editorView) {
|
|
23331
|
-
toolbarView = new ToolbarView(editorView, content);
|
|
23344
|
+
toolbarView = new ToolbarView(editorView, content, visible);
|
|
23332
23345
|
return toolbarView;
|
|
23333
23346
|
};
|
|
23334
23347
|
return new Plugin({view})
|
|
@@ -23336,7 +23349,7 @@ function toolbar(content) {
|
|
|
23336
23349
|
|
|
23337
23350
|
class ToolbarView {
|
|
23338
23351
|
|
|
23339
|
-
constructor(editorView, content) {
|
|
23352
|
+
constructor(editorView, content, visible) {
|
|
23340
23353
|
this.prefix = prefix + "-toolbar";
|
|
23341
23354
|
this.editorView = editorView;
|
|
23342
23355
|
this.content = content;
|
|
@@ -23344,11 +23357,13 @@ class ToolbarView {
|
|
|
23344
23357
|
|
|
23345
23358
|
// Embed the toolbar and editorView in a wrapper.
|
|
23346
23359
|
this.wrapper = crelt("div", {class: this.prefix + "-wrapper"});
|
|
23347
|
-
|
|
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}));
|
|
23348
23364
|
// Since the menu adjusts to fit using a `MoreItem` for contents that doesn't fit,
|
|
23349
23365
|
// we need to refresh how it is rendered when resizing takes place.
|
|
23350
23366
|
window.addEventListener('resize', ()=>{ this.refresh(); });
|
|
23351
|
-
this.toolbar.className = this.prefix;
|
|
23352
23367
|
if (editorView.dom.parentNode)
|
|
23353
23368
|
editorView.dom.parentNode.replaceChild(this.wrapper, editorView.dom);
|
|
23354
23369
|
this.wrapper.appendChild(editorView.dom);
|
|
@@ -23662,11 +23677,9 @@ function markupSetup(config, schema) {
|
|
|
23662
23677
|
gapCursor(),
|
|
23663
23678
|
];
|
|
23664
23679
|
|
|
23665
|
-
//
|
|
23666
|
-
|
|
23667
|
-
|
|
23668
|
-
plugins.push(toolbar(content));
|
|
23669
|
-
}
|
|
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));
|
|
23670
23683
|
|
|
23671
23684
|
plugins.push(history());
|
|
23672
23685
|
|
|
@@ -24863,6 +24876,17 @@ class MarkupEditor {
|
|
|
24863
24876
|
}
|
|
24864
24877
|
}
|
|
24865
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
|
+
|
|
24866
24890
|
/**
|
|
24867
24891
|
* The object whose methods comprise the MarkupEditor API.
|
|
24868
24892
|
*/
|
|
@@ -24891,6 +24915,7 @@ const MU = {
|
|
|
24891
24915
|
focusOn,
|
|
24892
24916
|
focused,
|
|
24893
24917
|
getDataImages,
|
|
24918
|
+
getLocalImages,
|
|
24894
24919
|
getHTML,
|
|
24895
24920
|
getHeight,
|
|
24896
24921
|
getImageAttributes,
|
|
@@ -24919,6 +24944,7 @@ const MU = {
|
|
|
24919
24944
|
setHTML,
|
|
24920
24945
|
setStyle,
|
|
24921
24946
|
setTestHTML,
|
|
24947
|
+
setToolbarVisible,
|
|
24922
24948
|
setTopLevelAttributes,
|
|
24923
24949
|
testBlockquoteEnter,
|
|
24924
24950
|
testExtractContents,
|
package/package.json
CHANGED