markupeditor 0.9.6 → 0.9.7
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/behaviorconfig.json +2 -1
- package/config/keymapconfig.json +0 -1
- package/dist/custom-elements.json +29 -3
- package/dist/markup-editor.js +47 -17
- package/package.json +1 -1
- package/styles/toolbar.css +19 -7
package/config/keymapconfig.json
CHANGED
|
@@ -138,7 +138,7 @@
|
|
|
138
138
|
"type": {
|
|
139
139
|
"text": "object"
|
|
140
140
|
},
|
|
141
|
-
"default": "{ activeConfig, activeView, addButton, addCol, addDiv, addHeader, addRow, borderTable, cancelSearch, consoleLog, cutImage, deactivateSearch, deleteLink, deleteTableArea, doRedo, doUndo, emptyDocument, focus, focusOn, focused, getDataImages, getHTML, getHeight, getImageAttributes, getLinkAttributes, getSelectionState, getTestHTML, indent, insertImage, insertLink, insertTable, loadUserFiles, modifyImage, openImageDialog, openLinkDialog, outdent, padBottom, pasteHTML, pasteText, removeAllDivs, removeButton, removeDiv, resetSelection, savedDataImage, searchFor, setActiveView, setHTML, setStyle, setTestHTML, setTopLevelAttributes, testBlockquoteEnter, testExtractContents, testListEnter, testPasteHTMLPreprocessing, testPasteTextPreprocessing, toggleBold, toggleCode, toggleItalic, toggleListItem, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, // Helpers to create custom toolbar items MenuItem, Dropdown, DropdownSubmenu, cmdItem, renderGrouped, renderDropdownItems, toggleSearch, // Config access ToolbarConfig, KeymapConfig, BehaviorConfig, // Registry access registerAugmentation, registerConfig, registerDelegate, registerMessageHandler, }",
|
|
141
|
+
"default": "{ activeConfig, activeView, addButton, addCol, addDiv, addHeader, addRow, borderTable, cancelSearch, canUndo, canRedo, consoleLog, cutImage, deactivateSearch, deleteLink, deleteTableArea, doRedo, doUndo, emptyDocument, focus, focusOn, focused, getDataImages, getHTML, getHeight, getImageAttributes, getLinkAttributes, getSelectionState, getTestHTML, indent, insertImage, insertLink, insertTable, loadUserFiles, modifyImage, openImageDialog, openLinkDialog, outdent, padBottom, pasteHTML, pasteText, removeAllDivs, removeButton, removeDiv, resetSelection, savedDataImage, searchFor, setActiveView, setHTML, setStyle, setTestHTML, setTopLevelAttributes, testBlockquoteEnter, testExtractContents, testListEnter, testPasteHTMLPreprocessing, testPasteTextPreprocessing, toggleBold, toggleCode, toggleItalic, toggleListItem, toggleStrike, toggleSubscript, toggleSuperscript, toggleUnderline, // Helpers to create custom toolbar items MenuItem, Dropdown, DropdownSubmenu, cmdItem, renderGrouped, renderDropdownItems, toggleSearch, // Config access ToolbarConfig, KeymapConfig, BehaviorConfig, // Registry access registerAugmentation, registerConfig, registerDelegate, registerMessageHandler, }",
|
|
142
142
|
"description": "The object whose methods comprise the MarkupEditor API."
|
|
143
143
|
}
|
|
144
144
|
],
|
|
@@ -803,6 +803,16 @@
|
|
|
803
803
|
"name": "doUndo",
|
|
804
804
|
"description": "Undo the previous action."
|
|
805
805
|
},
|
|
806
|
+
{
|
|
807
|
+
"kind": "function",
|
|
808
|
+
"name": "canUndo",
|
|
809
|
+
"description": "Return true if we can undo in the current state; else false."
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"kind": "function",
|
|
813
|
+
"name": "canRedo",
|
|
814
|
+
"description": "Return true if we can redo in the current state; else false."
|
|
815
|
+
},
|
|
806
816
|
{
|
|
807
817
|
"kind": "function",
|
|
808
818
|
"name": "doRedo",
|
|
@@ -1551,6 +1561,22 @@
|
|
|
1551
1561
|
"module": "src/markup.js"
|
|
1552
1562
|
}
|
|
1553
1563
|
},
|
|
1564
|
+
{
|
|
1565
|
+
"kind": "js",
|
|
1566
|
+
"name": "canUndo",
|
|
1567
|
+
"declaration": {
|
|
1568
|
+
"name": "canUndo",
|
|
1569
|
+
"module": "src/markup.js"
|
|
1570
|
+
}
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
"kind": "js",
|
|
1574
|
+
"name": "canRedo",
|
|
1575
|
+
"declaration": {
|
|
1576
|
+
"name": "canRedo",
|
|
1577
|
+
"module": "src/markup.js"
|
|
1578
|
+
}
|
|
1579
|
+
},
|
|
1554
1580
|
{
|
|
1555
1581
|
"kind": "js",
|
|
1556
1582
|
"name": "doRedo",
|
|
@@ -3569,7 +3595,7 @@
|
|
|
3569
3595
|
"declarations": [
|
|
3570
3596
|
{
|
|
3571
3597
|
"kind": "class",
|
|
3572
|
-
"description": "KeymapConfig contains static utility methods to obtain a JavaScript object with properties \nthat define the key mapping configuration of the MarkupEditor toolbar. The class makes it convenient \nto write and use the utility methods, but an instance of KeymapConfig itself is not meaningful.\n\n`KeymapConfig.standard()` is the default for the MarkupEditor. It can be overridden by \npassing a new KeymapConfig by name using the `keymap` attribute of the `<markup-editor>` \nelement. You can use the pre-defined static methods like `standard()` and customize what \nit returns, or you can use your own KeymapConfig.\n\nTo customize the key mapping, for example, in a `userscript` named `mykeymap.js`:\n\n```\nimport {MU} from \"src/markup-editor.js\"\nlet keymapConfig = MU.KeymapConfig.standard(); // Grab the standard keymap config as a baseline\nkeymapConfig.link = [\"Ctrl-L\", \"Ctrl-l\"]; // Use Control+L instead of Command+k\nMU.registerConfig(keymapConfig, \"MyKeymapConfig\") // Register the instance by name so we can reference it\n```\n\nThen, where you insert the `<markup-editor>` element, set the KeymapConfig by name:\n\n```\n<markup-editor userscript=\"mykeymap.js\" keymap=\"MyKeymapConfig\">\n```\n \nNote that the key mapping will exist and work regardless of whether you disable a toolbar \nor a specific item in a menu. For example, undo/redo by default map to Mod-z/Shift-Mod-z even \nthough the \"correctionBar\" is off by default in the MarkupEditor. You can remove a key mapping \nby setting its value to null or an empty string. \n\nThe following properties are supported:\n\n```\n{\n // Correction\n \"undo\": \"Mod-z\",\n \"redo\": \"Shift-Mod-z\",\n // Insert\n \"link\": [\"Mod-K\", \"Mod-k\"],\n
|
|
3598
|
+
"description": "KeymapConfig contains static utility methods to obtain a JavaScript object with properties \nthat define the key mapping configuration of the MarkupEditor toolbar. The class makes it convenient \nto write and use the utility methods, but an instance of KeymapConfig itself is not meaningful.\n\n`KeymapConfig.standard()` is the default for the MarkupEditor. It can be overridden by \npassing a new KeymapConfig by name using the `keymap` attribute of the `<markup-editor>` \nelement. You can use the pre-defined static methods like `standard()` and customize what \nit returns, or you can use your own KeymapConfig.\n\nTo customize the key mapping, for example, in a `userscript` named `mykeymap.js`:\n\n```\nimport {MU} from \"src/markup-editor.js\"\nlet keymapConfig = MU.KeymapConfig.standard(); // Grab the standard keymap config as a baseline\nkeymapConfig.link = [\"Ctrl-L\", \"Ctrl-l\"]; // Use Control+L instead of Command+k\nMU.registerConfig(keymapConfig, \"MyKeymapConfig\") // Register the instance by name so we can reference it\n```\n\nThen, where you insert the `<markup-editor>` element, set the KeymapConfig by name:\n\n```\n<markup-editor userscript=\"mykeymap.js\" keymap=\"MyKeymapConfig\">\n```\n \nNote that the key mapping will exist and work regardless of whether you disable a toolbar \nor a specific item in a menu. For example, undo/redo by default map to Mod-z/Shift-Mod-z even \nthough the \"correctionBar\" is off by default in the MarkupEditor. You can remove a key mapping \nby setting its value to null or an empty string. \n\nThe following properties are supported:\n\n```\n{\n // Correction\n \"undo\": \"Mod-z\",\n \"redo\": \"Shift-Mod-z\",\n // Insert (no hotkeys for image or table)\n \"link\": [\"Mod-K\", \"Mod-k\"],\n // Stylemenu\n \"p\": \"Ctrl-Shift-0\",\n \"h1\": \"Ctrl-Shift-1\",\n \"h2\": \"Ctrl-Shift-2\",\n \"h3\": \"Ctrl-Shift-3\",\n \"h4\": \"Ctrl-Shift-4\",\n \"h5\": \"Ctrl-Shift-5\",\n \"h6\": \"Ctrl-Shift-6\",\n // Stylebar\n \"bullet\": [\"Ctrl-U\", \"Ctrl-u\"],\n \"number\": [\"Ctrl-O\", \"Ctrl-o\"],\n \"indent\": [\"Mod-]\", \"Ctrl-q\"],\n \"outdent\": [\"Mod-[\", \"Shift-Ctrl-q\"],\n // Format\n \"bold\": [\"Mod-B\", \"Mod-b\"],\n \"italic\": [\"Mod-I\", \"Mod-i\"],\n \"underline\": [\"Mod-U\", \"Mod-u\"],\n \"strikethrough\": [\"Ctrl-S\", \"Ctrl-s\"],\n \"code\": \"Mod-`\",\n \"subscript\": \"Ctrl-Mod--\",\n \"superscript\": \"Ctrl-Mod-+\",\n // Search\n \"search\": [\"Ctrl-F\", \"Ctrl-f\"],\n}\n```",
|
|
3573
3599
|
"name": "KeymapConfig",
|
|
3574
3600
|
"members": [
|
|
3575
3601
|
{
|
|
@@ -3656,7 +3682,7 @@
|
|
|
3656
3682
|
"declarations": [
|
|
3657
3683
|
{
|
|
3658
3684
|
"kind": "class",
|
|
3659
|
-
"description": "BehaviorConfig contains static utility methods to obtain a JavaScript object with properties \nthat define the behavior configuration of the MarkupEditor. The class makes it convenient \nto write and use the utility methods, but an instance of BehaviorConfig itself is not meaningful.\n\n`BehaviorConfig.standard()` is the default for the MarkupEditor. It can be overridden by \npassing a new BehaviorConfig by name using the `behavior` attribute of the `<markup-editor> `\nelement. You can use the pre-defined static methods like `standard()` and customize what \nit returns, or you can use your own BehaviorConfig.\n\nTo customize the behavior config, for example, in a `userscript` named `mybehavior.js`:\n\n```\nimport {MU} from \"src/markup-editor.js\"\nlet behaviorConfig = MU.BehaviorConfig.desktop() // Use the desktop config as a baseline\nMU.registerConfig(behaviorConfig, \"MyBehaviorConfig\") // Register the instance by name so we can reference it\n```\n\nThen, where you insert the `<markup-editor>` element, set the BehaviorConfig by name:\n\n```\n<markup-editor userscript=\"mybehavior.js\" behavior=\"MyBehaviorConfig\">\n```\n \nBehaviorConfig lets you control whether the editor takes focus immediately or not, and\nallows you to defer to the MarkupDelegate for insert options, so you can use your own \n(perhaps \"native\") dialogs for file selection, link insertion, and image insertion.\n\nThe following properties are supported:\n\n```\n{\n \"focusAfterLoad\": true, // Whether the editor should take focus after loading\n \"selectImage\": false, // Whether to show a \"Select...\" button in the Insert Image dialog\n \"insertLink\": false, // Whether to defer to the MarkupDelegate rather than use the default LinkDialog\n \"insertImage\": false, // Whether to defer to the MarkupDelagate rather than use the default ImageDialog\n}\n```",
|
|
3685
|
+
"description": "BehaviorConfig contains static utility methods to obtain a JavaScript object with properties \nthat define the behavior configuration of the MarkupEditor. The class makes it convenient \nto write and use the utility methods, but an instance of BehaviorConfig itself is not meaningful.\n\n`BehaviorConfig.standard()` is the default for the MarkupEditor. It can be overridden by \npassing a new BehaviorConfig by name using the `behavior` attribute of the `<markup-editor> `\nelement. You can use the pre-defined static methods like `standard()` and customize what \nit returns, or you can use your own BehaviorConfig.\n\nTo customize the behavior config, for example, in a `userscript` named `mybehavior.js`:\n\n```\nimport {MU} from \"src/markup-editor.js\"\nlet behaviorConfig = MU.BehaviorConfig.desktop() // Use the desktop config as a baseline\nMU.registerConfig(behaviorConfig, \"MyBehaviorConfig\") // Register the instance by name so we can reference it\n```\n\nThen, where you insert the `<markup-editor>` element, set the BehaviorConfig by name:\n\n```\n<markup-editor userscript=\"mybehavior.js\" behavior=\"MyBehaviorConfig\">\n```\n \nBehaviorConfig lets you control whether the editor takes focus immediately or not, and\nallows you to defer to the MarkupDelegate for insert options, so you can use your own \n(perhaps \"native\") dialogs for file selection, link insertion, and image insertion.\n\nThe following properties are supported:\n\n```\n{\n \"focusAfterLoad\": true, // Whether the editor should take focus after loading\n \"selectImage\": false, // Whether to show a \"Select...\" button in the Insert Image dialog\n \"insertLink\": false, // Whether to defer to the MarkupDelegate rather than use the default LinkDialog\n \"insertImage\": false, // Whether to defer to the MarkupDelagate rather than use the default ImageDialog\n \"showStyle\": true // Whether to show the selected style in a labeled drop-down rather than a (smaller) icon\n}\n```",
|
|
3660
3686
|
"name": "BehaviorConfig",
|
|
3661
3687
|
"members": [
|
|
3662
3688
|
{
|
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: inline-block;\n padding: 0 4px;\n min-width: 3.0em;\n height: inherit;\n border-radius: 4px;\n background: inherit;\n}\n\n.Markup-menu-dropdown-icon-wrap {\n display: inline-block;\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.Markup-menu-dropdown {\n display: inline-flex;\n justify-content: space-between;\n min-width: 3.0em;\n height: inherit;\n background: inherit;\n position: absolute;\n}\n\n.Markup-menu-dropdown-icon {\n display: inline-flex;\n justify-content: space-between;\n width: 1.8em;\n cursor: pointer;\n position: absolute;\n}\n\n.Markup-menu-dropdown-indicator, .Markup-menu-dropdown-icon-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-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 width: 2.9em;\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
|
|
@@ -17920,6 +17920,9 @@ function _getSelectionState() {
|
|
|
17920
17920
|
state['sub'] = markTypes.has(schema.marks.sub);
|
|
17921
17921
|
state['sup'] = markTypes.has(schema.marks.sup);
|
|
17922
17922
|
state['code'] = markTypes.has(schema.marks.code);
|
|
17923
|
+
// Undo/redo availability
|
|
17924
|
+
state['canundo'] = canUndo();
|
|
17925
|
+
state['canredo'] = canRedo();
|
|
17923
17926
|
return state;
|
|
17924
17927
|
}
|
|
17925
17928
|
/**
|
|
@@ -18115,10 +18118,11 @@ function _getTableAttributes(state) {
|
|
|
18115
18118
|
}
|
|
18116
18119
|
|
|
18117
18120
|
/**
|
|
18118
|
-
* Return the paragraph style at the selection.
|
|
18121
|
+
* Return the paragraph style at the selection.
|
|
18122
|
+
* If the selection contains multiple styles, return the first one with a "+" after it.
|
|
18119
18123
|
*
|
|
18120
18124
|
* @ignore
|
|
18121
|
-
* @returns {string} {Tag name
|
|
18125
|
+
* @returns {string} {Tag name} that represents the selected paragraph style.
|
|
18122
18126
|
*/
|
|
18123
18127
|
function _getParagraphStyle() {
|
|
18124
18128
|
const view = activeView();
|
|
@@ -18128,11 +18132,15 @@ function paragraphStyle(state) {
|
|
|
18128
18132
|
const selection = state.selection;
|
|
18129
18133
|
const nodeTypes = new Set();
|
|
18130
18134
|
state.doc.nodesBetween(selection.from, selection.to, node => {
|
|
18131
|
-
if (node
|
|
18135
|
+
if (_paragraphStyleFor(node)) {
|
|
18132
18136
|
nodeTypes.add(node.type);
|
|
18133
|
-
|
|
18137
|
+
return false
|
|
18138
|
+
} else {
|
|
18139
|
+
return node.isBlock // Keep traversing if we are in a block
|
|
18140
|
+
}
|
|
18134
18141
|
});
|
|
18135
|
-
|
|
18142
|
+
let firstStyle = _paragraphStyleFor(selection.$anchor.parent);
|
|
18143
|
+
return (nodeTypes.size <= 1) ? firstStyle : firstStyle + '+'
|
|
18136
18144
|
}
|
|
18137
18145
|
|
|
18138
18146
|
/**
|
|
@@ -18390,6 +18398,18 @@ function doUndo() {
|
|
|
18390
18398
|
return result
|
|
18391
18399
|
}
|
|
18392
18400
|
|
|
18401
|
+
/** Return true if we can undo in the current state; else false. */
|
|
18402
|
+
function canUndo() {
|
|
18403
|
+
const view = activeView();
|
|
18404
|
+
return undoCommand()(view.state)
|
|
18405
|
+
}
|
|
18406
|
+
|
|
18407
|
+
/** Return true if we can redo in the current state; else false. */
|
|
18408
|
+
function canRedo() {
|
|
18409
|
+
const view = activeView();
|
|
18410
|
+
return redoCommand()(view.state)
|
|
18411
|
+
}
|
|
18412
|
+
|
|
18393
18413
|
/**
|
|
18394
18414
|
* Return a command to undo and do the proper callbacks.
|
|
18395
18415
|
*
|
|
@@ -19705,10 +19725,6 @@ var link = [
|
|
|
19705
19725
|
"Mod-K",
|
|
19706
19726
|
"Mod-k"
|
|
19707
19727
|
];
|
|
19708
|
-
var image = [
|
|
19709
|
-
"Mod-G",
|
|
19710
|
-
"Mod-g"
|
|
19711
|
-
];
|
|
19712
19728
|
var p = "Ctrl-Shift-0";
|
|
19713
19729
|
var h1 = "Ctrl-Shift-1";
|
|
19714
19730
|
var h2 = "Ctrl-Shift-2";
|
|
@@ -19759,7 +19775,6 @@ var keymapConfig = {
|
|
|
19759
19775
|
undo: undo,
|
|
19760
19776
|
redo: redo,
|
|
19761
19777
|
link: link,
|
|
19762
|
-
image: image,
|
|
19763
19778
|
p: p,
|
|
19764
19779
|
h1: h1,
|
|
19765
19780
|
h2: h2,
|
|
@@ -19818,10 +19833,8 @@ var keymapConfig = {
|
|
|
19818
19833
|
* // Correction
|
|
19819
19834
|
* "undo": "Mod-z",
|
|
19820
19835
|
* "redo": "Shift-Mod-z",
|
|
19821
|
-
* // Insert
|
|
19836
|
+
* // Insert (no hotkeys for image or table)
|
|
19822
19837
|
* "link": ["Mod-K", "Mod-k"],
|
|
19823
|
-
* "image": ["Mod-G", "Mod-g"],
|
|
19824
|
-
* //"table": ["Mod-T", "Mod-t"], // Does not work
|
|
19825
19838
|
* // Stylemenu
|
|
19826
19839
|
* "p": "Ctrl-Shift-0",
|
|
19827
19840
|
* "h1": "Ctrl-Shift-1",
|
|
@@ -19910,11 +19923,13 @@ var focusAfterLoad = true;
|
|
|
19910
19923
|
var selectImage = false;
|
|
19911
19924
|
var insertLink = false;
|
|
19912
19925
|
var insertImage = false;
|
|
19926
|
+
var showStyle = true;
|
|
19913
19927
|
var behaviorConfig = {
|
|
19914
19928
|
focusAfterLoad: focusAfterLoad,
|
|
19915
19929
|
selectImage: selectImage,
|
|
19916
19930
|
insertLink: insertLink,
|
|
19917
|
-
insertImage: insertImage
|
|
19931
|
+
insertImage: insertImage,
|
|
19932
|
+
showStyle: showStyle
|
|
19918
19933
|
};
|
|
19919
19934
|
|
|
19920
19935
|
/**
|
|
@@ -19953,6 +19968,7 @@ var behaviorConfig = {
|
|
|
19953
19968
|
* "selectImage": false, // Whether to show a "Select..." button in the Insert Image dialog
|
|
19954
19969
|
* "insertLink": false, // Whether to defer to the MarkupDelegate rather than use the default LinkDialog
|
|
19955
19970
|
* "insertImage": false, // Whether to defer to the MarkupDelagate rather than use the default ImageDialog
|
|
19971
|
+
* "showStyle": true // Whether to show the selected style in a labeled drop-down rather than a (smaller) icon
|
|
19956
19972
|
* }
|
|
19957
19973
|
* ```
|
|
19958
19974
|
*/
|
|
@@ -22859,7 +22875,6 @@ function formatItem(markType, markName, options) {
|
|
|
22859
22875
|
*/
|
|
22860
22876
|
function styleMenuItems(config, schema) {
|
|
22861
22877
|
let keymap = config.keymap;
|
|
22862
|
-
let icons = config.toolbar.icons;
|
|
22863
22878
|
let items = [];
|
|
22864
22879
|
let { p, h1, h2, h3, h4, h5, h6, pre } = config.toolbar.styleMenu;
|
|
22865
22880
|
if (p) items.push(new ParagraphStyleItem(schema.nodes.paragraph, 'P', { label: p, keymap: baseKeyString('p', keymap) }));
|
|
@@ -22870,7 +22885,20 @@ function styleMenuItems(config, schema) {
|
|
|
22870
22885
|
if (h5) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H5', { label: h5, keymap: baseKeyString('h5', keymap), attrs: { level: 5 }}));
|
|
22871
22886
|
if (h6) items.push(new ParagraphStyleItem(schema.nodes.heading, 'H6', { label: h6, keymap: baseKeyString('h6', keymap), attrs: { level: 6 }}));
|
|
22872
22887
|
if (pre) items.push(new ParagraphStyleItem(schema.nodes.code_block, 'PRE', { label: pre }));
|
|
22873
|
-
|
|
22888
|
+
if (config.behavior.showStyle) {
|
|
22889
|
+
let titleUpdate = (state) => {
|
|
22890
|
+
let styleElement = paragraphStyle(state).toLowerCase();
|
|
22891
|
+
// The paragraphStyle comes back with a trailing "+"" when across multiple styles
|
|
22892
|
+
let multiple = styleElement[styleElement.length - 1] == '+';
|
|
22893
|
+
let singleElement = multiple ? styleElement.slice(0, -1) : styleElement;
|
|
22894
|
+
let label = config.toolbar.styleMenu[singleElement];
|
|
22895
|
+
return label ? (multiple ? label + '+' : label) : styleElement
|
|
22896
|
+
};
|
|
22897
|
+
return [new Dropdown(items, { title: 'Set paragraph style', label: 'Style', titleUpdate: titleUpdate})]
|
|
22898
|
+
} else {
|
|
22899
|
+
let icons = config.toolbar.icons;
|
|
22900
|
+
return [new Dropdown(items, { title: 'Set paragraph style', icon: icons.paragraphStyle })]
|
|
22901
|
+
}
|
|
22874
22902
|
}
|
|
22875
22903
|
|
|
22876
22904
|
/**
|
|
@@ -24733,6 +24761,8 @@ const MU = {
|
|
|
24733
24761
|
addRow,
|
|
24734
24762
|
borderTable,
|
|
24735
24763
|
cancelSearch,
|
|
24764
|
+
canUndo,
|
|
24765
|
+
canRedo,
|
|
24736
24766
|
consoleLog,
|
|
24737
24767
|
cutImage,
|
|
24738
24768
|
deactivateSearch,
|
package/package.json
CHANGED
package/styles/toolbar.css
CHANGED
|
@@ -174,16 +174,18 @@
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
.Markup-menu-dropdown-wrap {
|
|
177
|
-
display:
|
|
177
|
+
display: flex;
|
|
178
|
+
justify-content: space-between;
|
|
178
179
|
padding: 0 4px;
|
|
179
|
-
|
|
180
|
+
width: 2.9em;
|
|
180
181
|
height: inherit;
|
|
181
182
|
border-radius: 4px;
|
|
182
183
|
background: inherit;
|
|
183
184
|
}
|
|
184
185
|
|
|
185
186
|
.Markup-menu-dropdown-icon-wrap {
|
|
186
|
-
display:
|
|
187
|
+
display: flex;
|
|
188
|
+
justify-content: space-between;
|
|
187
189
|
padding-right: 4px;
|
|
188
190
|
width: 1.8em;
|
|
189
191
|
height: inherit;
|
|
@@ -200,24 +202,34 @@
|
|
|
200
202
|
background: inherit;
|
|
201
203
|
}
|
|
202
204
|
|
|
205
|
+
/* For the paragraph style dropdown with a label, make the font smaller */
|
|
203
206
|
.Markup-menu-dropdown {
|
|
204
|
-
display:
|
|
207
|
+
display: flex;
|
|
205
208
|
justify-content: space-between;
|
|
206
|
-
|
|
209
|
+
align-items: center;
|
|
210
|
+
box-sizing: border-box;
|
|
211
|
+
font-size: 0.8em;
|
|
212
|
+
width: inherit;
|
|
207
213
|
height: inherit;
|
|
208
214
|
background: inherit;
|
|
209
215
|
position: absolute;
|
|
210
216
|
}
|
|
211
217
|
|
|
218
|
+
/* But for the indicator, bump size up to match the icon-style dropdown */
|
|
219
|
+
.Markup-menu-dropdown .Markup-menu-dropdown-indicator {
|
|
220
|
+
font-size: 1.25em;
|
|
221
|
+
}
|
|
222
|
+
|
|
212
223
|
.Markup-menu-dropdown-icon {
|
|
213
224
|
display: inline-flex;
|
|
214
225
|
justify-content: space-between;
|
|
215
|
-
|
|
226
|
+
font-size: inherit;
|
|
227
|
+
width: inherit;
|
|
216
228
|
cursor: pointer;
|
|
217
229
|
position: absolute;
|
|
218
230
|
}
|
|
219
231
|
|
|
220
|
-
.Markup-menu-dropdown-indicator
|
|
232
|
+
.Markup-menu-dropdown-indicator {
|
|
221
233
|
opacity: .6;
|
|
222
234
|
}
|
|
223
235
|
|