markupeditor 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "markupeditor",
3
+ "version": "0.9.0",
4
+ "description": "A web component and API for WYSIWYG HTML editing.",
5
+ "keywords": [
6
+ "wysiwyg",
7
+ "editor",
8
+ "html",
9
+ "web-component",
10
+ "rich-text"
11
+ ],
12
+ "main": "dist/markup-editor.js",
13
+ "module": "dist/markup-editor.js",
14
+ "type": "module",
15
+ "bin": {
16
+ "muedit": "bin/muedit.js"
17
+ },
18
+ "files": [
19
+ "dist",
20
+ "bin",
21
+ "styles"
22
+ ],
23
+ "license": "MIT",
24
+ "author": "Steven G. Harris <steven.g.harris@gmail.com>",
25
+ "homepage": "https://stevengharris.github.io/markupeditor-base/",
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "git://github.com/stevengharris/markupeditor-base.git"
29
+ },
30
+ "dependencies": {
31
+ "crelt": "^1.0.6",
32
+ "prosemirror-commands": "^1.0.0",
33
+ "prosemirror-dropcursor": "^1.8.1",
34
+ "prosemirror-gapcursor": "^1.3.2",
35
+ "prosemirror-history": "^1.2.2",
36
+ "prosemirror-inputrules": "^1.4.0",
37
+ "prosemirror-model": "^1.23.0",
38
+ "prosemirror-schema-basic": "^1.2.3",
39
+ "prosemirror-schema-list": "^1.4.1",
40
+ "prosemirror-search": "^1.0.0",
41
+ "prosemirror-state": "^1.4.3",
42
+ "prosemirror-tables": "^1.6.1",
43
+ "prosemirror-transform": "^1.10.4",
44
+ "prosemirror-view": "^1.34.3"
45
+ },
46
+ "devDependencies": {
47
+ "@custom-elements-manifest/analyzer": "^0.11.0",
48
+ "@eslint/js": "^9.35.0",
49
+ "@rollup/plugin-node-resolve": "^16.0.0",
50
+ "eslint": "^9.35.0",
51
+ "express": "^5.1.0",
52
+ "jsdoc": "^4.0.5",
53
+ "jsdom": "^27.0.1",
54
+ "modern-jsdoc-template": "^1.0.0",
55
+ "rollup": "^4.31.0",
56
+ "rollup-plugin-import-css": "4.0.1",
57
+ "vitest": "^3.2.4"
58
+ },
59
+ "scripts": {
60
+ "build": "rollup -c",
61
+ "dev": "rollup -c -w",
62
+ "test": "vitest run ./test/*.js",
63
+ "pretest": "npm run build",
64
+ "docs": "node ./docs/index.js",
65
+ "predocs": "sh predocs.sh && jsdoc -c jsdoc.json",
66
+ "analyze": "cem analyze --config custom-elements-manifest.config.js"
67
+ },
68
+ "customElements": "dist/custom-elements.json"
69
+ }
@@ -0,0 +1,273 @@
1
+ #editor, .editor {
2
+ font-family: system-ui, sans-serif;
3
+ background: white;
4
+ color: black;
5
+ background-clip: padding-box;
6
+ margin: -8px; /* Set so that the .ProseMirror padding starts from edges */
7
+ --padBottom: 0; /* MU.padBottom() sets this value in px based on fullHeight */
8
+ padding-block: 0 var(--padBottom);
9
+ overflow-x: clip;
10
+ overflow-y: scroll;
11
+ height: 100vh;
12
+ padding-right: 12px;
13
+ }
14
+ @media (prefers-color-scheme: dark) {
15
+ #editor, .editor {
16
+ background: black;
17
+ color: white;
18
+ }
19
+ }
20
+
21
+ body {
22
+ font-family: system-ui, sans-serif;
23
+ }
24
+
25
+ a {
26
+ color: blue;
27
+ text-decoration: none;
28
+ }
29
+ @media (prefers-color-scheme: dark) {
30
+ a {
31
+ color: #4183c4;
32
+ }
33
+ }
34
+
35
+ a:hover {
36
+ text-decoration: underline;
37
+ }
38
+
39
+ p, pre {
40
+ font-size: 1.0rem;
41
+ }
42
+
43
+ p, ul, ol, dl, table, pre {
44
+ margin: 0 0 15px;
45
+ }
46
+
47
+ ul, ol {
48
+ padding-left: 30px;
49
+ }
50
+
51
+ h1 {
52
+ font-size: 2.5rem;
53
+ }
54
+
55
+ h2 {
56
+ font-size: 2.0rem;
57
+ }
58
+
59
+ h3 {
60
+ font-size: 1.5rem;
61
+ }
62
+
63
+ h4 {
64
+ font-size: 1.2rem;
65
+ }
66
+
67
+ h5 {
68
+ font-size: 1.0rem;
69
+ }
70
+
71
+ h6 {
72
+ font-size: .83rem;
73
+ }
74
+
75
+ h1, h2, h3, h4, h5, h6 {
76
+ font-weight: bold;
77
+ margin: 0 0 10px 0;
78
+ }
79
+
80
+ h1 + p, h2 + p, h3 + p {
81
+ margin-top: 10px;
82
+ }
83
+
84
+ table {
85
+ table-layout: fixed;
86
+ border-collapse: collapse;
87
+ width: 100%;
88
+ }
89
+
90
+ table th, table td {
91
+ padding: 4px;
92
+ }
93
+
94
+ table th {
95
+ font-weight: normal; /* The default is bold, but we want to use paragraph styles and formatting */
96
+ }
97
+
98
+ /* Make the styling compact inside of a table */
99
+ table p, table h1, table h2, table h3, table h4, table h5, table h6 {
100
+ margin: 0;
101
+ }
102
+
103
+ /* Table bordering options */
104
+ .bordered-table-none {
105
+ border: none;
106
+ }
107
+
108
+ .bordered-table-outer, .bordered-table-header, .bordered-table-cell {
109
+ border: 1px solid #DDD;
110
+ }
111
+
112
+ .bordered-table-header th { /* border th not thead to refresh properly */
113
+ border: 1px solid #DDD;
114
+ }
115
+
116
+ .bordered-table-cell th, .bordered-table-cell td {
117
+ border: 1px solid #DDD;
118
+ }
119
+
120
+ /* Default table bordering is same as .bordered-table-cell but is only used when not specified */
121
+ table:not(.bordered-table-none, .bordered-table-outer, .bordered-table-header, .bordered-table-cell) {
122
+ border: 1px solid #DDD;
123
+ }
124
+
125
+ table:not(.bordered-table-none, .bordered-table-outer, .bordered-table-header, .bordered-table-cell) td {
126
+ border: 1px solid #DDD;
127
+ }
128
+
129
+ table:not(.bordered-table-none, .bordered-table-outer, .bordered-table-header, .bordered-table-cell) th {
130
+ border: 1px solid #DDD;
131
+ }
132
+
133
+ li p {
134
+ margin: 0px 0;
135
+ }
136
+
137
+ blockquote {
138
+ margin-right: 0px; /* Because nested blockquotes just keep getting narrower */
139
+ }
140
+
141
+ code {
142
+ overflow-x: scroll;
143
+ display: block;
144
+ background-color: #F8F8F8;
145
+ border-radius: 3px;
146
+ font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas, monospace;
147
+ white-space: pre;
148
+ }
149
+ @media (prefers-color-scheme: dark) {
150
+ code {
151
+ background-color: #808080;
152
+ }
153
+ }
154
+
155
+ p code, h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
156
+ display: inline;
157
+ }
158
+
159
+ .resize-container {
160
+ position: relative;
161
+ display: inline-block;
162
+ margin: 0;
163
+ }
164
+
165
+ img {
166
+ max-width: 100%;
167
+ height: auto;
168
+ }
169
+
170
+ /* Provide a slightly darkened or lightened overlay while search is active */
171
+ .searching {
172
+ background-color: rgba(0, 0, 0, 0.10);
173
+ }
174
+ @media (prefers-color-scheme: dark) {
175
+ .searching {
176
+ background: rgba(255, 255, 255, 0.10);
177
+ }
178
+ }
179
+
180
+ .resize-container img {
181
+ display: block;
182
+ outline: 1px black dashed;
183
+ outline-offset: 4px;
184
+ outline-width: 1px;
185
+ }
186
+ @media (prefers-color-scheme: dark) {
187
+ .resize-container img {
188
+ outline: 1px white dashed;
189
+ }
190
+ }
191
+
192
+ .resize-handle-nw,
193
+ .resize-handle-ne,
194
+ .resize-handle-sw,
195
+ .resize-handle-se {
196
+ position: absolute;
197
+ display: block;
198
+ width: 6px;
199
+ height: 6px;
200
+ outline: 1px black solid;
201
+ background: white;
202
+ z-index: 999;
203
+ }
204
+ @media (prefers-color-scheme: dark) {
205
+ .resize-handle-nw,
206
+ .resize-handle-ne,
207
+ .resize-handle-sw,
208
+ .resize-handle-se {
209
+ outline: 1px white solid;
210
+ background: black;
211
+ }
212
+ }
213
+
214
+ /* A transparent child for each resize-handle that expands the clickable area */
215
+ .resize-handle-nw:after,
216
+ .resize-handle-ne:after,
217
+ .resize-handle-sw:after,
218
+ .resize-handle-se:after {
219
+ content: "";
220
+ position: absolute;
221
+ left: -5px;
222
+ top: -5px;
223
+ width: 16px;
224
+ height: 16px;
225
+ }
226
+
227
+ /* The *-resize cursors do not work, at least in MacCatalyst.
228
+ * Still specifying them below. They default to a pointer instead
229
+ */
230
+ .resize-handle-nw {
231
+ cursor: nw-resize;
232
+ top: -8px;
233
+ left: -7px;
234
+ }
235
+
236
+ .resize-handle-ne {
237
+ cursor: ne-resize;
238
+ top: -8px;
239
+ right: -7px;
240
+ }
241
+
242
+ .resize-handle-sw {
243
+ cursor: sw-resize;
244
+ bottom: -8px;
245
+ left: -7px;
246
+ }
247
+
248
+ .resize-handle-se {
249
+ cursor: se-resize;
250
+ bottom: -8px;
251
+ right: -7px;
252
+ }
253
+
254
+ .placeholder[placeholder]:before {
255
+ content: attr(placeholder);
256
+ position: absolute;
257
+ color: #ccc;
258
+ }
259
+
260
+ /* Classes set by prosemirror-search module, modified for MarkupEditor */
261
+ /* Note the dark and light mode are the same */
262
+
263
+ .ProseMirror-search-match {
264
+ background-color: yellow;
265
+ color: black;
266
+ }
267
+
268
+ .ProseMirror-active-search-match {
269
+ background-color: orange;
270
+ color: black;
271
+ outline: 1px orangered solid;
272
+ z-index: 2;
273
+ }
@@ -0,0 +1,3 @@
1
+ @import url("mirror.css");
2
+ @import url("markup.css");
3
+ @import url("toolbar.css");
@@ -0,0 +1,190 @@
1
+ /**
2
+ The CSS here was adapted from the ProseMirror example.
3
+ The adaptations mainly consisted of removing styling when it interfered with
4
+ markup.css in some way. These changes were commented-out and moved to the end of
5
+ this file. Top-level Prosemirror styling was brought to the top of the file.
6
+ Styling from search.css in prosemirror-search were added and modified.
7
+ */
8
+
9
+ .ProseMirror {
10
+ position: relative;
11
+ padding: 4px 8px 4px 8px;
12
+ line-height: 1.2;
13
+ outline: none;
14
+ word-wrap: break-word;
15
+ white-space: pre-wrap;
16
+ white-space: break-spaces;
17
+ font-variant-ligatures: none;
18
+ }
19
+
20
+ .ProseMirror pre {
21
+ white-space: pre-wrap;
22
+ }
23
+
24
+ .ProseMirror li {
25
+ position: relative;
26
+ }
27
+
28
+ .ProseMirror-hideselection *::selection { background: transparent; }
29
+ .ProseMirror-hideselection *::-moz-selection { background: transparent; }
30
+ .ProseMirror-hideselection { caret-color: transparent; }
31
+
32
+ /* See https://github.com/ProseMirror/prosemirror/issues/1421#issuecomment-1759320191 */
33
+ .ProseMirror [draggable][contenteditable=false] { user-select: text }
34
+
35
+ .ProseMirror-selectednode {
36
+ outline: 2px solid #8cf;
37
+ }
38
+
39
+ /* Make sure li selections wrap around markers */
40
+
41
+ li.ProseMirror-selectednode {
42
+ outline: none;
43
+ }
44
+
45
+ li.ProseMirror-selectednode:after {
46
+ content: "";
47
+ position: absolute;
48
+ left: -32px;
49
+ right: -2px; top: -2px; bottom: -2px;
50
+ border: 2px solid #8cf;
51
+ pointer-events: none;
52
+ }
53
+
54
+ /* Protect against generic img rules */
55
+
56
+ img.ProseMirror-separator {
57
+ display: inline !important;
58
+ border: none !important;
59
+ margin: 0 !important;
60
+ }
61
+ .ProseMirror-textblock-dropdown {
62
+ min-width: 3em;
63
+ }
64
+
65
+ .ProseMirror-icon svg {
66
+ fill: currentColor;
67
+ height: 1em;
68
+ }
69
+
70
+ .ProseMirror-icon span {
71
+ vertical-align: text-top;
72
+ }
73
+ .ProseMirror-gapcursor {
74
+ display: none;
75
+ pointer-events: none;
76
+ position: absolute;
77
+ }
78
+
79
+ .ProseMirror-gapcursor:after {
80
+ content: "";
81
+ display: block;
82
+ position: absolute;
83
+ top: -2px;
84
+ width: 20px;
85
+ border-top: 1px solid black;
86
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
87
+ }
88
+
89
+ @keyframes ProseMirror-cursor-blink {
90
+ to {
91
+ visibility: hidden;
92
+ }
93
+ }
94
+
95
+ .ProseMirror-focused .ProseMirror-gapcursor {
96
+ display: block;
97
+ }
98
+
99
+ .ProseMirror-prompt {
100
+ background: white;
101
+ padding: 5px 10px 5px 15px;
102
+ border: 1px solid silver;
103
+ position: fixed;
104
+ border-radius: 3px;
105
+ z-index: 11;
106
+ box-shadow: -.5px 2px 5px rgba(0, 0, 0, .2);
107
+ }
108
+
109
+ .ProseMirror-prompt h5 {
110
+ margin: 0;
111
+ font-weight: normal;
112
+ font-size: 100%;
113
+ color: #444;
114
+ }
115
+
116
+ .ProseMirror-prompt input[type="text"],
117
+ .ProseMirror-prompt textarea {
118
+ background: #eee;
119
+ border: none;
120
+ outline: none;
121
+ }
122
+
123
+ .ProseMirror-prompt input[type="text"] {
124
+ padding: 0 4px;
125
+ }
126
+
127
+ .ProseMirror-prompt-close {
128
+ position: absolute;
129
+ left: 2px; top: 1px;
130
+ color: #666;
131
+ border: none; background: transparent; padding: 0;
132
+ }
133
+
134
+ .ProseMirror-prompt-close:after {
135
+ content: "✕";
136
+ font-size: 12px;
137
+ }
138
+
139
+ .ProseMirror-invalid {
140
+ background: #ffc;
141
+ border: 1px solid #cc7;
142
+ border-radius: 4px;
143
+ padding: 5px 10px;
144
+ position: absolute;
145
+ min-width: 10em;
146
+ }
147
+
148
+ .ProseMirror-prompt-buttons {
149
+ margin-top: 5px;
150
+ /* display: none; */
151
+ }
152
+
153
+ /*
154
+
155
+ #editor, .editor {
156
+ border-radius: 4px;
157
+ border: 2px solid rgba(0, 0, 0, 0.2);
158
+ }
159
+
160
+ .ProseMirror-example-setup-style hr {
161
+ padding: 2px 10px;
162
+ border: none;
163
+ margin: 1em 0;
164
+ }
165
+
166
+ .ProseMirror-example-setup-style hr:after {
167
+ content: "";
168
+ display: block;
169
+ height: 1px;
170
+ background-color: silver;
171
+ line-height: 2px;
172
+ }
173
+
174
+ .ProseMirror ul, .ProseMirror ol {
175
+ padding-left: 30px;
176
+ }
177
+
178
+ .ProseMirror blockquote {
179
+ padding-left: 1em;
180
+ border-left: 3px solid #eee;
181
+ margin-left: 0; margin-right: 0;
182
+ }
183
+
184
+ .ProseMirror-example-setup-style img {
185
+ cursor: default;
186
+ }
187
+
188
+ .ProseMirror p { margin-bottom: 1em }
189
+ */
190
+