@kerebron/extension-menu-legacy 0.4.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/LICENSE +23 -0
- package/README.md +82 -0
- package/assets/menu.css +539 -0
- package/esm/editor/src/CoreEditor.d.ts +40 -0
- package/esm/editor/src/CoreEditor.d.ts.map +1 -0
- package/esm/editor/src/CoreEditor.js +252 -0
- package/esm/editor/src/DummyEditorView.d.ts +60 -0
- package/esm/editor/src/DummyEditorView.d.ts.map +1 -0
- package/esm/editor/src/DummyEditorView.js +277 -0
- package/esm/editor/src/Extension.d.ts +31 -0
- package/esm/editor/src/Extension.d.ts.map +1 -0
- package/esm/editor/src/Extension.js +53 -0
- package/esm/editor/src/ExtensionManager.d.ts +32 -0
- package/esm/editor/src/ExtensionManager.d.ts.map +1 -0
- package/esm/editor/src/ExtensionManager.js +260 -0
- package/esm/editor/src/Mark.d.ts +23 -0
- package/esm/editor/src/Mark.d.ts.map +1 -0
- package/esm/editor/src/Mark.js +51 -0
- package/esm/editor/src/Node.d.ts +32 -0
- package/esm/editor/src/Node.d.ts.map +1 -0
- package/esm/editor/src/Node.js +60 -0
- package/esm/editor/src/commands/CommandManager.d.ts +23 -0
- package/esm/editor/src/commands/CommandManager.d.ts.map +1 -0
- package/esm/editor/src/commands/CommandManager.js +118 -0
- package/esm/editor/src/commands/baseCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/baseCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/baseCommandFactories.js +836 -0
- package/esm/editor/src/commands/createChainableState.d.ts +3 -0
- package/esm/editor/src/commands/createChainableState.d.ts.map +1 -0
- package/esm/editor/src/commands/createChainableState.js +29 -0
- package/esm/editor/src/commands/keyCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/keyCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/keyCommandFactories.js +10 -0
- package/esm/editor/src/commands/mod.d.ts +7 -0
- package/esm/editor/src/commands/mod.d.ts.map +1 -0
- package/esm/editor/src/commands/mod.js +76 -0
- package/esm/editor/src/commands/replaceCommandFactories.d.ts +3 -0
- package/esm/editor/src/commands/replaceCommandFactories.d.ts.map +1 -0
- package/esm/editor/src/commands/replaceCommandFactories.js +94 -0
- package/esm/editor/src/commands/types.d.ts +18 -0
- package/esm/editor/src/commands/types.d.ts.map +1 -0
- package/esm/editor/src/commands/types.js +1 -0
- package/esm/editor/src/mod.d.ts +9 -0
- package/esm/editor/src/mod.d.ts.map +1 -0
- package/esm/editor/src/mod.js +8 -0
- package/esm/editor/src/nodeToTreeString.d.ts +10 -0
- package/esm/editor/src/nodeToTreeString.d.ts.map +1 -0
- package/esm/editor/src/nodeToTreeString.js +74 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts +6 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.d.ts.map +1 -0
- package/esm/editor/src/plugins/TrackSelecionPlugin.js +24 -0
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts +23 -0
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.d.ts.map +1 -0
- package/esm/editor/src/plugins/input-rules/InputRulesPlugin.js +163 -0
- package/esm/editor/src/plugins/keymap/keymap.d.ts +11 -0
- package/esm/editor/src/plugins/keymap/keymap.d.ts.map +1 -0
- package/esm/editor/src/plugins/keymap/keymap.js +125 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts +4 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.d.ts.map +1 -0
- package/esm/editor/src/plugins/keymap/w3c-keyname.js +124 -0
- package/esm/editor/src/types.d.ts +52 -0
- package/esm/editor/src/types.d.ts.map +1 -0
- package/esm/editor/src/types.js +1 -0
- package/esm/editor/src/ui.d.ts +15 -0
- package/esm/editor/src/ui.d.ts.map +1 -0
- package/esm/editor/src/ui.js +16 -0
- package/esm/editor/src/utilities/SmartOutput.d.ts +41 -0
- package/esm/editor/src/utilities/SmartOutput.d.ts.map +1 -0
- package/esm/editor/src/utilities/SmartOutput.js +228 -0
- package/esm/editor/src/utilities/createNodeFromContent.d.ts +9 -0
- package/esm/editor/src/utilities/createNodeFromContent.d.ts.map +1 -0
- package/esm/editor/src/utilities/createNodeFromContent.js +32 -0
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts +9 -0
- package/esm/editor/src/utilities/getHtmlAttributes.d.ts.map +1 -0
- package/esm/editor/src/utilities/getHtmlAttributes.js +47 -0
- package/esm/extension-menu-legacy/src/ExtensionMenuLegacy.d.ts +14 -0
- package/esm/extension-menu-legacy/src/ExtensionMenuLegacy.d.ts.map +1 -0
- package/esm/extension-menu-legacy/src/ExtensionMenuLegacy.js +32 -0
- package/esm/extension-menu-legacy/src/MenuPlugin.d.ts +9 -0
- package/esm/extension-menu-legacy/src/MenuPlugin.d.ts.map +1 -0
- package/esm/extension-menu-legacy/src/MenuPlugin.js +227 -0
- package/esm/extension-menu-legacy/src/buildMenu.d.ts +5 -0
- package/esm/extension-menu-legacy/src/buildMenu.d.ts.map +1 -0
- package/esm/extension-menu-legacy/src/buildMenu.js +331 -0
- package/esm/extension-menu-legacy/src/icons.d.ts +15 -0
- package/esm/extension-menu-legacy/src/icons.d.ts.map +1 -0
- package/esm/extension-menu-legacy/src/icons.js +118 -0
- package/esm/extension-menu-legacy/src/menu.d.ts +81 -0
- package/esm/extension-menu-legacy/src/menu.d.ts.map +1 -0
- package/esm/extension-menu-legacy/src/menu.js +350 -0
- package/esm/extension-menu-legacy/src/mod.d.ts +3 -0
- package/esm/extension-menu-legacy/src/mod.d.ts.map +1 -0
- package/esm/extension-menu-legacy/src/mod.js +2 -0
- package/esm/extension-menu-legacy/src/prompt.d.ts +36 -0
- package/esm/extension-menu-legacy/src/prompt.d.ts.map +1 -0
- package/esm/extension-menu-legacy/src/prompt.js +158 -0
- package/esm/package.json +3 -0
- package/package.json +22 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Permission is hereby granted, free of charge, to any
|
|
2
|
+
person obtaining a copy of this software and associated
|
|
3
|
+
documentation files (the "Software"), to deal in the
|
|
4
|
+
Software without restriction, including without
|
|
5
|
+
limitation the rights to use, copy, modify, merge,
|
|
6
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
7
|
+
the Software, and to permit persons to whom the Software
|
|
8
|
+
is furnished to do so, subject to the following
|
|
9
|
+
conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice
|
|
12
|
+
shall be included in all copies or substantial portions
|
|
13
|
+
of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
16
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
17
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
18
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
19
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
22
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
23
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Kerebron - Prosemirror based online editor kit
|
|
2
|
+
|
|
3
|
+
## Watch a Demo
|
|
4
|
+
|
|
5
|
+
<a href="https://youtube.com/shorts/OdJjhAPj-wA?feature=share" target="_blank">
|
|
6
|
+
<img src="https://github.com/user-attachments/assets/b63ec84a-0ed2-4f98-920c-76f6d3215168" alt="Alt Text" width="200">
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
## Playground Demo
|
|
10
|
+
|
|
11
|
+
[playground](https://demo.kerebron.com) - be nice.
|
|
12
|
+
|
|
13
|
+
## Overview
|
|
14
|
+
|
|
15
|
+
Using vanilla Prosemirror modules is often impossible because of
|
|
16
|
+
incompatibilities.
|
|
17
|
+
|
|
18
|
+
Kerebron forks several prosemirror projects into one monorepo in order to keep
|
|
19
|
+
them in sync.
|
|
20
|
+
|
|
21
|
+
Project is inspired on https://tiptap.dev/, but instead of building wrapper
|
|
22
|
+
around a wrapper it borrows concept of extension and command manager.
|
|
23
|
+
|
|
24
|
+
It has simplified tooling (deno), fewer dependencies and resulting in lower
|
|
25
|
+
number of output npm modules.
|
|
26
|
+
|
|
27
|
+
**Work in progress**
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
## Build
|
|
31
|
+
|
|
32
|
+
### Build static examples and `.wasm` files
|
|
33
|
+
|
|
34
|
+
```sh
|
|
35
|
+
deno task build
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Development
|
|
39
|
+
|
|
40
|
+
To start example server:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
deno task -f server-deno-hono start
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Examples
|
|
47
|
+
|
|
48
|
+
TODO
|
|
49
|
+
|
|
50
|
+
### NPM packages are generated using DNT
|
|
51
|
+
|
|
52
|
+
- https://deno.com/blog/publish-esm-cjs-module-dnt - the easiest way to publish
|
|
53
|
+
a hybrid npm module for ESM and CommonJS
|
|
54
|
+
- https://github.com/denoland/dnt
|
|
55
|
+
- https://gaubee.com/article/Publishing-Your-Deno-Project-as-a-Monorepo-using-dnt/
|
|
56
|
+
|
|
57
|
+
To generate npm packages
|
|
58
|
+
|
|
59
|
+
```sh
|
|
60
|
+
deno -A ./build/build_npm.ts
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Run through docker
|
|
64
|
+
|
|
65
|
+
```sh
|
|
66
|
+
docker build . -t editor-test
|
|
67
|
+
docker run -it -p 8000:8000 -v $PWD:/usr/src/app editor-test
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Prerequisites
|
|
71
|
+
|
|
72
|
+
Install deno
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
npm install -g deno
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Install rust
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
82
|
+
```
|
package/assets/menu.css
ADDED
|
@@ -0,0 +1,539 @@
|
|
|
1
|
+
/* Base menu and toolbar styles */
|
|
2
|
+
.kb-menu {
|
|
3
|
+
margin: 0;
|
|
4
|
+
line-height: 1;
|
|
5
|
+
font-size: var(--kb-text-sm);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/* Mobile-first toolbar */
|
|
9
|
+
.kb-menu {
|
|
10
|
+
position: sticky;
|
|
11
|
+
top: 0;
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-wrap: wrap;
|
|
14
|
+
gap: var(--kb-space-xs);
|
|
15
|
+
padding: var(--kb-space-sm);
|
|
16
|
+
background: var(--kb-color-surface);
|
|
17
|
+
border-bottom: 1px solid var(--kb-color-border);
|
|
18
|
+
z-index: var(--kb-z-dropdown);
|
|
19
|
+
overflow-x: auto;
|
|
20
|
+
-webkit-overflow-scrolling: touch;
|
|
21
|
+
scrollbar-width: none;
|
|
22
|
+
-ms-overflow-style: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.kb-menu::-webkit-scrollbar {
|
|
26
|
+
display: none;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/* Mobile: bottom-anchored toolbar for one-handed use */
|
|
30
|
+
@media (max-width: 767px) {
|
|
31
|
+
.kb-menu {
|
|
32
|
+
position: fixed;
|
|
33
|
+
bottom: 0;
|
|
34
|
+
left: 0;
|
|
35
|
+
right: 0;
|
|
36
|
+
top: auto;
|
|
37
|
+
border-bottom: none;
|
|
38
|
+
border-top: 1px solid var(--kb-color-border);
|
|
39
|
+
box-shadow: var(--kb-shadow-lg);
|
|
40
|
+
backdrop-filter: blur(10px);
|
|
41
|
+
background: rgba(255, 255, 255, 0.95);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/* Add bottom padding to editor content to prevent overlap */
|
|
45
|
+
.kb-component {
|
|
46
|
+
padding-bottom: calc(
|
|
47
|
+
var(--kb-touch-target-comfortable) + var(--kb-space-md) * 2
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Tablet and desktop: top toolbar */
|
|
53
|
+
@media (min-width: 768px) {
|
|
54
|
+
.kb-menu {
|
|
55
|
+
position: relative;
|
|
56
|
+
border-radius: var(--kb-radius-md) var(--kb-radius-md) 0 0;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.kb-menu {
|
|
61
|
+
background-color: var(--kb-color-surface);
|
|
62
|
+
z-index: 10000;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/* Toolbar items */
|
|
66
|
+
.kb-menu__button {
|
|
67
|
+
border-radius: var(--kb-radius-sm);
|
|
68
|
+
|
|
69
|
+
min-width: var(--kb-touch-target-comfortable);
|
|
70
|
+
min-height: var(--kb-touch-target-comfortable);
|
|
71
|
+
|
|
72
|
+
border: none;
|
|
73
|
+
background: transparent;
|
|
74
|
+
color: var(--kb-color-text);
|
|
75
|
+
cursor: pointer;
|
|
76
|
+
transition: all 0.2s ease;
|
|
77
|
+
font-size: var(--kb-text-sm);
|
|
78
|
+
flex-shrink: 0;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.kb-menu__button:hover {
|
|
82
|
+
background: var(--kb-color-hover);
|
|
83
|
+
border-color: var(--kb-color-border);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.kb-menu__button:focus {
|
|
87
|
+
outline: 2px solid var(--kb-color-primary);
|
|
88
|
+
outline-offset: 2px;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.kb-menu__button--active {
|
|
92
|
+
background: var(--kb-color-primary);
|
|
93
|
+
color: white;
|
|
94
|
+
border-color: var(--kb-color-primary);
|
|
95
|
+
border-radius: var(--kb-radius-sm);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.kb-menu__button--pressed {
|
|
99
|
+
background: var(--kb-color-active);
|
|
100
|
+
transform: scale(0.95);
|
|
101
|
+
transition: transform 0.1s ease;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.kb-menu__button--disabled {
|
|
105
|
+
opacity: 0.4;
|
|
106
|
+
cursor: not-allowed;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.kb-menu__button--disabled:hover {
|
|
110
|
+
background: transparent;
|
|
111
|
+
border-color: transparent;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/* Icon styling */
|
|
115
|
+
.kb-dropdown__item svg,
|
|
116
|
+
.kb-menu__button svg {
|
|
117
|
+
fill: currentColor;
|
|
118
|
+
height: 1em;
|
|
119
|
+
width: 1em;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.kb-dropdown__item svg,
|
|
123
|
+
.kb-menu__button span,
|
|
124
|
+
.kb-menu__button svg {
|
|
125
|
+
vertical-align: middle;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/* Separator */
|
|
129
|
+
.kb-menu__separator {
|
|
130
|
+
width: 1px;
|
|
131
|
+
height: var(--kb-space-lg);
|
|
132
|
+
background: var(--kb-color-border);
|
|
133
|
+
margin: 0 var(--kb-space-xs);
|
|
134
|
+
flex-shrink: 0;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Dropdown menu */
|
|
138
|
+
.kb-dropdown {
|
|
139
|
+
position: relative;
|
|
140
|
+
padding: 1px 0 1px var(--kb-space-sm);
|
|
141
|
+
display: inline-block;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
.kb-dropdown__label {
|
|
145
|
+
min-width: var(--kb-touch-target-comfortable);
|
|
146
|
+
min-height: var(--kb-touch-target-comfortable);
|
|
147
|
+
|
|
148
|
+
border: none;
|
|
149
|
+
background: none;
|
|
150
|
+
font-size: var(--kb-text-sm);
|
|
151
|
+
align-items: center;
|
|
152
|
+
padding-right: var(--kb-space-lg);
|
|
153
|
+
white-space: nowrap;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.kb-dropdown__label:focus {
|
|
158
|
+
outline: 2px solid var(--kb-color-primary);
|
|
159
|
+
outline-offset: -2px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.kb-dropdown__label--active {
|
|
163
|
+
background: var(--kb-color-active);
|
|
164
|
+
color: var(--kb-color-primary);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.kb-dropdown__label:after {
|
|
168
|
+
content: '';
|
|
169
|
+
border-left: 4px solid transparent;
|
|
170
|
+
border-right: 4px solid transparent;
|
|
171
|
+
border-top: 4px solid currentColor;
|
|
172
|
+
opacity: 0.6;
|
|
173
|
+
position: absolute;
|
|
174
|
+
right: var(--kb-space-sm);
|
|
175
|
+
top: calc(50% - 2px);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
.kb-dropdown__menu {
|
|
179
|
+
position: fixed;
|
|
180
|
+
/*min-width: 200px;*/
|
|
181
|
+
min-width: 6em;
|
|
182
|
+
background: var(--kb-color-surface);
|
|
183
|
+
border: 1px solid var(--kb-color-border);
|
|
184
|
+
border-radius: var(--kb-radius-md);
|
|
185
|
+
box-shadow: var(--kb-shadow-lg);
|
|
186
|
+
z-index: var(--kb-z-dropdown);
|
|
187
|
+
padding: var(--kb-space-xs);
|
|
188
|
+
margin-top: var(--kb-space-xs);
|
|
189
|
+
opacity: 0;
|
|
190
|
+
visibility: hidden;
|
|
191
|
+
transform: translateY(-4px);
|
|
192
|
+
transition: all 0.2s ease;
|
|
193
|
+
white-space: nowrap;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
.kb-dropdown--open .kb-dropdown__menu {
|
|
197
|
+
opacity: 1;
|
|
198
|
+
visibility: visible;
|
|
199
|
+
transform: translateY(0);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.kb-dropdown__item {
|
|
203
|
+
display: flex;
|
|
204
|
+
padding: var(--kb-space-sm) var(--kb-space-md);
|
|
205
|
+
border: none;
|
|
206
|
+
background: none;
|
|
207
|
+
text-align: left;
|
|
208
|
+
cursor: pointer;
|
|
209
|
+
border-radius: var(--kb-radius-sm);
|
|
210
|
+
color: var(--kb-color-text);
|
|
211
|
+
font-size: var(--kb-text-sm);
|
|
212
|
+
min-height: var(--kb-touch-target-comfortable);
|
|
213
|
+
align-items: center;
|
|
214
|
+
transition: background-color 0.2s ease;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
.kb-dropdown__item:hover {
|
|
218
|
+
background: var(--kb-color-hover);
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
.kb-dropdown__item:focus {
|
|
222
|
+
outline: 2px solid var(--kb-color-primary);
|
|
223
|
+
outline-offset: -2px;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.kb-dropdown__item--active {
|
|
227
|
+
background: var(--kb-color-active);
|
|
228
|
+
color: var(--kb-color-primary);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Accessibility: High contrast mode support */
|
|
232
|
+
@media (prefers-contrast: more) {
|
|
233
|
+
.kb-dropdown__item,
|
|
234
|
+
.kb-dropdown__item:focus {
|
|
235
|
+
outline-width: 3px;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* Mobile: full-screen dropdown */
|
|
240
|
+
@media (max-width: 767px) {
|
|
241
|
+
.kb-dropdown__menu,
|
|
242
|
+
.kb-dropdown__menu--mobile {
|
|
243
|
+
position: fixed;
|
|
244
|
+
top: auto;
|
|
245
|
+
bottom: calc(var(--kb-touch-target-comfortable) + var(--kb-space-md) * 2);
|
|
246
|
+
left: var(--kb-space-sm);
|
|
247
|
+
right: var(--kb-space-sm);
|
|
248
|
+
min-width: auto;
|
|
249
|
+
border-radius: var(--kb-radius-lg);
|
|
250
|
+
max-height: 50vh;
|
|
251
|
+
overflow-y: auto;
|
|
252
|
+
padding: var(--kb-space-md);
|
|
253
|
+
backdrop-filter: blur(10px);
|
|
254
|
+
background: rgba(255, 255, 255, 0.95);
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.kb-dropdown__item {
|
|
258
|
+
padding: var(--kb-space-md);
|
|
259
|
+
min-height: var(--kb-touch-target-comfortable);
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/* Submenu support */
|
|
264
|
+
.kb-submenu {
|
|
265
|
+
position: relative;
|
|
266
|
+
margin-right: var(--kb-space-sm);
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
.kb-submenu__label {
|
|
270
|
+
position: relative;
|
|
271
|
+
padding-right: var(--kb-space-lg);
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.kb-submenu__label:after {
|
|
275
|
+
content: '';
|
|
276
|
+
border-top: 4px solid transparent;
|
|
277
|
+
border-bottom: 4px solid transparent;
|
|
278
|
+
border-left: 4px solid currentColor;
|
|
279
|
+
opacity: 0.6;
|
|
280
|
+
position: absolute;
|
|
281
|
+
right: var(--kb-space-sm);
|
|
282
|
+
top: calc(50% - 4px);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.kb-submenu__content {
|
|
286
|
+
position: absolute;
|
|
287
|
+
left: 100%;
|
|
288
|
+
top: var(--kb-space-xs);
|
|
289
|
+
/*min-width: 160px;*/
|
|
290
|
+
min-width: 4em;
|
|
291
|
+
background: var(--kb-color-surface);
|
|
292
|
+
border: 1px solid var(--kb-color-border);
|
|
293
|
+
border-radius: var(--kb-radius-md);
|
|
294
|
+
box-shadow: var(--kb-shadow-lg);
|
|
295
|
+
z-index: calc(var(--kb-z-dropdown) + 1);
|
|
296
|
+
padding: var(--kb-space-xs);
|
|
297
|
+
opacity: 0;
|
|
298
|
+
visibility: hidden;
|
|
299
|
+
transform: translateX(-4px);
|
|
300
|
+
transition: all 0.2s ease;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.kb-submenu:hover .kb-submenu__content,
|
|
304
|
+
.kb-submenu--open .kb-submenu__content {
|
|
305
|
+
opacity: 1;
|
|
306
|
+
visibility: visible;
|
|
307
|
+
transform: translateX(0);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/* Mobile: no submenus, flatten structure */
|
|
311
|
+
@media (max-width: 767px) {
|
|
312
|
+
.kb-submenu__content {
|
|
313
|
+
display: none;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
/* Tooltip for button labels */
|
|
318
|
+
.kb-tooltip {
|
|
319
|
+
position: absolute;
|
|
320
|
+
bottom: 100%;
|
|
321
|
+
left: 50%;
|
|
322
|
+
transform: translateX(-50%);
|
|
323
|
+
background: var(--kb-color-text);
|
|
324
|
+
color: var(--kb-color-surface);
|
|
325
|
+
padding: var(--kb-space-xs) var(--kb-space-sm);
|
|
326
|
+
border-radius: var(--kb-radius-sm);
|
|
327
|
+
font-size: var(--kb-text-xs);
|
|
328
|
+
white-space: nowrap;
|
|
329
|
+
opacity: 0;
|
|
330
|
+
visibility: hidden;
|
|
331
|
+
transition: all 0.2s ease;
|
|
332
|
+
margin-bottom: var(--kb-space-xs);
|
|
333
|
+
z-index: var(--kb-z-tooltip);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.kb-tooltip:after {
|
|
337
|
+
content: '';
|
|
338
|
+
position: absolute;
|
|
339
|
+
top: 100%;
|
|
340
|
+
left: 50%;
|
|
341
|
+
transform: translateX(-50%);
|
|
342
|
+
border-left: 4px solid transparent;
|
|
343
|
+
border-right: 4px solid transparent;
|
|
344
|
+
border-top: 4px solid var(--kb-color-text);
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.kb-menu__button:hover .kb-tooltip {
|
|
348
|
+
opacity: 1;
|
|
349
|
+
visibility: visible;
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
/* Mobile: no tooltips on touch devices */
|
|
353
|
+
@media (max-width: 767px) {
|
|
354
|
+
.kb-tooltip {
|
|
355
|
+
display: none;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/* Accessibility improvements */
|
|
360
|
+
@media (prefers-reduced-motion: reduce) {
|
|
361
|
+
.kb-menu__button,
|
|
362
|
+
.kb-dropdown__menu,
|
|
363
|
+
.kb-submenu__content,
|
|
364
|
+
.kb-tooltip {
|
|
365
|
+
transition: none;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.kb-icon {
|
|
370
|
+
min-width: var(--kb-touch-target-comfortable);
|
|
371
|
+
min-height: var(--kb-touch-target-comfortable);
|
|
372
|
+
|
|
373
|
+
display: inline-block;
|
|
374
|
+
line-height: var(--kb-touch-target-comfortable);
|
|
375
|
+
vertical-align: middle;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
/* Prompt/dialog styles with mobile optimization */
|
|
379
|
+
.kb-prompt {
|
|
380
|
+
background: var(--kb-color-surface);
|
|
381
|
+
padding: var(--kb-space-md) var(--kb-space-lg) var(--kb-space-md)
|
|
382
|
+
var(--kb-space-lg);
|
|
383
|
+
border: 1px solid var(--kb-color-border);
|
|
384
|
+
position: fixed;
|
|
385
|
+
border-radius: var(--kb-radius-md);
|
|
386
|
+
z-index: var(--kb-z-modal);
|
|
387
|
+
box-shadow: var(--kb-shadow-lg);
|
|
388
|
+
top: 50%;
|
|
389
|
+
left: 50%;
|
|
390
|
+
transform: translate(-50%, -50%);
|
|
391
|
+
min-width: 300px;
|
|
392
|
+
max-width: 90vw;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.kb-prompt h5 {
|
|
396
|
+
margin: 0 0 var(--kb-space-md) 0;
|
|
397
|
+
font-weight: 600;
|
|
398
|
+
font-size: var(--kb-text-base);
|
|
399
|
+
color: var(--kb-color-text);
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.kb-prompt input[type='text'],
|
|
403
|
+
.kb-prompt textarea {
|
|
404
|
+
background: var(--kb-color-surface-elevated);
|
|
405
|
+
border: 1px solid var(--kb-color-border);
|
|
406
|
+
border-radius: var(--kb-radius-sm);
|
|
407
|
+
padding: var(--kb-space-sm);
|
|
408
|
+
font-size: var(--kb-text-sm);
|
|
409
|
+
color: var(--kb-color-text);
|
|
410
|
+
width: 100%;
|
|
411
|
+
box-sizing: border-box;
|
|
412
|
+
outline: none;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.kb-prompt input[type='text']:focus,
|
|
416
|
+
.kb-prompt textarea:focus {
|
|
417
|
+
border-color: var(--kb-color-primary);
|
|
418
|
+
box-shadow: 0 0 0 3px var(--kb-color-focus);
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.kb-prompt--close {
|
|
422
|
+
position: absolute;
|
|
423
|
+
right: var(--kb-space-sm);
|
|
424
|
+
top: var(--kb-space-sm);
|
|
425
|
+
color: var(--kb-color-text-muted);
|
|
426
|
+
border: none;
|
|
427
|
+
background: transparent;
|
|
428
|
+
padding: var(--kb-space-xs);
|
|
429
|
+
cursor: pointer;
|
|
430
|
+
border-radius: var(--kb-radius-sm);
|
|
431
|
+
width: var(--kb-space-lg);
|
|
432
|
+
height: var(--kb-space-lg);
|
|
433
|
+
display: flex;
|
|
434
|
+
align-items: center;
|
|
435
|
+
justify-content: center;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.kb-prompt--close:hover {
|
|
439
|
+
background: var(--kb-color-hover);
|
|
440
|
+
color: var(--kb-color-text);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.kb-prompt--close:after {
|
|
444
|
+
content: '✕';
|
|
445
|
+
font-size: var(--kb-text-sm);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.kb-invalid {
|
|
449
|
+
background: #fef2f2;
|
|
450
|
+
border: 1px solid #fecaca;
|
|
451
|
+
color: #991b1b;
|
|
452
|
+
border-radius: var(--kb-radius-sm);
|
|
453
|
+
padding: var(--kb-space-sm) var(--kb-space-md);
|
|
454
|
+
position: absolute;
|
|
455
|
+
min-width: 10em;
|
|
456
|
+
font-size: var(--kb-text-sm);
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.kb-prompt__buttons {
|
|
460
|
+
margin-top: var(--kb-space-md);
|
|
461
|
+
display: flex;
|
|
462
|
+
gap: var(--kb-space-sm);
|
|
463
|
+
justify-content: flex-end;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
.kb-prompt__buttons button {
|
|
467
|
+
padding: var(--kb-space-sm) var(--kb-space-md);
|
|
468
|
+
border: 1px solid var(--kb-color-border);
|
|
469
|
+
border-radius: var(--kb-radius-sm);
|
|
470
|
+
background: var(--kb-color-surface);
|
|
471
|
+
color: var(--kb-color-text);
|
|
472
|
+
cursor: pointer;
|
|
473
|
+
font-size: var(--kb-text-sm);
|
|
474
|
+
min-height: var(--kb-touch-target-comfortable);
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
.kb-prompt__buttons button:hover {
|
|
478
|
+
background: var(--kb-color-hover);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.kb-prompt__buttons button[type='submit'] {
|
|
482
|
+
background: var(--kb-color-primary);
|
|
483
|
+
color: white;
|
|
484
|
+
border-color: var(--kb-color-primary);
|
|
485
|
+
}
|
|
486
|
+
|
|
487
|
+
.kb-prompt__buttons button[type='submit']:hover {
|
|
488
|
+
background: var(--kb-color-primary-hover);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/* Prompt/Dialog mobile optimization */
|
|
492
|
+
@media (max-width: 767px) {
|
|
493
|
+
.kb-editor-prompt {
|
|
494
|
+
position: fixed;
|
|
495
|
+
bottom: var(--kb-space-md);
|
|
496
|
+
left: var(--kb-space-md);
|
|
497
|
+
right: var(--kb-space-md);
|
|
498
|
+
top: auto;
|
|
499
|
+
transform: none;
|
|
500
|
+
max-width: none;
|
|
501
|
+
border-radius: var(--kb-radius-lg);
|
|
502
|
+
padding: var(--kb-space-lg);
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
.kb-editor-prompt input[type='text'],
|
|
506
|
+
.kb-editor-prompt textarea {
|
|
507
|
+
min-height: var(--kb-touch-target-min);
|
|
508
|
+
padding: var(--kb-space-sm);
|
|
509
|
+
font-size: var(--kb-text-base);
|
|
510
|
+
border: 1px solid var(--kb-color-border);
|
|
511
|
+
border-radius: var(--kb-radius-sm);
|
|
512
|
+
background: var(--kb-color-surface);
|
|
513
|
+
color: var(--kb-color-text);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.kb-editor-prompt-buttons {
|
|
517
|
+
display: flex;
|
|
518
|
+
gap: var(--kb-space-sm);
|
|
519
|
+
margin-top: var(--kb-space-md);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.kb-editor-prompt-buttons button {
|
|
523
|
+
flex: 1;
|
|
524
|
+
min-height: var(--kb-touch-target-comfortable);
|
|
525
|
+
padding: var(--kb-space-sm) var(--kb-space-md);
|
|
526
|
+
border: 1px solid var(--kb-color-border);
|
|
527
|
+
border-radius: var(--kb-radius-sm);
|
|
528
|
+
background: var(--kb-color-surface);
|
|
529
|
+
color: var(--kb-color-text);
|
|
530
|
+
font-size: var(--kb-text-base);
|
|
531
|
+
cursor: pointer;
|
|
532
|
+
}
|
|
533
|
+
|
|
534
|
+
.kb-editor-prompt-buttons button[type='submit'] {
|
|
535
|
+
background: var(--kb-color-primary);
|
|
536
|
+
color: white;
|
|
537
|
+
border-color: var(--kb-color-primary);
|
|
538
|
+
}
|
|
539
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EditorView } from 'prosemirror-view';
|
|
2
|
+
import { Node as ProseMirrorNode, Schema } from 'prosemirror-model';
|
|
3
|
+
import type { EditorConfig, JSONContent } from './types.js';
|
|
4
|
+
import { EditorState, Transaction } from 'prosemirror-state';
|
|
5
|
+
import { DummyEditorView } from './DummyEditorView.js';
|
|
6
|
+
import { ChainedCommands } from './commands/mod.js';
|
|
7
|
+
import { Extension } from './Extension.js';
|
|
8
|
+
import { EditorUi } from './ui.js';
|
|
9
|
+
export declare class CoreEditor extends EventTarget {
|
|
10
|
+
readonly config: Partial<EditorConfig>;
|
|
11
|
+
private extensionManager;
|
|
12
|
+
private commandManager;
|
|
13
|
+
view: EditorView | DummyEditorView;
|
|
14
|
+
state: EditorState;
|
|
15
|
+
ui: EditorUi;
|
|
16
|
+
constructor(config?: Partial<EditorConfig>);
|
|
17
|
+
getExtension<T extends Extension>(name: string): T | undefined;
|
|
18
|
+
get schema(): Schema<any, any>;
|
|
19
|
+
get run(): {
|
|
20
|
+
[key: string]: (...args: any[]) => boolean;
|
|
21
|
+
};
|
|
22
|
+
get commandFactories(): {
|
|
23
|
+
[key: string]: import("./commands/types.js").CommandFactory;
|
|
24
|
+
};
|
|
25
|
+
chain(): ChainedCommands;
|
|
26
|
+
can(): ChainedCommands;
|
|
27
|
+
private createView;
|
|
28
|
+
dispatchTransaction(transaction: Transaction): void;
|
|
29
|
+
private setupPlugins;
|
|
30
|
+
clearDocument(): void;
|
|
31
|
+
setDocument(content: any): void;
|
|
32
|
+
getDocument(): ProseMirrorNode;
|
|
33
|
+
loadDocument(mediaType: string, content: Uint8Array): Promise<void>;
|
|
34
|
+
saveDocument(mediaType: string): Promise<Uint8Array>;
|
|
35
|
+
getJSON(): JSONContent;
|
|
36
|
+
clone(options?: Partial<EditorConfig>): CoreEditor;
|
|
37
|
+
debug(doc?: ProseMirrorNode): void;
|
|
38
|
+
destroy(): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=CoreEditor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoreEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/src/CoreEditor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAGpE,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAG7D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAa,QAAQ,EAAE,MAAM,SAAS,CAAC;AAc9C,qBAAa,UAAW,SAAQ,WAAW;IACzC,SAAgB,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,CAG3C;IACF,OAAO,CAAC,gBAAgB,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAiB;IAChC,IAAI,EAAG,UAAU,GAAG,eAAe,CAAC;IACpC,KAAK,EAAG,WAAW,CAAC;IACpB,EAAE,EAAE,QAAQ,CAAmB;gBAE1B,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM;IA+B9C,YAAY,CAAC,CAAC,SAAS,SAAS,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS;IAI9D,IAAW,MAAM,qBAEhB;IAED,IAAW,GAAG;;MAEb;IAED,IAAW,gBAAgB;;MAE1B;IAEM,KAAK,IAAI,eAAe;IAIxB,GAAG,IAAI,eAAe;IAI7B,OAAO,CAAC,UAAU;IA8CX,mBAAmB,CAAC,WAAW,EAAE,WAAW;IAsBnD,OAAO,CAAC,YAAY;IAcb,aAAa;IASb,WAAW,CAAC,OAAO,EAAE,GAAG;IAyBxB,WAAW;IAIL,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU;IA0BnD,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAY1D,OAAO,IAAI,WAAW;IAItB,KAAK,CAAC,OAAO,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,UAAU;IAOtD,KAAK,CAAC,GAAG,CAAC,EAAE,eAAe;IAO3B,OAAO;CAOf"}
|