markupeditor 0.9.16 → 0.9.18
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 +8 -8
- package/config/toolbarconfig.json +5 -2
- package/dist/markup-editor.js +145 -60
- package/package.json +1 -1
- package/styles/markup.css +8 -0
- package/styles/toolbar.css +2 -0
package/config/keymapconfig.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"undo": "Mod-z",
|
|
3
3
|
"redo": "Mod-Shift-z",
|
|
4
|
-
"link":
|
|
4
|
+
"link": "Mod-k",
|
|
5
5
|
"p": "Ctrl-Shift-0",
|
|
6
6
|
"h1": "Ctrl-Shift-1",
|
|
7
7
|
"h2": "Ctrl-Shift-2",
|
|
@@ -9,16 +9,16 @@
|
|
|
9
9
|
"h4": "Ctrl-Shift-4",
|
|
10
10
|
"h5": "Ctrl-Shift-5",
|
|
11
11
|
"h6": "Ctrl-Shift-6",
|
|
12
|
-
"bullet":
|
|
13
|
-
"number":
|
|
12
|
+
"bullet": "Ctrl-u",
|
|
13
|
+
"number": "Ctrl-o",
|
|
14
14
|
"indent": ["Mod->", "Mod-]"],
|
|
15
15
|
"outdent": ["Mod-<", "Mod-["],
|
|
16
|
-
"bold":
|
|
17
|
-
"italic":
|
|
18
|
-
"underline":
|
|
19
|
-
"strikethrough":
|
|
16
|
+
"bold": "Mod-b",
|
|
17
|
+
"italic": "Mod-i",
|
|
18
|
+
"underline": "Mod-u",
|
|
19
|
+
"strikethrough": "Ctrl-s",
|
|
20
20
|
"code": "Mod-`",
|
|
21
21
|
"subscript": "Ctrl-Mod--",
|
|
22
22
|
"superscript": "Ctrl-Mod-+",
|
|
23
|
-
"search":
|
|
23
|
+
"search": "Ctrl-f"
|
|
24
24
|
}
|
|
@@ -24,7 +24,8 @@
|
|
|
24
24
|
"insertBar": {
|
|
25
25
|
"link": true,
|
|
26
26
|
"image": true,
|
|
27
|
-
"tableMenu": true
|
|
27
|
+
"tableMenu": true,
|
|
28
|
+
"hRule": true
|
|
28
29
|
},
|
|
29
30
|
"formatBar": {
|
|
30
31
|
"bold": true,
|
|
@@ -65,6 +66,7 @@
|
|
|
65
66
|
"link": "Insert/edit link",
|
|
66
67
|
"image": "Insert/edit image",
|
|
67
68
|
"table": "Insert/edit table",
|
|
69
|
+
"hRule": "Insert horizontal rule",
|
|
68
70
|
"search": "Toggle search",
|
|
69
71
|
"searchForward": "Search forward",
|
|
70
72
|
"searchBackward": "Search backward",
|
|
@@ -107,6 +109,7 @@
|
|
|
107
109
|
"searchBackward": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z\"/></svg>",
|
|
108
110
|
"matchCase": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"m131-252 165-440h79l165 440h-76l-39-112H247l-40 112h-76Zm139-176h131l-64-182h-4l-63 182Zm395 186q-51 0-81-27.5T554-342q0-44 34.5-72.5T677-443q23 0 45 4t38 11v-12q0-29-20.5-47T685-505q-23 0-42 9.5T610-468l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T689-393q-32 0-50 14t-18 37q0 20 16 33t40 13Z\"/></svg>",
|
|
109
111
|
"paragraphStyle": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z\"/></svg>",
|
|
110
|
-
"more": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z\"/></svg>"
|
|
112
|
+
"more": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z\"/></svg>",
|
|
113
|
+
"hRule": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\"> <path d=\"M160-440v-80h640v80H160Z\" fill=\"currentColor\"></svg>"
|
|
111
114
|
}
|
|
112
115
|
}
|
package/dist/markup-editor.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const sheet$2 = new CSSStyleSheet();sheet$2.replaceSync("/**\n The CSS here was adapted from the ProseMirror example.\n The adaptations mainly consisted of removing styling when it interfered with\n markup.css in some way. These changes were commented-out and moved to the end of\n this file. Top-level Prosemirror styling was brought to the top of the file.\n Styling from search.css in prosemirror-search were added and modified.\n */\n\n .ProseMirror {\n position: relative;\n padding: 4px 8px 4px 8px;\n line-height: 1.2;\n outline: none;\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n font-variant-ligatures: none;\n }\n \n .ProseMirror pre {\n white-space: pre-wrap;\n }\n \n .ProseMirror li {\n position: relative;\n }\n \n .ProseMirror-hideselection *::selection { background: transparent; }\n .ProseMirror-hideselection *::-moz-selection { background: transparent; }\n .ProseMirror-hideselection { caret-color: transparent; }\n \n /* See https://github.com/ProseMirror/prosemirror/issues/1421#issuecomment-1759320191 */\n .ProseMirror [draggable][contenteditable=false] { user-select: text }\n \n .ProseMirror-selectednode {\n outline: 2px solid #8cf;\n }\n \n /* Make sure li selections wrap around markers */\n \n li.ProseMirror-selectednode {\n outline: none;\n }\n \n li.ProseMirror-selectednode:after {\n content: \"\";\n position: absolute;\n left: -32px;\n right: -2px; top: -2px; bottom: -2px;\n border: 2px solid #8cf;\n pointer-events: none;\n }\n \n /* Protect against generic img rules */\n \n img.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n }\n .ProseMirror-textblock-dropdown {\n min-width: 3em;\n }\n \n .ProseMirror-icon svg {\n fill: currentColor;\n height: 1em;\n }\n \n .ProseMirror-icon span {\n vertical-align: text-top;\n }\n .ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n }\n \n .ProseMirror-gapcursor:after {\n content: \"\";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n }\n \n @keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n }\n \n .ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n }\n \n .ProseMirror-prompt {\n background: white;\n padding: 5px 10px 5px 15px;\n border: 1px solid silver;\n position: fixed;\n border-radius: 3px;\n z-index: 11;\n box-shadow: -.5px 2px 5px rgba(0, 0, 0, .2);\n }\n \n .ProseMirror-prompt h5 {\n margin: 0;\n font-weight: normal;\n font-size: 100%;\n color: #444;\n }\n \n .ProseMirror-prompt input[type=\"text\"],\n .ProseMirror-prompt textarea {\n background: #eee;\n border: none;\n outline: none;\n }\n \n .ProseMirror-prompt input[type=\"text\"] {\n padding: 0 4px;\n }\n \n .ProseMirror-prompt-close {\n position: absolute;\n left: 2px; top: 1px;\n color: #666;\n border: none; background: transparent; padding: 0;\n }\n \n .ProseMirror-prompt-close:after {\n content: \"✕\";\n font-size: 12px;\n }\n \n .ProseMirror-invalid {\n background: #ffc;\n border: 1px solid #cc7;\n border-radius: 4px;\n padding: 5px 10px;\n position: absolute;\n min-width: 10em;\n }\n \n .ProseMirror-prompt-buttons {\n margin-top: 5px;\n /* display: none; */\n }\n \n /*\n \n #editor, .editor {\n border-radius: 4px;\n border: 2px solid rgba(0, 0, 0, 0.2);\n }\n \n .ProseMirror-example-setup-style hr {\n padding: 2px 10px;\n border: none;\n margin: 1em 0;\n }\n \n .ProseMirror-example-setup-style hr:after {\n content: \"\";\n display: block;\n height: 1px;\n background-color: silver;\n line-height: 2px;\n }\n \n .ProseMirror ul, .ProseMirror ol {\n padding-left: 30px;\n }\n \n .ProseMirror blockquote {\n padding-left: 1em;\n border-left: 3px solid #eee;\n margin-left: 0; margin-right: 0;\n }\n \n .ProseMirror-example-setup-style img {\n cursor: default;\n }\n \n .ProseMirror p { margin-bottom: 1em }\n */\n ");
|
|
2
2
|
|
|
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}");
|
|
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\nli > ul, li > ol {\n margin-bottom: 0;\n}\n\nli > h1, li > h2, li > h3, li > h4, li > h5, li > h6 {\n margin-bottom: 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: var(--Markup-button-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: calc(var(--Markup-button-size, 28px) + 10px);\n padding: 2px 8px;\n color: var(--Markup-accent-color, blue);\n background: var(--Markup-toolbar-bg, rgba(250, 249, 246, 0.95));\n border-bottom: 1px solid var(--Markup-border-color, lightgray);\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar {\n color: var(--Markup-accent-color, lightblue);\n background: var(--Markup-toolbar-bg, rgba(40, 40, 43, 0.9));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-button-size, 28px);\n height: var(--Markup-button-size, 28px);\n cursor: pointer;\n margin-right: 4px;\n border-radius: 4px;\n color: var(--Markup-accent-color, blue);\n border: 1px solid var(--Markup-accent-color, blue);\n background: var(--Markup-button-bg, white);\n fill: var(--Markup-accent-color, blue);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem {\n color: var(--Markup-accent-color, lightblue);\n border: 1px solid var(--Markup-accent-color, lightblue);\n /* border: 1px solid #4183c4; */\n background: var(--Markup-button-bg, black);\n fill: var(--Markup-accent-color, lightblue);\n }\n}\n\n.Markup-menuitem-active {\n fill: white;\n color: white;\n background: var(--Markup-accent-color, blue);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem-active {\n fill: black;\n color: black;\n background: var(--Markup-accent-color, 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: var(--Markup-button-size, 28px);\n height: var(--Markup-button-size, 28px);\n border: 0;\n}\n\n.Markup-icon span {\n vertical-align: middle;\n}\n\n.Markup-icon svg {\n width: var(--Markup-button-font-size, 24px);\n height: var(--Markup-button-font-size, 24px);\n padding: 2px;\n border: 0;\n fill: inherit;\n}\n\n.Markup-menuseparator {\n display: inline-block;\n vertical-align: middle;\n height: var(--Markup-button-size, 28px);\n border-right: 1px solid var(--Markup-border-color, lightgray);\n margin-right: 4px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuseparator {\n border-right: 1px solid var(--Markup-border-color, 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 var(--Markup-border-color, gray);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid var(--Markup-border-color, 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: var(--Markup-hover-bg, #f2f2f2);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-item:hover, .Markup-menu-submenu-wrap:hover {\n background: var(--Markup-hover-bg, 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: var(--Markup-button-bg, 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: var(--Markup-button-bg, 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 var(--Markup-accent-color, blue);\n background: transparent;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-selection {\n border: 1px solid var(--Markup-accent-color, 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: var(--Markup-button-font-size, 24px);\n vertical-align: middle;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n top: calc(var(--Markup-button-size, 28px) + 7px);\n max-height: calc(var(--Markup-button-size, 28px) + 10px);\n padding: 2px 8px;\n color: var(--Markup-accent-color, blue);\n background: var(--Markup-toolbar-bg, rgba(250, 249, 246, 0.95));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-accent-color, lightblue);\n background: var(--Markup-toolbar-bg, rgba(40, 40, 43, 0.9));\n border-bottom: 1px solid var(--Markup-border-color, gray);\n }\n}\n\n/* Searchbar styling */\n\n.Markup-searchbar {\n display: inline-block;\n font-size: var(--Markup-button-font-size, 24px);\n vertical-align: middle;\n position: sticky;\n top: calc(var(--Markup-button-size, 28px) + 7px);\n width: 100%;\n line-height: 30px;\n height: 37px;\n color: var(--Markup-accent-color, blue);\n background: var(--Markup-toolbar-bg, rgba(250, 249, 246, 0.95));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-accent-color, lightblue);\n background: var(--Markup-toolbar-bg, rgba(40, 40, 43, 0.9));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-button-bg, 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: var(--Markup-button-bg, 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 var(--Markup-border-color, gray);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid var(--Markup-border-color, 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 var(--Markup-accent-color, 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 var(--Markup-accent-color, 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: var(--Markup-accent-color, blue);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer .Markup-menuitem-active {\n fill: black;\n color: black;\n background: var(--Markup-accent-color, 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: var(--Markup-button-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: calc(var(--Markup-button-size, 28px) + 10px);\n padding: 2px 8px;\n color: var(--Markup-accent-color, blue);\n background: var(--Markup-toolbar-bg, rgba(250, 249, 246, 0.95));\n border-bottom: 1px solid var(--Markup-border-color, lightgray);\n -moz-box-sizing: border-box;\n box-sizing: border-box;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-toolbar {\n color: var(--Markup-accent-color, lightblue);\n background: var(--Markup-toolbar-bg, rgba(40, 40, 43, 0.9));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-button-size, 28px);\n height: var(--Markup-button-size, 28px);\n cursor: pointer;\n margin-right: 4px;\n border-radius: 4px;\n color: var(--Markup-accent-color, blue);\n border: 1px solid var(--Markup-accent-color, blue);\n background: var(--Markup-button-bg, white);\n fill: var(--Markup-accent-color, blue);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem {\n color: var(--Markup-accent-color, lightblue);\n border: 1px solid var(--Markup-accent-color, lightblue);\n /* border: 1px solid #4183c4; */\n background: var(--Markup-button-bg, black);\n fill: var(--Markup-accent-color, lightblue);\n }\n}\n\n.Markup-menuitem-active {\n fill: white;\n color: white;\n background: var(--Markup-accent-color, blue);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuitem-active {\n fill: black;\n color: black;\n background: var(--Markup-accent-color, 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: var(--Markup-button-size, 28px);\n height: var(--Markup-button-size, 28px);\n border: 0;\n}\n\n.Markup-icon span {\n vertical-align: middle;\n}\n\n.Markup-icon svg {\n width: var(--Markup-button-font-size, 24px);\n height: var(--Markup-button-font-size, 24px);\n padding: 2px;\n border: 0;\n fill: inherit;\n}\n\n.Markup-menuseparator {\n display: inline-block;\n vertical-align: middle;\n height: var(--Markup-button-size, 28px);\n border-right: 1px solid var(--Markup-border-color, lightgray);\n margin-right: 4px;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menuseparator {\n border-right: 1px solid var(--Markup-border-color, 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 var(--Markup-border-color, gray);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid var(--Markup-border-color, 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: var(--Markup-hover-bg, #f2f2f2);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-item:hover, .Markup-menu-submenu-wrap:hover {\n background: var(--Markup-hover-bg, 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 max-height: 80vh;\n overflow-y: auto;\n /* background cannot be inherited because of hover highlighting in dropdown */\n background: var(--Markup-button-bg, 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: var(--Markup-button-bg, 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 var(--Markup-accent-color, blue);\n background: transparent;\n}\n@media (prefers-color-scheme: dark) {\n .Markup-selection {\n border: 1px solid var(--Markup-accent-color, 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: var(--Markup-button-font-size, 24px);\n vertical-align: middle;\n border-top-left-radius: inherit;\n border-top-right-radius: inherit;\n top: calc(var(--Markup-button-size, 28px) + 7px);\n max-height: calc(var(--Markup-button-size, 28px) + 10px);\n padding: 2px 8px;\n color: var(--Markup-accent-color, blue);\n background: var(--Markup-toolbar-bg, rgba(250, 249, 246, 0.95));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-accent-color, lightblue);\n background: var(--Markup-toolbar-bg, rgba(40, 40, 43, 0.9));\n border-bottom: 1px solid var(--Markup-border-color, gray);\n }\n}\n\n/* Searchbar styling */\n\n.Markup-searchbar {\n display: inline-block;\n font-size: var(--Markup-button-font-size, 24px);\n vertical-align: middle;\n position: sticky;\n top: calc(var(--Markup-button-size, 28px) + 7px);\n width: 100%;\n line-height: 30px;\n height: 37px;\n color: var(--Markup-accent-color, blue);\n background: var(--Markup-toolbar-bg, rgba(250, 249, 246, 0.95));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-accent-color, lightblue);\n background: var(--Markup-toolbar-bg, rgba(40, 40, 43, 0.9));\n border-bottom: 1px solid var(--Markup-border-color, 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: var(--Markup-button-bg, 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: var(--Markup-button-bg, 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 var(--Markup-border-color, gray);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-dropdown-menu, .Markup-menu-submenu {\n border: 1px solid var(--Markup-border-color, 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 var(--Markup-accent-color, 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 var(--Markup-accent-color, 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: var(--Markup-accent-color, blue);\n}\n@media (prefers-color-scheme: dark) {\n .Markup-menu-tablesizer .Markup-menuitem-active {\n fill: black;\n color: black;\n background: var(--Markup-accent-color, lightblue);\n }\n}");
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* The registry used to hold delegates, configs, handlers, and
|
|
@@ -16582,13 +16582,26 @@ function matchIndex() {
|
|
|
16582
16582
|
* Paste html at the selection, replacing the selection as-needed.
|
|
16583
16583
|
*
|
|
16584
16584
|
* @param {string} html The HTML to be pasted
|
|
16585
|
-
* @param {ClipboardEvent |
|
|
16585
|
+
* @param {ClipboardEvent | null} event A mocked ClipboardEvent for testing
|
|
16586
16586
|
*/
|
|
16587
16587
|
function pasteHTML(html, event) {
|
|
16588
16588
|
const view = activeView();
|
|
16589
16589
|
view.pasteHTML(html, event);
|
|
16590
16590
|
stateChanged(view);
|
|
16591
16591
|
}
|
|
16592
|
+
/**
|
|
16593
|
+
* Paste the `text` into a code block. Caller determines whether to use this method
|
|
16594
|
+
* based on the selection state.
|
|
16595
|
+
*
|
|
16596
|
+
* @param {string} text The text to be pasted in a preformatted code block
|
|
16597
|
+
*/
|
|
16598
|
+
function pasteCode(text) {
|
|
16599
|
+
const view = activeView();
|
|
16600
|
+
if (!view) return
|
|
16601
|
+
view.dispatch(view.state.tr.insertText(text));
|
|
16602
|
+
stateChanged(view);
|
|
16603
|
+
}
|
|
16604
|
+
|
|
16592
16605
|
/**
|
|
16593
16606
|
* Do a custom paste operation of "text only", which we will extract from the html
|
|
16594
16607
|
* ourselves. First we get a node that conforms to the schema, which by definition
|
|
@@ -16598,7 +16611,7 @@ function pasteHTML(html, event) {
|
|
|
16598
16611
|
* unformatted text.
|
|
16599
16612
|
*
|
|
16600
16613
|
* @param {string} html The HTML to be pasted
|
|
16601
|
-
* @param {ClipboardEvent |
|
|
16614
|
+
* @param {ClipboardEvent | null} event A mocked ClipboardEvent for testing
|
|
16602
16615
|
*/
|
|
16603
16616
|
function pasteText(html, event) {
|
|
16604
16617
|
const node = _nodeFromHTML(html);
|
|
@@ -18283,10 +18296,11 @@ function paragraphStyle(state) {
|
|
|
18283
18296
|
|
|
18284
18297
|
/**
|
|
18285
18298
|
* Given a ProseMirror Node, return the HTML tag it corresponds to in the MarkupEditor.
|
|
18299
|
+
* Default is "P" if node.type.name is not recognized (e.g., for HR).
|
|
18286
18300
|
*
|
|
18287
18301
|
* @ignore
|
|
18288
18302
|
* @param {Node} node The node we want the paragraph style for
|
|
18289
|
-
* @returns { "P" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "PRE"
|
|
18303
|
+
* @returns { "P" | "H1" | "H2" | "H3" | "H4" | "H5" | "H6" | "PRE" }
|
|
18290
18304
|
*/
|
|
18291
18305
|
function _paragraphStyleFor(node) {
|
|
18292
18306
|
var style;
|
|
@@ -18300,6 +18314,8 @@ function _paragraphStyleFor(node) {
|
|
|
18300
18314
|
case 'code_block':
|
|
18301
18315
|
style = "PRE";
|
|
18302
18316
|
break;
|
|
18317
|
+
default:
|
|
18318
|
+
style = "P";
|
|
18303
18319
|
} return style;
|
|
18304
18320
|
}
|
|
18305
18321
|
function isIndented(activeState) {
|
|
@@ -18895,6 +18911,31 @@ function selectFullLink(view) {
|
|
|
18895
18911
|
view.dispatch(transaction);
|
|
18896
18912
|
}
|
|
18897
18913
|
|
|
18914
|
+
/********************************************************************************
|
|
18915
|
+
* Horizontal rule
|
|
18916
|
+
*/
|
|
18917
|
+
//MARK: Horizontal rile
|
|
18918
|
+
|
|
18919
|
+
/**
|
|
18920
|
+
* Insert the horizontal rule at the selection.
|
|
18921
|
+
*/
|
|
18922
|
+
function insertHRule() {
|
|
18923
|
+
const view = activeView();
|
|
18924
|
+
let command = insertHRuleCommand();
|
|
18925
|
+
return command(view.state, view.dispatch, view)
|
|
18926
|
+
}
|
|
18927
|
+
function insertHRuleCommand() {
|
|
18928
|
+
const commandAdapter = (state, dispatch, view) => {
|
|
18929
|
+
const hRuleNode = view.state.schema.nodes.horizontal_rule.create();
|
|
18930
|
+
const transaction = view.state.tr.replaceSelectionWith(hRuleNode, true);
|
|
18931
|
+
view.dispatch(transaction);
|
|
18932
|
+
stateChanged(view);
|
|
18933
|
+
return true;
|
|
18934
|
+
};
|
|
18935
|
+
|
|
18936
|
+
return commandAdapter
|
|
18937
|
+
}
|
|
18938
|
+
|
|
18898
18939
|
/********************************************************************************
|
|
18899
18940
|
* Images
|
|
18900
18941
|
*/
|
|
@@ -19310,6 +19351,17 @@ function _mergeHeaders(state, dispatch) {
|
|
|
19310
19351
|
const newState = state.apply(transaction);
|
|
19311
19352
|
mergeCells(newState, dispatch);
|
|
19312
19353
|
}}
|
|
19354
|
+
function isHRuleSelected(state) {
|
|
19355
|
+
let hRuleSelected = false;
|
|
19356
|
+
state.doc.nodesBetween(state.selection.from, state.selection.to, (node) => {
|
|
19357
|
+
if (node.type === state.schema.nodes.horizontal_rule) {
|
|
19358
|
+
hRuleSelected = true;
|
|
19359
|
+
return false;
|
|
19360
|
+
} return false;
|
|
19361
|
+
});
|
|
19362
|
+
return hRuleSelected
|
|
19363
|
+
}
|
|
19364
|
+
|
|
19313
19365
|
function isTableSelected(state) {
|
|
19314
19366
|
let tableSelected = false;
|
|
19315
19367
|
state.doc.nodesBetween(state.selection.from, state.selection.to, (node) => {
|
|
@@ -19582,7 +19634,8 @@ var menus = {
|
|
|
19582
19634
|
var insertBar = {
|
|
19583
19635
|
link: true,
|
|
19584
19636
|
image: true,
|
|
19585
|
-
tableMenu: true
|
|
19637
|
+
tableMenu: true,
|
|
19638
|
+
hRule: true
|
|
19586
19639
|
};
|
|
19587
19640
|
var formatBar = {
|
|
19588
19641
|
bold: true,
|
|
@@ -19623,6 +19676,7 @@ var help = {
|
|
|
19623
19676
|
link: "Insert/edit link",
|
|
19624
19677
|
image: "Insert/edit image",
|
|
19625
19678
|
table: "Insert/edit table",
|
|
19679
|
+
hRule: "Insert horizontal rule",
|
|
19626
19680
|
search: "Toggle search",
|
|
19627
19681
|
searchForward: "Search forward",
|
|
19628
19682
|
searchBackward: "Search backward",
|
|
@@ -19680,7 +19734,8 @@ var icons = {
|
|
|
19680
19734
|
searchBackward: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M560-240 320-480l240-240 56 56-184 184 184 184-56 56Z\"/></svg>",
|
|
19681
19735
|
matchCase: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"m131-252 165-440h79l165 440h-76l-39-112H247l-40 112h-76Zm139-176h131l-64-182h-4l-63 182Zm395 186q-51 0-81-27.5T554-342q0-44 34.5-72.5T677-443q23 0 45 4t38 11v-12q0-29-20.5-47T685-505q-23 0-42 9.5T610-468l-47-35q24-29 54.5-43t68.5-14q69 0 103 32.5t34 97.5v178h-63v-37h-4q-14 23-38 35t-53 12Zm12-54q35 0 59.5-24t24.5-56q-14-8-33.5-12.5T689-393q-32 0-50 14t-18 37q0 20 16 33t40 13Z\"/></svg>",
|
|
19682
19736
|
paragraphStyle: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z\"/></svg>",
|
|
19683
|
-
more: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z\"/></svg>"
|
|
19737
|
+
more: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z\"/></svg>",
|
|
19738
|
+
hRule: "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\"> <path d=\"M160-440v-80h640v80H160Z\" fill=\"currentColor\"></svg>"
|
|
19684
19739
|
};
|
|
19685
19740
|
var toolbarConfig = {
|
|
19686
19741
|
visibility: visibility,
|
|
@@ -19737,7 +19792,7 @@ var toolbarConfig = {
|
|
|
19737
19792
|
* "styleMenu": true, // Whether the style menu (p, h1-h6, code) is visible
|
|
19738
19793
|
* "styleBar": true, // Whether the style bar (bullet/numbered lists) is visible
|
|
19739
19794
|
* "formatBar": true, // Whether the format bar (b, i, u, etc) is visible
|
|
19740
|
-
* "search": true
|
|
19795
|
+
* "search": true // Whether the search item (hide/show search bar) is visible
|
|
19741
19796
|
* },
|
|
19742
19797
|
* "ordering": { // Control the ordering of toolbars, etc, ascending left-to-right
|
|
19743
19798
|
* "correctionBar": 10, // Correction bar order if it is visible
|
|
@@ -19745,17 +19800,18 @@ var toolbarConfig = {
|
|
|
19745
19800
|
* "styleMenu": 30, // Style menu (p, h1-h6, code) order if it is visible
|
|
19746
19801
|
* "styleBar": 40, // Style bar (bullet/numbered lists) order if it is visible
|
|
19747
19802
|
* "formatBar": 50, // Format bar (b, i, u, etc) order if it is visible
|
|
19748
|
-
* "search": 60
|
|
19803
|
+
* "search": 60 // Search item (hide/show search bar) order if it is visible
|
|
19749
19804
|
* },
|
|
19750
19805
|
* "menus": {
|
|
19751
19806
|
* "styleName": true // Whether to show the style name or just use a paragraph symbol
|
|
19752
19807
|
* "tableHeader": true, // Whether the "Header" item is visible in the "Table->Add" menu
|
|
19753
|
-
* "tableBorder": true
|
|
19808
|
+
* "tableBorder": true // Whether the "Border" item is visible in the "Table" menu
|
|
19754
19809
|
* },
|
|
19755
19810
|
* "insertBar": {
|
|
19756
19811
|
* "link": true, // Whether the link menu item is visible
|
|
19757
19812
|
* "image": true, // Whether the image menu item is visible
|
|
19758
19813
|
* "tableMenu": true, // Whether the table menu is visible
|
|
19814
|
+
* "hRule": true // Whether the horizontal rule menu item is visible
|
|
19759
19815
|
* },
|
|
19760
19816
|
* "formatBar": {
|
|
19761
19817
|
* "bold": true, // Whether the bold menu item is visible
|
|
@@ -19764,7 +19820,7 @@ var toolbarConfig = {
|
|
|
19764
19820
|
* "code": true, // Whether the code menu item is visible
|
|
19765
19821
|
* "strikethrough": true, // Whether the strikethrough menu item is visible
|
|
19766
19822
|
* "subscript": true, // Whether the subscript menu item is visible
|
|
19767
|
-
* "superscript": true
|
|
19823
|
+
* "superscript": true // Whether the superscript menu item is visible
|
|
19768
19824
|
* },
|
|
19769
19825
|
* "styleMenu": {
|
|
19770
19826
|
* "p": "Body", // The label in the menu for "P" style
|
|
@@ -19774,11 +19830,11 @@ var toolbarConfig = {
|
|
|
19774
19830
|
* "h4": "H4", // The label in the menu for "H4" style
|
|
19775
19831
|
* "h5": "H5", // The label in the menu for "H5" style
|
|
19776
19832
|
* "h6": "H6", // The label in the menu for "H6" style
|
|
19777
|
-
* "pre": "Code"
|
|
19833
|
+
* "pre": "Code" // The label in the menu for "PRE" aka code_block style
|
|
19778
19834
|
* },
|
|
19779
19835
|
* "styleBar": {
|
|
19780
19836
|
* "list": true, // Whether bullet and numbered list items are visible
|
|
19781
|
-
* "dent": true
|
|
19837
|
+
* "dent": true // Whether indent and outdent items are visible
|
|
19782
19838
|
* },
|
|
19783
19839
|
* "augmentation": {
|
|
19784
19840
|
* "prepend": null, // Name of a registered array of cmdItems to prepend
|
|
@@ -19837,7 +19893,9 @@ var toolbarConfig = {
|
|
|
19837
19893
|
* // format_paragraph
|
|
19838
19894
|
* "paragraphStyle": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M360-160v-240q-83 0-141.5-58.5T160-600q0-83 58.5-141.5T360-800h360v80h-80v560h-80v-560H440v560h-80Z\"/></svg>",
|
|
19839
19895
|
* // more_horiz
|
|
19840
|
-
* "more": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z\"/></svg>"
|
|
19896
|
+
* "more": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\" fill=\"#1f1f1f\"><path d=\"M240-400q-33 0-56.5-23.5T160-480q0-33 23.5-56.5T240-560q33 0 56.5 23.5T320-480q0 33-23.5 56.5T240-400Zm240 0q-33 0-56.5-23.5T400-480q0-33 23.5-56.5T480-560q33 0 56.5 23.5T560-480q0 33-23.5 56.5T480-400Zm240 0q-33 0-56.5-23.5T640-480q0-33 23.5-56.5T720-560q33 0 56.5 23.5T800-480q0 33-23.5 56.5T720-400Z\"/></svg>",
|
|
19897
|
+
* // horizontal_rule
|
|
19898
|
+
* "hRule": "<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\" viewBox=\"0 -960 960 960\" width=\"24px\"> <path d=\"M160-440v-80h640v80H160Z\" fill=\"currentColor\"></svg>"
|
|
19841
19899
|
* }
|
|
19842
19900
|
* }
|
|
19843
19901
|
* ```
|
|
@@ -19930,10 +19988,7 @@ class ToolbarConfig {
|
|
|
19930
19988
|
|
|
19931
19989
|
var undo = "Mod-z";
|
|
19932
19990
|
var redo = "Mod-Shift-z";
|
|
19933
|
-
var link =
|
|
19934
|
-
"Mod-K",
|
|
19935
|
-
"Mod-k"
|
|
19936
|
-
];
|
|
19991
|
+
var link = "Mod-k";
|
|
19937
19992
|
var p = "Ctrl-Shift-0";
|
|
19938
19993
|
var h1 = "Ctrl-Shift-1";
|
|
19939
19994
|
var h2 = "Ctrl-Shift-2";
|
|
@@ -19941,14 +19996,8 @@ var h3 = "Ctrl-Shift-3";
|
|
|
19941
19996
|
var h4 = "Ctrl-Shift-4";
|
|
19942
19997
|
var h5 = "Ctrl-Shift-5";
|
|
19943
19998
|
var h6 = "Ctrl-Shift-6";
|
|
19944
|
-
var bullet =
|
|
19945
|
-
|
|
19946
|
-
"Ctrl-u"
|
|
19947
|
-
];
|
|
19948
|
-
var number = [
|
|
19949
|
-
"Ctrl-O",
|
|
19950
|
-
"Ctrl-o"
|
|
19951
|
-
];
|
|
19999
|
+
var bullet = "Ctrl-u";
|
|
20000
|
+
var number = "Ctrl-o";
|
|
19952
20001
|
var indent = [
|
|
19953
20002
|
"Mod->",
|
|
19954
20003
|
"Mod-]"
|
|
@@ -19957,29 +20006,14 @@ var outdent = [
|
|
|
19957
20006
|
"Mod-<",
|
|
19958
20007
|
"Mod-["
|
|
19959
20008
|
];
|
|
19960
|
-
var bold =
|
|
19961
|
-
|
|
19962
|
-
|
|
19963
|
-
|
|
19964
|
-
var italic = [
|
|
19965
|
-
"Mod-I",
|
|
19966
|
-
"Mod-i"
|
|
19967
|
-
];
|
|
19968
|
-
var underline = [
|
|
19969
|
-
"Mod-U",
|
|
19970
|
-
"Mod-u"
|
|
19971
|
-
];
|
|
19972
|
-
var strikethrough = [
|
|
19973
|
-
"Ctrl-S",
|
|
19974
|
-
"Ctrl-s"
|
|
19975
|
-
];
|
|
20009
|
+
var bold = "Mod-b";
|
|
20010
|
+
var italic = "Mod-i";
|
|
20011
|
+
var underline = "Mod-u";
|
|
20012
|
+
var strikethrough = "Ctrl-s";
|
|
19976
20013
|
var code = "Mod-`";
|
|
19977
20014
|
var subscript = "Ctrl-Mod--";
|
|
19978
20015
|
var superscript = "Ctrl-Mod-+";
|
|
19979
|
-
var search$1 =
|
|
19980
|
-
"Ctrl-F",
|
|
19981
|
-
"Ctrl-f"
|
|
19982
|
-
];
|
|
20016
|
+
var search$1 = "Ctrl-f";
|
|
19983
20017
|
var keymapConfig = {
|
|
19984
20018
|
undo: undo,
|
|
19985
20019
|
redo: redo,
|
|
@@ -20043,7 +20077,7 @@ var keymapConfig = {
|
|
|
20043
20077
|
* "undo": "Mod-z",
|
|
20044
20078
|
* "redo": "Shift-Mod-z",
|
|
20045
20079
|
* // Insert (no hotkeys for image or table)
|
|
20046
|
-
* "link":
|
|
20080
|
+
* "link": "Mod-k",
|
|
20047
20081
|
* // Stylemenu
|
|
20048
20082
|
* "p": "Ctrl-Shift-0",
|
|
20049
20083
|
* "h1": "Ctrl-Shift-1",
|
|
@@ -20053,20 +20087,20 @@ var keymapConfig = {
|
|
|
20053
20087
|
* "h5": "Ctrl-Shift-5",
|
|
20054
20088
|
* "h6": "Ctrl-Shift-6",
|
|
20055
20089
|
* // Stylebar
|
|
20056
|
-
* "bullet":
|
|
20057
|
-
* "number":
|
|
20090
|
+
* "bullet": Ctrl-u",
|
|
20091
|
+
* "number": "Ctrl-o",
|
|
20058
20092
|
* "indent": ["Mod-]", "Ctrl-q"],
|
|
20059
20093
|
* "outdent": ["Mod-[", "Shift-Ctrl-q"],
|
|
20060
20094
|
* // Format
|
|
20061
|
-
* "bold":
|
|
20062
|
-
* "italic":
|
|
20063
|
-
* "underline":
|
|
20064
|
-
* "strikethrough":
|
|
20095
|
+
* "bold": "Mod-b",
|
|
20096
|
+
* "italic": "Mod-i",
|
|
20097
|
+
* "underline": "Mod-u",
|
|
20098
|
+
* "strikethrough": "Ctrl-s",
|
|
20065
20099
|
* "code": "Mod-`",
|
|
20066
20100
|
* "subscript": "Ctrl-Mod--",
|
|
20067
20101
|
* "superscript": "Ctrl-Mod-+",
|
|
20068
20102
|
* // Search
|
|
20069
|
-
* "search":
|
|
20103
|
+
* "search": "Ctrl-f"
|
|
20070
20104
|
* }
|
|
20071
20105
|
* ```
|
|
20072
20106
|
*/
|
|
@@ -21255,6 +21289,14 @@ class Dropdown {
|
|
|
21255
21289
|
return true;
|
|
21256
21290
|
}
|
|
21257
21291
|
dom.appendChild(menuDOM);
|
|
21292
|
+
let win = dom.ownerDocument.defaultView || window;
|
|
21293
|
+
requestAnimationFrame(() => {
|
|
21294
|
+
const rect = menuDOM.getBoundingClientRect();
|
|
21295
|
+
if (rect.bottom > win.innerHeight) {
|
|
21296
|
+
menuDOM.style.marginTop = "0";
|
|
21297
|
+
menuDOM.style.top = (-rect.height - 2) + "px";
|
|
21298
|
+
}
|
|
21299
|
+
});
|
|
21258
21300
|
return { close, node: menuDOM };
|
|
21259
21301
|
}
|
|
21260
21302
|
}
|
|
@@ -21296,12 +21338,25 @@ class DropdownSubmenu {
|
|
|
21296
21338
|
let items = renderDropdownItems(this.content, view);
|
|
21297
21339
|
let win = view.dom.ownerDocument.defaultView || window;
|
|
21298
21340
|
let label = crelt("div", { class: this.prefix + "-submenu-label" }, translate(view, this.options.label || ""));
|
|
21299
|
-
let
|
|
21341
|
+
let submenu = crelt("div", { class: this.prefix + "-submenu" }, items.dom);
|
|
21342
|
+
let wrap = crelt("div", { class: this.prefix + "-submenu-wrap" }, label, submenu);
|
|
21343
|
+
function repositionIfNeeded() {
|
|
21344
|
+
requestAnimationFrame(() => {
|
|
21345
|
+
submenu.style.top = "";
|
|
21346
|
+
const rect = submenu.getBoundingClientRect();
|
|
21347
|
+
if (rect.bottom > win.innerHeight) {
|
|
21348
|
+
const wrapRect = wrap.getBoundingClientRect();
|
|
21349
|
+
submenu.style.top = (win.innerHeight - 4 - rect.height - wrapRect.top) + "px";
|
|
21350
|
+
}
|
|
21351
|
+
});
|
|
21352
|
+
}
|
|
21300
21353
|
let listeningOnClose = null;
|
|
21354
|
+
wrap.addEventListener("mouseenter", repositionIfNeeded);
|
|
21301
21355
|
label.addEventListener("mousedown", e => {
|
|
21302
21356
|
e.preventDefault();
|
|
21303
21357
|
markMenuEvent(e);
|
|
21304
21358
|
setClass(wrap, this.prefix + "-submenu-wrap-active", false);
|
|
21359
|
+
repositionIfNeeded();
|
|
21305
21360
|
if (!listeningOnClose)
|
|
21306
21361
|
win.addEventListener("mousedown", listeningOnClose = () => {
|
|
21307
21362
|
if (!isMenuEvent(wrap)) {
|
|
@@ -21445,13 +21500,18 @@ class DialogItem {
|
|
|
21445
21500
|
// Generally speaking, the selection itself is on the screen, so we want the dialog to be adjacent to
|
|
21446
21501
|
// it with the best chance of showing the entire dialog.
|
|
21447
21502
|
let wrapper = view.dom.parentElement;
|
|
21448
|
-
let
|
|
21503
|
+
let wrapperRect = wrapper.getBoundingClientRect();
|
|
21504
|
+
let originX = wrapperRect.left;
|
|
21505
|
+
let originY = wrapperRect.top;
|
|
21449
21506
|
let scrollY = wrapper.scrollTop; // The editor scrolls within its wrapper
|
|
21450
21507
|
let scrollX = window.scrollX; // The editor doesn't scroll horizontally
|
|
21451
21508
|
let style = this.dialog.style;
|
|
21452
21509
|
let toolbarHeight = getToolbar(view).getBoundingClientRect().height;
|
|
21453
21510
|
let minTop = toolbarHeight + scrollY + 4;
|
|
21454
|
-
|
|
21511
|
+
// Use the tighter of the two boundaries: the wrapper's own visible height (which clips
|
|
21512
|
+
// absolutely-positioned children via overflow-y: scroll) and the window viewport bottom.
|
|
21513
|
+
let availableHeight = Math.min(wrapper.clientHeight, innerHeight - originY);
|
|
21514
|
+
let maxTop = scrollY + availableHeight - dialogHeight - 4;
|
|
21455
21515
|
let minLeft = scrollX + 4;
|
|
21456
21516
|
let maxLeft = innerWidth - dialogWidth - 4;
|
|
21457
21517
|
let fitsRight = window.innerWidth - selrect.right - scrollX > dialogWidth + 4;
|
|
@@ -21466,7 +21526,7 @@ class DialogItem {
|
|
|
21466
21526
|
} else if (fitsTop) { // Put dialog above selection
|
|
21467
21527
|
style.left = Math.min(Math.max((selrect.left + (selrect.width / 2) - (dialogWidth / 2)), minLeft), maxLeft) + 'px';
|
|
21468
21528
|
style.top = Math.min(Math.max((selrect.top - dialogHeight - 4), minTop), maxTop) + 'px';
|
|
21469
|
-
} else { // Put dialog below selection
|
|
21529
|
+
} else { // Put dialog below selection
|
|
21470
21530
|
style.left = Math.min(Math.max((selrect.left + (selrect.width / 2) - (dialogWidth / 2)), minLeft), maxLeft) + 'px';
|
|
21471
21531
|
style.top = Math.min((selrect.bottom + 4), maxTop) + 'px';
|
|
21472
21532
|
}
|
|
@@ -22836,7 +22896,7 @@ function redoItem(options) {
|
|
|
22836
22896
|
*/
|
|
22837
22897
|
function insertBarItems(config) {
|
|
22838
22898
|
let items = [];
|
|
22839
|
-
let { link, image, tableMenu } = config.toolbar.insertBar;
|
|
22899
|
+
let { link, image, tableMenu, hRule } = config.toolbar.insertBar;
|
|
22840
22900
|
if (link) {
|
|
22841
22901
|
items.push(new LinkItem(config));
|
|
22842
22902
|
}
|
|
@@ -22845,9 +22905,22 @@ function insertBarItems(config) {
|
|
|
22845
22905
|
items.push(new ImageItem(config, imageCommands));
|
|
22846
22906
|
}
|
|
22847
22907
|
if (tableMenu) items.push(tableMenuItems(config));
|
|
22908
|
+
if (hRule) items.push(hRuleItem(config));
|
|
22848
22909
|
return items;
|
|
22849
22910
|
}
|
|
22850
22911
|
|
|
22912
|
+
function hRuleItem(config) {
|
|
22913
|
+
let icon = config.toolbar.icons.hRule;
|
|
22914
|
+
let title = config.toolbar.help.hRule + keyString('hRule', config.keymap);
|
|
22915
|
+
let options = {
|
|
22916
|
+
icon: icon,
|
|
22917
|
+
title: title,
|
|
22918
|
+
active: (state) => { return isHRuleSelected(state) },
|
|
22919
|
+
enable: () => { return true } // TODO: should be conditional?
|
|
22920
|
+
};
|
|
22921
|
+
return cmdItem(insertHRuleCommand(), options)
|
|
22922
|
+
}
|
|
22923
|
+
|
|
22851
22924
|
function tableMenuItems(config) {
|
|
22852
22925
|
let icons = config.toolbar.icons;
|
|
22853
22926
|
let help = config.toolbar.help;
|
|
@@ -24819,7 +24892,17 @@ class MarkupEditor {
|
|
|
24819
24892
|
'click': (view) => { setTimeout(() => { clicked(view, target); }, 0); },
|
|
24820
24893
|
'delete': () => { setTimeout(() => { callbackInput(target); }, 0); },
|
|
24821
24894
|
},
|
|
24822
|
-
handlePaste() {
|
|
24895
|
+
handlePaste(view, event) {
|
|
24896
|
+
const { $from } = view.state.selection;
|
|
24897
|
+
const inCodeBlock = $from.parent.type === view.state.schema.nodes.code_block;
|
|
24898
|
+
if (inCodeBlock && event?.clipboardData) {
|
|
24899
|
+
const text = event.clipboardData.getData('text/plain');
|
|
24900
|
+
if (text) {
|
|
24901
|
+
view.dispatch(view.state.tr.insertText(text));
|
|
24902
|
+
setTimeout(() => { callbackInput(target); }, 0);
|
|
24903
|
+
return true
|
|
24904
|
+
}
|
|
24905
|
+
}
|
|
24823
24906
|
setTimeout(() => { callbackInput(target); }, 0);
|
|
24824
24907
|
return false
|
|
24825
24908
|
},
|
|
@@ -24960,12 +25043,14 @@ const MU = {
|
|
|
24960
25043
|
insertImage: insertImage$1,
|
|
24961
25044
|
insertLink: insertLink$1,
|
|
24962
25045
|
insertTable,
|
|
25046
|
+
insertHRule,
|
|
24963
25047
|
loadUserFiles,
|
|
24964
25048
|
modifyImage,
|
|
24965
25049
|
openImageDialog,
|
|
24966
25050
|
openLinkDialog,
|
|
24967
25051
|
outdent: outdent$1,
|
|
24968
25052
|
padBottom,
|
|
25053
|
+
pasteCode,
|
|
24969
25054
|
pasteHTML,
|
|
24970
25055
|
pasteText,
|
|
24971
25056
|
removeAllDivs,
|
package/package.json
CHANGED
package/styles/markup.css
CHANGED
|
@@ -134,6 +134,14 @@ li p {
|
|
|
134
134
|
margin: 0px 0;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
li > ul, li > ol {
|
|
138
|
+
margin-bottom: 0;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
li > h1, li > h2, li > h3, li > h4, li > h5, li > h6 {
|
|
142
|
+
margin-bottom: 0;
|
|
143
|
+
}
|
|
144
|
+
|
|
137
145
|
blockquote {
|
|
138
146
|
margin-right: 0px; /* Because nested blockquotes just keep getting narrower */
|
|
139
147
|
}
|
package/styles/toolbar.css
CHANGED