@bagelink/vue 1.15.515 → 1.15.521
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/dist/components/form/inputs/RichText/composables/useEditorKeyboard.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/index.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/utils/commands.d.ts.map +1 -1
- package/dist/components/form/inputs/RichText/utils/formatting.d.ts.map +1 -1
- package/dist/core.css +2 -2
- package/dist/index.cjs +130 -110
- package/dist/index.css +1 -1
- package/dist/index.mjs +9733 -9598
- package/dist/style.css +2 -2
- package/package.json +1 -1
- package/src/components/form/inputs/RichText/composables/useEditorKeyboard.ts +8 -5
- package/src/components/form/inputs/RichText/index.vue +277 -66
- package/src/components/form/inputs/RichText/utils/commands.ts +48 -3
- package/src/components/form/inputs/RichText/utils/formatting.ts +5 -1
- package/src/components/form/inputs/Upload/UploadInput.vue +1 -1
- package/src/styles/appearance.css +50 -0
|
@@ -192,6 +192,49 @@ function findBlockElement(node: Node): Element | null {
|
|
|
192
192
|
return null
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
+
const LIST_BLOCK_SELECTOR = 'p,h1,h2,h3,h4,h5,h6,blockquote'
|
|
196
|
+
|
|
197
|
+
function convertSelectedBlocksToList(
|
|
198
|
+
state: EditorState,
|
|
199
|
+
selection: Selection,
|
|
200
|
+
range: Range,
|
|
201
|
+
listTag: 'ol' | 'ul'
|
|
202
|
+
): boolean {
|
|
203
|
+
if (!state.doc || range.collapsed) { return false }
|
|
204
|
+
|
|
205
|
+
const blocks = Array.from(state.doc.body.querySelectorAll(LIST_BLOCK_SELECTOR))
|
|
206
|
+
.filter(block => !block.closest('li') && range.intersectsNode(block))
|
|
207
|
+
.filter(block => !blocksContainAncestor(block))
|
|
208
|
+
|
|
209
|
+
function blocksContainAncestor(block: Element) {
|
|
210
|
+
return block.parentElement?.closest(LIST_BLOCK_SELECTOR) !== null
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (!blocks.length) { return false }
|
|
214
|
+
|
|
215
|
+
const list = state.doc.createElement(listTag)
|
|
216
|
+
const direction = (blocks[0] as HTMLElement).dir
|
|
217
|
+
if (direction === 'rtl' || direction === 'ltr') { list.dir = direction }
|
|
218
|
+
|
|
219
|
+
blocks[0].parentNode?.insertBefore(list, blocks[0])
|
|
220
|
+
blocks.forEach((block) => {
|
|
221
|
+
const item = state.doc!.createElement('li')
|
|
222
|
+
const blockDirection = (block as HTMLElement).dir
|
|
223
|
+
if (blockDirection === 'rtl' || blockDirection === 'ltr') { item.dir = blockDirection }
|
|
224
|
+
while (block.firstChild) {
|
|
225
|
+
item.appendChild(block.firstChild)
|
|
226
|
+
}
|
|
227
|
+
list.appendChild(item)
|
|
228
|
+
block.remove()
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
const nextRange = state.doc.createRange()
|
|
232
|
+
nextRange.selectNodeContents(list)
|
|
233
|
+
selection.removeAllRanges()
|
|
234
|
+
selection.addRange(nextRange)
|
|
235
|
+
return true
|
|
236
|
+
}
|
|
237
|
+
|
|
195
238
|
// Centralized command creation helper
|
|
196
239
|
function createCommand(name: string, execute: Command['execute'], isActive?: Command['isActive']): Command {
|
|
197
240
|
return {
|
|
@@ -236,7 +279,7 @@ export function createCommandRegistry(state: EditorState): CommandRegistry {
|
|
|
236
279
|
const selectionInfo = getCurrentSelection(state)
|
|
237
280
|
if (!selectionInfo) { return }
|
|
238
281
|
|
|
239
|
-
|
|
282
|
+
const { range, selection } = selectionInfo
|
|
240
283
|
|
|
241
284
|
// If no text is selected, try to apply formatting to word at cursor
|
|
242
285
|
if (range.collapsed) {
|
|
@@ -305,7 +348,7 @@ export function createCommandRegistry(state: EditorState): CommandRegistry {
|
|
|
305
348
|
const selectionInfo = getCurrentSelection(state)
|
|
306
349
|
if (!selectionInfo) { return }
|
|
307
350
|
|
|
308
|
-
|
|
351
|
+
const { range, selection } = selectionInfo
|
|
309
352
|
|
|
310
353
|
// If no text is selected, try to apply formatting to word at cursor
|
|
311
354
|
if (range.collapsed) {
|
|
@@ -374,7 +417,7 @@ export function createCommandRegistry(state: EditorState): CommandRegistry {
|
|
|
374
417
|
const selectionInfo = getCurrentSelection(state)
|
|
375
418
|
if (!selectionInfo) { return }
|
|
376
419
|
|
|
377
|
-
|
|
420
|
+
const { range, selection } = selectionInfo
|
|
378
421
|
|
|
379
422
|
// If no text is selected, try to apply formatting to word at cursor
|
|
380
423
|
if (range.collapsed) {
|
|
@@ -672,6 +715,7 @@ export function createCommandRegistry(state: EditorState): CommandRegistry {
|
|
|
672
715
|
if (!selectionInfo) { return }
|
|
673
716
|
|
|
674
717
|
const { range } = selectionInfo
|
|
718
|
+
if (convertSelectedBlocksToList(state, selectionInfo.selection, range, 'ol')) { return }
|
|
675
719
|
const currentBlock = findBlockElement(range.commonAncestorContainer)
|
|
676
720
|
if (!currentBlock) { return }
|
|
677
721
|
|
|
@@ -764,6 +808,7 @@ export function createCommandRegistry(state: EditorState): CommandRegistry {
|
|
|
764
808
|
if (!selectionInfo) { return }
|
|
765
809
|
|
|
766
810
|
const { range } = selectionInfo
|
|
811
|
+
if (convertSelectedBlocksToList(state, selectionInfo.selection, range, 'ul')) { return }
|
|
767
812
|
const currentBlock = findBlockElement(range.commonAncestorContainer)
|
|
768
813
|
if (!currentBlock) { return }
|
|
769
814
|
|
|
@@ -159,9 +159,14 @@ export function formatting(state: EditorState) {
|
|
|
159
159
|
|
|
160
160
|
// Handle multi-block selection
|
|
161
161
|
const blocks = getBlocksBetween(selectionInfo.startBlock, selectionInfo.endBlock)
|
|
162
|
+
if (!blocks.length) { return }
|
|
163
|
+
|
|
162
164
|
const listEl = state.doc.createElement(listTag) as HTMLElement
|
|
163
165
|
if (isRTL) { listEl.dir = 'rtl' }
|
|
164
166
|
|
|
167
|
+
const firstBlock = blocks[0]
|
|
168
|
+
firstBlock.parentNode?.insertBefore(listEl, firstBlock)
|
|
169
|
+
|
|
165
170
|
blocks.forEach((block) => {
|
|
166
171
|
if (!state.doc) { return }
|
|
167
172
|
const li = state.doc.createElement('li')
|
|
@@ -172,7 +177,6 @@ export function formatting(state: EditorState) {
|
|
|
172
177
|
block.remove()
|
|
173
178
|
})
|
|
174
179
|
|
|
175
|
-
selectionInfo.startBlock.parentNode?.insertBefore(listEl, selectionInfo.startBlock)
|
|
176
180
|
restoreSelection(state.doc, state.range, state.selection, selectionInfo, listEl)
|
|
177
181
|
}
|
|
178
182
|
|
|
@@ -216,7 +216,7 @@ function fileName(pathKey: string) {
|
|
|
216
216
|
:class="{ 'bgl_fill-image': fill }"
|
|
217
217
|
>
|
|
218
218
|
<div
|
|
219
|
-
class="flex opacity-8 z-
|
|
219
|
+
class="flex opacity-8 z-90 gap-025 absolute top-0 start-0"
|
|
220
220
|
:class="{ 'mx-auto end-0 mt-1 justify-content-center': oval, 'm-05': !oval }"
|
|
221
221
|
>
|
|
222
222
|
<Btn
|
|
@@ -82,6 +82,56 @@
|
|
|
82
82
|
z-index: 9;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
.z-index-10,
|
|
86
|
+
.z-10 {
|
|
87
|
+
z-index: 10;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.z-index-20,
|
|
91
|
+
.z-20 {
|
|
92
|
+
z-index: 20;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
.z-index-30,
|
|
96
|
+
.z-30 {
|
|
97
|
+
z-index: 30;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.z-index-40,
|
|
101
|
+
.z-40 {
|
|
102
|
+
z-index: 40;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.z-index-50,
|
|
106
|
+
.z-50 {
|
|
107
|
+
z-index: 50;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.z-index-60,
|
|
111
|
+
.z-60 {
|
|
112
|
+
z-index: 60;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.z-index-70,
|
|
116
|
+
.z-70 {
|
|
117
|
+
z-index: 70;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.z-index-80,
|
|
121
|
+
.z-80 {
|
|
122
|
+
z-index: 80;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.z-index-90,
|
|
126
|
+
.z-90 {
|
|
127
|
+
z-index: 90;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.z-index-95,
|
|
131
|
+
.z-95 {
|
|
132
|
+
z-index: 95;
|
|
133
|
+
}
|
|
134
|
+
|
|
85
135
|
.z-index-99,
|
|
86
136
|
.z-99 {
|
|
87
137
|
z-index: 99;
|