@humandialog/forms.svelte 0.5.13 → 0.5.15
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/components/combo/combo.svelte +0 -1
- package/components/document/internal/h1.icon.svelte +16 -0
- package/components/document/internal/h1.icon.svelte.d.ts +23 -0
- package/components/document/internal/h2.icon.svelte +16 -0
- package/components/document/internal/h2.icon.svelte.d.ts +23 -0
- package/components/document/internal/h3.icon.svelte +16 -0
- package/components/document/internal/h3.icon.svelte.d.ts +23 -0
- package/components/document/internal/h4.icon.svelte +16 -0
- package/components/document/internal/h4.icon.svelte.d.ts +23 -0
- package/components/document/internal/palette.svelte +4 -3
- package/components/document/rich.edit.svelte +23 -11
- package/package.json +5 -1
|
@@ -244,7 +244,6 @@ function selected_item(itm, a2) {
|
|
|
244
244
|
let found = definition.source.find((e) => e.Key == choosed_value);
|
|
245
245
|
if (!found)
|
|
246
246
|
found = definition.source.find((e) => e.Name == choosed_value);
|
|
247
|
-
console.log("found: ", found);
|
|
248
247
|
if (found)
|
|
249
248
|
return found;
|
|
250
249
|
else
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
<svg viewBox="100 150 800 550" xmlns="http://www.w3.org/2000/svg" {...$$props}>
|
|
3
|
+
<path
|
|
4
|
+
d="m673 708.144c-10 0-24 0-44-1s-34-1-43-1c-10 0-24 0-43 1s-33 1-43 1c-5 0-9-2-12-6s-4-10-4-15c0-7 1-12 5-15s8-5 13-6 10-1 16-2 12-3 15-5c7-4 11-19 11-45l-1-127v-10c-3-1-8-2-16-2h-219c-9 0-14 1-17 2-1 2-1 5-1 10v120c0 31 4 49 12 54 3 2 9 4 16 4s13 1 19 1 10 2 14 5 7 8 7 15c0 6-1 11-4 16s-7 6-12 6c-10 0-26 0-46-1s-35-1-45-1c-9 0-23 0-41 1s-32 1-42 1c-5 0-8-2-11-6s-4-10-4-15c0-7 1-11 5-15s7-5 11-5 10-2 16-3 10-3 13-5c7-5 11-20 11-47v-282-9-12s-1-7-1-12 0-10-1-14-1-8-2-12-2-8-4-11-3-4-5-5c-3-3-8-4-14-4s-12-1-17-1-10-2-14-5-6-8-6-14 2-11 4-16 7-7 12-7c10 0 25 0 45 1s35 1 45 1c9 0 23 0 41-1s32-1 41-1c6 0 10 3 12 7s5 10 5 16c0 7-2 11-6 14s-8 5-12 5-10 1-17 1-10 2-14 4c-7 5-11 22-11 52v105c0 4 0 8 1 10 3 1 7 1 12 1h228c5 0 9-1 12-1 1-2 1-6 1-10v-105c0-30-4-47-11-52-4-2-10-3-19-4s-16-1-22-4-8-8-8-16c0-6 1-11 4-16s7-7 12-7c10 0 24 0 43 1s33 1 43 1c9 0 23 0 42-1s32-1 42-1c5 0 10 2 12 7s4 10 4 16-2 11-6 14-8 5-12 5h-17s-11 2-14 5c-8 5-12 22-12 52l1 307c0 26 4 41 11 46 3 2 8 3 15 4s13 1 18 2 9 2 13 5 6 8 6 14-1 11-4 16-7 7-12 7zm40-244-18-30 114-84h31v290s0 8-1 12 0 8 0 11-1 6-1 8l37-2v39h-143v-33c5 0 10-1 15-2 4-1 8-2 11-5s5-7 7-13 3-14 3-24v-200z" />
|
|
5
|
+
</svg>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
svg {
|
|
9
|
+
stroke: currentColor;
|
|
10
|
+
fill: currentColor;
|
|
11
|
+
stroke-width: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: auto;
|
|
14
|
+
max-height: 100%;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} H1Props */
|
|
2
|
+
/** @typedef {typeof __propDef.events} H1Events */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} H1Slots */
|
|
4
|
+
export default class H1 extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type H1Props = typeof __propDef.props;
|
|
11
|
+
export type H1Events = typeof __propDef.events;
|
|
12
|
+
export type H1Slots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
<svg viewBox="100 150 800 550" xmlns="http://www.w3.org/2000/svg" {...$$props}>
|
|
3
|
+
<path
|
|
4
|
+
d="M631 708.144c-10 0-24 0-43-1s-34-1-44-1c-9 0-24 0-43 1s-33 1-43 1c-5 0-9-2-12-6s-4-10-4-15c0-7 2-12 6-15s7-5 12-6 10-1 17-2 11-3 14-5c7-4 11-19 11-45v-127c0-5 0-8-1-10-3-1-8-2-16-2H266c-8 0-14 1-17 2v10l-1 120c0 31 5 49 12 54 4 2 9 4 16 4s14 1 19 1 10 2 15 5 6 8 6 15c0 6-1 11-4 16s-7 6-12 6c-10 0-25 0-45-1s-35-1-45-1-24 0-42 1-32 1-41 1c-5 0-9-2-12-6s-4-10-4-15c0-7 2-11 5-15s7-5 12-5 9-2 15-3 10-3 14-5c7-5 11-20 11-47l-1-18v-264-9-12-12s-1-10-2-14-1-8-2-12-2-8-3-11-4-4-5-5c-4-3-9-4-15-4s-12-1-17-1-10-2-13-5-6-8-6-14 1-11 4-16 6-7 11-7c10 0 25 0 45 1s35 1 45 1c9 0 23 0 41-1s33-1 42-1c5 0 9 3 12 7s4 10 4 16c0 7-2 11-5 14s-8 5-13 5-10 1-16 1-11 2-14 4c-8 5-12 22-12 52l1 105v10c3 1 7 1 13 1h227c6 0 10-1 13-1v-10l1-105c0-30-4-47-12-52-3-2-10-3-19-4s-16-1-22-4-8-8-8-16c0-6 1-11 4-16s7-7 12-7c10 0 24 0 43 1s34 1 43 1 24 0 42-1 33-1 42-1c6 0 10 2 12 7s5 10 5 16-2 11-6 14-9 5-13 5h-17s-11 2-14 5c-7 5-11 22-11 52v307c0 26 4 41 11 46 4 2 9 3 15 4s13 1 18 2 10 2 13 5 6 8 6 14-1 11-4 16-7 7-12 7zm152-322c-9 0-17 2-24 6s-13 9-16 15c3 3 6 8 7 13s2 9 2 12 0 7-2 11-3 7-5 10c-3 4-7 6-11 8s-9 4-16 4c-5 0-9-2-13-4s-7-4-10-8c-3-3-5-7-7-11s-2-10-2-14c0-5 2-11 4-16s5-12 9-18 9-11 16-17c6-5 13-10 21-14s17-7 27-10 21-3 32-3c14 0 27 1 40 5s26 8 37 16 19 17 26 29 10 27 10 44c0 8-2 17-5 26s-9 20-17 31-19 24-33 38-33 30-56 48c-9 8-17 15-24 22s-12 13-16 20-8 11-11 16-4 9-4 12l98 3h3c5 0 10-1 14-2s8-2 11-5 5-6 7-10 2-9 2-16h32l-4 81H686c0-17 2-32 7-46s10-26 17-37 16-21 25-31 19-18 29-27c12-12 22-22 31-32s15-20 20-30c6-9 10-18 12-27s4-18 4-27c0-8-1-16-2-24s-4-15-8-21-8-11-14-15c-7-3-14-5-24-5z" />
|
|
5
|
+
</svg>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
svg {
|
|
9
|
+
stroke: currentColor;
|
|
10
|
+
fill: currentColor;
|
|
11
|
+
stroke-width: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: auto;
|
|
14
|
+
max-height: 100%;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} H2Props */
|
|
2
|
+
/** @typedef {typeof __propDef.events} H2Events */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} H2Slots */
|
|
4
|
+
export default class H2 extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type H2Props = typeof __propDef.props;
|
|
11
|
+
export type H2Events = typeof __propDef.events;
|
|
12
|
+
export type H2Slots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
<svg viewBox="100 150 800 550" xmlns="http://www.w3.org/2000/svg" {...$$props}>
|
|
3
|
+
<path
|
|
4
|
+
d="M631 708.144c-10 0-24 0-43-1-20-1-34-1-44-1-9 0-24 0-43 1s-33 1-43 1c-5 0-9-2-12-6-3-5-4-10-4-15 0-7 2-12 6-15 3-4 7-5 12-6 5 0 10-1 17-2 6-1 11-3 14-5 7-4 11-19 11-45v-127c0-5 0-8-1-10-3-1-8-2-16-2H266c-8 0-14 1-17 2v10l-1 120c0 31 5 49 12 54 4 2 9 4 16 4 7 1 14 1 19 1s10 2 15 5c4 4 6 8 6 15 0 6-1 11-4 16s-7 7-12 7c-10 0-25 0-45-1s-35-1-45-1-24 0-42 1-32 1-41 1c-5 0-9-2-12-7-3-4-4-9-4-14 0-7 2-11 5-15 3-3 7-5 12-6 4 0 9-1 15-2s10-3 14-5c7-5 11-20 11-47l-1-18v-265-9-12-12c-1-6-1-10-2-14 0-4-1-8-2-12 0-4-2-8-3-11l-5-5c-4-3-9-4-15-4-7-1-12-1-17-1s-10-2-13-5c-4-3-6-8-6-14s1-11 4-16c2-5 6-7 11-7 10 0 25 0 45 1s35 1 45 1c9 0 23 0 41-1 19-1 33-1 42-1 5 0 9 2 12 7s4 10 4 16-2 11-5 14c-4 3-8 5-13 5s-10 0-16 1-11 2-14 4c-8 5-12 22-12 52l1 104v11h253v-11l1-104c0-30-4-47-12-52-3-3-10-4-19-4s-16-2-22-4c-5-3-8-8-8-17 0-5 1-10 4-15s7-8 12-8c10 0 24 1 43 2s34 1 43 1 24 0 42-1c19-1 33-2 42-2 6 0 10 3 12 8 3 4 5 10 5 15 0 7-2 12-6 15-4 2-9 4-13 4-5 0-11 1-17 1s-11 2-14 4c-7 5-11 23-11 53v307c0 26 4 41 11 45 4 2 9 4 15 5 7 1 13 1 18 1 5 1 10 2 13 5 4 4 6 8 6 15 0 6-1 11-4 16s-7 7-12 7zm53-61c0-5 1-10 3-15 1-5 4-9 7-12s6-6 11-8c4-2 9-3 14-3 6 0 11 1 15 3s7 5 9 8 5 7 6 10c1 4 1 8 1 11s0 7-1 11c-1 5-4 9-6 12 2 3 4 6 7 8 3 3 7 5 11 7 4 1 8 3 13 3 4 1 9 2 14 2 10 0 20-2 27-5 8-4 15-8 20-14s9-13 12-21 4-17 4-26-1-18-3-26c-2-9-6-17-12-24s-13-12-23-16c-10-5-21-7-36-7h-12c-3 0-5 1-8 1h-6v-36c2 1 4 1 5 1h4c24 0 43-5 56-16 13-12 20-28 20-49 0-9-1-16-3-23-1-7-4-13-8-18s-9-8-15-11-12-4-21-4c-4 0-9 0-13 1s-8 3-11 5l-9 6c-3 3-5 5-6 8 3 4 5 8 6 13 1 4 2 9 2 12s-1 7-2 10-3 7-6 10c-2 4-6 6-10 9-5 2-10 3-16 3s-10-1-14-3-7-5-10-8c-2-4-5-7-6-12-1-4-2-9-2-14 0-7 2-15 6-24 5-9 11-17 20-25s20-14 33-19 28-8 46-8c15 0 30 1 43 4 14 3 26 9 36 16s18 16 24 27c5 11 8 25 8 41 0 7-1 14-4 22-2 8-7 16-13 23-6 8-13 14-23 20s-21 11-35 14v1c16 3 30 7 42 13 11 6 21 13 29 21 7 9 13 18 17 27 4 10 5 20 5 31 0 17-3 32-10 46s-16 24-28 33-25 16-42 20-34 7-54 7c-19 0-35-2-49-6s-25-10-33-17-16-15-20-24-6-18-6-26z" />
|
|
5
|
+
</svg>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
svg {
|
|
9
|
+
stroke: currentColor;
|
|
10
|
+
fill: currentColor;
|
|
11
|
+
stroke-width: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: auto;
|
|
14
|
+
max-height: 100%;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} H3Props */
|
|
2
|
+
/** @typedef {typeof __propDef.events} H3Events */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} H3Slots */
|
|
4
|
+
export default class H3 extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type H3Props = typeof __propDef.props;
|
|
11
|
+
export type H3Events = typeof __propDef.events;
|
|
12
|
+
export type H3Slots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
|
|
2
|
+
<svg viewBox="100 150 800 550" xmlns="http://www.w3.org/2000/svg" {...$$props}>
|
|
3
|
+
<path
|
|
4
|
+
d="m631 708.144c-10 0-24 0-43-1s-34-1-44-1c-9 0-24 0-43 1s-33 1-43 1c-5 0-9-2-12-6s-4-10-4-15c0-7 2-12 6-15s7-5 12-6 10-1 17-2 11-3 14-5c7-4 11-19 11-45v-127c0-5 0-8-1-10-3-1-8-2-16-2h-219c-8 0-14 1-17 2v10l-1 120c0 31 5 49 12 54 4 2 9 4 16 4s14 1 19 1 10 2 15 5 6 8 6 15c0 6-1 11-4 16s-7 6-12 6c-10 0-25 0-45-1s-35-1-45-1-24 0-42 1-32 1-41 1c-5 0-9-2-12-6s-4-10-4-15c0-7 2-11 5-15s7-5 12-5 9-2 15-3 10-3 14-5c7-5 11-20 11-47l-1-18v-264-9-12-12s-1-10-2-14-1-8-2-12-2-8-3-11-4-4-5-5c-4-3-9-4-15-4s-12-1-17-1-10-2-13-5-6-8-6-14 1-11 4-16 6-7 11-7c10 0 25 0 45 1s35 1 45 1c9 0 23 0 41-1s33-1 42-1c5 0 9 3 12 7s4 10 4 16c0 7-2 11-5 14s-8 5-13 5-10 1-16 1-11 2-14 4c-8 5-12 22-12 52l1 105v10c3 1 7 1 13 1h227c6 0 10-1 13-1v-10l1-105c0-30-4-47-12-52-3-2-10-3-19-4s-16-1-22-4-8-8-8-16c0-6 1-11 4-16s7-7 12-7c10 0 24 0 43 1s34 1 43 1 24 0 42-1 33-1 42-1c6 0 10 2 12 7s5 10 5 16-2 11-6 14-9 5-13 5h-17s-11 2-14 5c-7 5-11 22-11 52v307c0 26 4 41 11 46 4 2 9 3 15 4s13 1 18 2 10 2 13 5 6 8 6 14-1 11-4 16-7 7-12 7zm244-90v22s0 8-1 12 0 8 0 11-1 6-1 8l37-2v39h-142v-33c5 0 10-1 15-2s8-2 11-5 5-7 7-13 2-14 2-24v-14h-130v-46l172-221h30v222h49v46zm-156-47h84v-110z" />
|
|
5
|
+
</svg>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
svg {
|
|
9
|
+
stroke: currentColor;
|
|
10
|
+
fill: currentColor;
|
|
11
|
+
stroke-width: 0;
|
|
12
|
+
width: 100%;
|
|
13
|
+
height: auto;
|
|
14
|
+
max-height: 100%;
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** @typedef {typeof __propDef.props} H4Props */
|
|
2
|
+
/** @typedef {typeof __propDef.events} H4Events */
|
|
3
|
+
/** @typedef {typeof __propDef.slots} H4Slots */
|
|
4
|
+
export default class H4 extends SvelteComponentTyped<{
|
|
5
|
+
[x: string]: any;
|
|
6
|
+
}, {
|
|
7
|
+
[evt: string]: CustomEvent<any>;
|
|
8
|
+
}, {}> {
|
|
9
|
+
}
|
|
10
|
+
export type H4Props = typeof __propDef.props;
|
|
11
|
+
export type H4Events = typeof __propDef.events;
|
|
12
|
+
export type H4Slots = typeof __propDef.slots;
|
|
13
|
+
import { SvelteComponentTyped } from "svelte";
|
|
14
|
+
declare const __propDef: {
|
|
15
|
+
props: {
|
|
16
|
+
[x: string]: any;
|
|
17
|
+
};
|
|
18
|
+
events: {
|
|
19
|
+
[evt: string]: CustomEvent<any>;
|
|
20
|
+
};
|
|
21
|
+
slots: {};
|
|
22
|
+
};
|
|
23
|
+
export {};
|
|
@@ -18,11 +18,11 @@ let toolboxY;
|
|
|
18
18
|
export function showAsToolbox(rect) {
|
|
19
19
|
isToolbox = true;
|
|
20
20
|
visible = true;
|
|
21
|
-
const margin =
|
|
21
|
+
const margin = 0;
|
|
22
22
|
const windowWidth = window.innerWidth - 2 * margin;
|
|
23
23
|
toolboxX = margin;
|
|
24
24
|
toolboxY = rect.bottom + margin;
|
|
25
|
-
css_style = `position:
|
|
25
|
+
css_style = `position: fixed; left:${toolboxX}px; top:${toolboxY}px;`;
|
|
26
26
|
dispatch("palette_shown");
|
|
27
27
|
}
|
|
28
28
|
export function show(x, y, up = false) {
|
|
@@ -171,7 +171,8 @@ function mouseup(e) {
|
|
|
171
171
|
<div class="flex items-center justify-center mt-1 sm:mt-0.5" style:width={`${icon_placeholder_size*0.25}rem`}>
|
|
172
172
|
{#if cmd.icon}
|
|
173
173
|
{@const cc = mobile ? 7 : 6}
|
|
174
|
-
{@const
|
|
174
|
+
{@const default_icon_size = icon_placeholder_size - cc}
|
|
175
|
+
{@const icon_size = cmd.icon_size ? cmd.icon_size : default_icon_size}
|
|
175
176
|
<Icon size={icon_size} component={cmd.icon}/>
|
|
176
177
|
{/if}
|
|
177
178
|
</div>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script>import { Selection_helper } from "./internal/Selection_helper";
|
|
2
|
-
import { afterUpdate, getContext, onDestroy, onMount } from "svelte";
|
|
2
|
+
import { beforeUpdate, afterUpdate, getContext, onDestroy, onMount } from "svelte";
|
|
3
3
|
import { Selection_range, Selection_edge } from "./internal/Selection_range";
|
|
4
4
|
import { data_tick_store, contextItemsStore, contextTypesStore } from "../../stores.js";
|
|
5
5
|
import { informModification, pushChanges } from "../../updates.js";
|
|
@@ -13,6 +13,10 @@ import FaComments from "svelte-icons/fa/FaComment.svelte";
|
|
|
13
13
|
import FaQuote from "svelte-icons/fa/FaQuoteRight.svelte";
|
|
14
14
|
import FaWarn from "svelte-icons/fa/FaExclamationTriangle.svelte";
|
|
15
15
|
import FaInfo from "svelte-icons/fa/FaInfo.svelte";
|
|
16
|
+
import IcH1 from "./internal/h1.icon.svelte";
|
|
17
|
+
import IcH2 from "./internal/h2.icon.svelte";
|
|
18
|
+
import IcH3 from "./internal/h3.icon.svelte";
|
|
19
|
+
import IcH4 from "./internal/h4.icon.svelte";
|
|
16
20
|
import { showMenu } from "../menu";
|
|
17
21
|
export let value = "";
|
|
18
22
|
export let placeholder = "";
|
|
@@ -85,8 +89,6 @@ function setup_source() {
|
|
|
85
89
|
if (!value)
|
|
86
90
|
value = "<p>\u200B</p>";
|
|
87
91
|
has_changed_value = false;
|
|
88
|
-
if (stored_selection)
|
|
89
|
-
set_selection(stored_selection);
|
|
90
92
|
}
|
|
91
93
|
onMount(() => {
|
|
92
94
|
if (!editable_div)
|
|
@@ -114,6 +116,19 @@ onDestroy(() => {
|
|
|
114
116
|
if (is_command_palette_visible)
|
|
115
117
|
hide_command_palette();
|
|
116
118
|
});
|
|
119
|
+
let storedSelection = null;
|
|
120
|
+
beforeUpdate(() => {
|
|
121
|
+
if (editable_div && document.activeElement == editable_div)
|
|
122
|
+
storedSelection = Selection_helper.get_selection(editable_div);
|
|
123
|
+
else
|
|
124
|
+
storedSelection = null;
|
|
125
|
+
});
|
|
126
|
+
afterUpdate(() => {
|
|
127
|
+
if (storedSelection) {
|
|
128
|
+
const range = Selection_helper.create_range(editable_div, storedSelection.begin.absolute_index, storedSelection.end.absolute_index);
|
|
129
|
+
set_selection(range);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
117
132
|
function content_changed(checkZeroWitdhSpaces) {
|
|
118
133
|
if (document.activeElement != editable_div)
|
|
119
134
|
return;
|
|
@@ -755,7 +770,7 @@ function set_tag_and_class_for_paragraph(node, tag, css_class) {
|
|
|
755
770
|
function do_format(tag, css_class) {
|
|
756
771
|
const elem = editable_div;
|
|
757
772
|
const editableElem = editable_div;
|
|
758
|
-
let
|
|
773
|
+
let stored_selection = Selection_helper.get_selection(elem);
|
|
759
774
|
let sel = window.getSelection();
|
|
760
775
|
let should_restore_selection = false;
|
|
761
776
|
if (sel.isCollapsed || sel.focusNode === sel.anchorNode) {
|
|
@@ -784,7 +799,7 @@ function do_format(tag, css_class) {
|
|
|
784
799
|
} while (node);
|
|
785
800
|
}
|
|
786
801
|
if (should_restore_selection) {
|
|
787
|
-
const range = Selection_helper.create_range(editableElem,
|
|
802
|
+
const range = Selection_helper.create_range(editableElem, stored_selection.begin.absolute_index, stored_selection.end.absolute_index);
|
|
788
803
|
set_selection(range);
|
|
789
804
|
}
|
|
790
805
|
}
|
|
@@ -941,10 +956,7 @@ function navigate_command_palette(key) {
|
|
|
941
956
|
else if (key == "ArrowUp")
|
|
942
957
|
palette.navigate_up();
|
|
943
958
|
}
|
|
944
|
-
let stored_selection = void 0;
|
|
945
959
|
function on_selection_changed() {
|
|
946
|
-
let active_range = Selection_helper.get_selection(editable_div);
|
|
947
|
-
stored_selection = window.getSelection()?.getRangeAt(0);
|
|
948
960
|
}
|
|
949
961
|
let intervalId = 0;
|
|
950
962
|
function on_focus() {
|
|
@@ -952,7 +964,7 @@ function on_focus() {
|
|
|
952
964
|
function on_blur() {
|
|
953
965
|
let active_range = Selection_helper.get_selection(editable_div);
|
|
954
966
|
console.log("rich.edit: on_blur", active_range?.begin?.absolute_index);
|
|
955
|
-
|
|
967
|
+
storedSelection = null;
|
|
956
968
|
if (onBlur) {
|
|
957
969
|
onBlur();
|
|
958
970
|
onBlur = void 0;
|
|
@@ -989,10 +1001,10 @@ let commands = [
|
|
|
989
1001
|
// { caption: 'Heading 1', description: 'Big section heading', tags: 'h1', icon: FaHead, icon_size: 6, on_choice: () => { do_format('h2', '') } } ,
|
|
990
1002
|
// { caption: 'Heading 2', description: 'Medium section heading', tags: 'h2', icon: FaHead, icon_size: 5, on_choice: () => { do_format('h3', '') } } ,
|
|
991
1003
|
// { caption: 'Heading 3', description: 'Small section heading', tags: 'h3', icon: FaHead, icon_size: 4, on_choice: () => { do_format('h4', '') } } ,
|
|
992
|
-
{ caption: "Heading 1", description: "Description heading", tags: "h1", icon:
|
|
1004
|
+
{ caption: "Heading 1", description: "Description heading", tags: "h1", icon: IcH1, on_choice: () => {
|
|
993
1005
|
do_format("h1", "");
|
|
994
1006
|
} },
|
|
995
|
-
{ caption: "Heading 2", description: "Description heading", tags: "h2", icon:
|
|
1007
|
+
{ caption: "Heading 2", description: "Description heading", tags: "h2", icon: IcH2, on_choice: () => {
|
|
996
1008
|
do_format("h2", "");
|
|
997
1009
|
} },
|
|
998
1010
|
// { caption: 'Heading 2', description: 'Medium description heading', tags: 'h3', icon: FaHead, icon_size: 5, on_choice: () => { do_format('h3', '') } } ,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@humandialog/forms.svelte",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.15",
|
|
4
4
|
"description": "Basic Svelte UI components for Object Reef applications",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@playwright/test": "^1.28.1",
|
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
"./components/date.svelte": "./components/date.svelte",
|
|
62
62
|
"./components/delayed.spinner.svelte": "./components/delayed.spinner.svelte",
|
|
63
63
|
"./components/document/internal/Document_command": "./components/document/internal/Document_command.js",
|
|
64
|
+
"./components/document/internal/h1.icon.svelte": "./components/document/internal/h1.icon.svelte",
|
|
65
|
+
"./components/document/internal/h2.icon.svelte": "./components/document/internal/h2.icon.svelte",
|
|
66
|
+
"./components/document/internal/h3.icon.svelte": "./components/document/internal/h3.icon.svelte",
|
|
67
|
+
"./components/document/internal/h4.icon.svelte": "./components/document/internal/h4.icon.svelte",
|
|
64
68
|
"./components/document/internal/palette.row.svelte": "./components/document/internal/palette.row.svelte",
|
|
65
69
|
"./components/document/internal/palette.svelte": "./components/document/internal/palette.svelte",
|
|
66
70
|
"./components/document/internal/Selection_helper": "./components/document/internal/Selection_helper.js",
|