fuma 1.0.16 → 1.0.17
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/private/Meta.svelte +27 -32
- package/dist/private/Meta.svelte.d.ts +0 -1
- package/dist/private/api.d.ts +1 -1
- package/dist/ui/badge/Badge.svelte +3 -4
- package/dist/ui/button/ButtonCopy.svelte +31 -37
- package/dist/ui/button/ButtonDelete.svelte +21 -23
- package/dist/ui/button/ButtonDelete.svelte.d.ts +0 -1
- package/dist/ui/card/Card.svelte +10 -13
- package/dist/ui/card/Card.svelte.d.ts +0 -1
- package/dist/ui/card/CardBasic.svelte +4 -5
- package/dist/ui/card/CardBasic.svelte.d.ts +0 -1
- package/dist/ui/card/CardCollapse.svelte +31 -35
- package/dist/ui/card/CardCollapse.svelte.d.ts +0 -1
- package/dist/ui/card/CardFullScreen.svelte +6 -8
- package/dist/ui/card/CardFullScreen.svelte.d.ts +0 -3
- package/dist/ui/card/CardLink.svelte +4 -5
- package/dist/ui/card/CardLink.svelte.d.ts +0 -1
- package/dist/ui/dialog/Dialog.svelte +34 -41
- package/dist/ui/dialog/Dialog.svelte.d.ts +0 -1
- package/dist/ui/dialog/DialogConfirm.svelte +4 -6
- package/dist/ui/dialog/DialogConfirm.svelte.d.ts +0 -1
- package/dist/ui/drawer/Drawer.svelte +37 -46
- package/dist/ui/drawer/Drawer.svelte.d.ts +0 -16
- package/dist/ui/form/Form.svelte +82 -100
- package/dist/ui/form/Form.svelte.d.ts +0 -1
- package/dist/ui/form/FormInput.svelte +6 -12
- package/dist/ui/form/FormInput.svelte.d.ts +0 -18
- package/dist/ui/form/FormSection.svelte +16 -23
- package/dist/ui/form/formInput.d.ts +0 -1
- package/dist/ui/icon/Icon.svelte +32 -35
- package/dist/ui/input/FormControl.svelte +32 -38
- package/dist/ui/input/FormControl.svelte.d.ts +0 -3
- package/dist/ui/input/InputBoolean.svelte +8 -13
- package/dist/ui/input/InputBoolean.svelte.d.ts +0 -3
- package/dist/ui/input/InputCheckboxs.svelte +20 -22
- package/dist/ui/input/InputCheckboxs.svelte.d.ts +0 -3
- package/dist/ui/input/InputCheckboxsMenu.svelte +35 -51
- package/dist/ui/input/InputCheckboxsMenu.svelte.d.ts +0 -3
- package/dist/ui/input/InputCheckboxsTree.svelte +6 -9
- package/dist/ui/input/InputCheckboxsTreeNodes.svelte +27 -35
- package/dist/ui/input/InputCombo.svelte +34 -43
- package/dist/ui/input/InputCombo.svelte.d.ts +0 -3
- package/dist/ui/input/InputDate.svelte +17 -22
- package/dist/ui/input/InputDateTime.svelte +18 -23
- package/dist/ui/input/InputImage.svelte +45 -52
- package/dist/ui/input/InputImage.svelte.d.ts +0 -1
- package/dist/ui/input/InputImagePreview.svelte +20 -24
- package/dist/ui/input/InputNumber.svelte +5 -10
- package/dist/ui/input/InputOptionInParam.svelte +10 -12
- package/dist/ui/input/InputOptions.svelte +34 -40
- package/dist/ui/input/InputPassword.svelte +5 -7
- package/dist/ui/input/InputPassword.svelte.d.ts +0 -3
- package/dist/ui/input/InputRadio.svelte +32 -36
- package/dist/ui/input/InputRadio.svelte.d.ts +0 -3
- package/dist/ui/input/InputRelation.svelte +67 -83
- package/dist/ui/input/InputRelation.svelte.d.ts +0 -1
- package/dist/ui/input/InputRelations.svelte +79 -92
- package/dist/ui/input/InputSearch.svelte +10 -13
- package/dist/ui/input/InputSelect.svelte +28 -39
- package/dist/ui/input/InputText.svelte +7 -8
- package/dist/ui/input/InputTextarea.svelte +6 -6
- package/dist/ui/input/InputTime.svelte +23 -29
- package/dist/ui/input/RelationAfter.svelte +9 -13
- package/dist/ui/input/SelectorList.svelte +12 -16
- package/dist/ui/input/SelectorList.svelte.d.ts +0 -4
- package/dist/ui/input/textRich/InputTextRich.svelte +50 -57
- package/dist/ui/input/textRich/InputTextRich.svelte.d.ts +0 -3
- package/dist/ui/input/textRich/SuggesionList.svelte +9 -13
- package/dist/ui/input/textRich/ToolMark.svelte +9 -12
- package/dist/ui/input/textRich/ToolMarkColor.svelte +11 -15
- package/dist/ui/input/textRich/ToolMarkLink.svelte +38 -46
- package/dist/ui/input/textRich/ToolMenu.svelte +19 -34
- package/dist/ui/input/textRich/ToolMenuAlign.svelte +9 -13
- package/dist/ui/input/textRich/ToolMenuInsert.svelte +7 -12
- package/dist/ui/input/textRich/ToolMenuNode.svelte +10 -14
- package/dist/ui/input/textRich/ToolsBar.svelte +11 -15
- package/dist/ui/login/Login.svelte +30 -36
- package/dist/ui/menu/ContextMenu.svelte +31 -37
- package/dist/ui/menu/ContextMenu.svelte.d.ts +0 -1
- package/dist/ui/menu/DropDown.svelte +83 -92
- package/dist/ui/menu/DropDown.svelte.d.ts +0 -1
- package/dist/ui/menu/DropDownMenu.svelte +18 -25
- package/dist/ui/menu/DropDownMenu.svelte.d.ts +0 -1
- package/dist/ui/mode/ToggleMode.svelte +14 -15
- package/dist/ui/mode/ToggleMode.svelte.d.ts +1 -6
- package/dist/ui/pagination/Pagination.svelte +8 -9
- package/dist/ui/placeholder/Placeholder.svelte +3 -4
- package/dist/ui/placeholder/Placeholder.svelte.d.ts +0 -1
- package/dist/ui/placeholder/PlaceholderImage.svelte +4 -6
- package/dist/ui/placeholder/PlaceholderImage.svelte.d.ts +0 -1
- package/dist/ui/range/RangePicker.svelte +62 -75
- package/dist/ui/range/RangePicker.svelte.d.ts +2 -2
- package/dist/ui/range/RangePickerButton.svelte +35 -43
- package/dist/ui/slot/Slot.svelte +25 -42
- package/dist/ui/slot/Span.svelte +1 -2
- package/dist/ui/table/Table.svelte +28 -35
- package/dist/ui/table/TableBody.svelte +12 -18
- package/dist/ui/table/TableCell.svelte +10 -13
- package/dist/ui/table/TableFieldsEdition.svelte +51 -57
- package/dist/ui/table/TableHead.svelte +20 -19
- package/dist/ui/table/TableViewSelect.svelte +37 -50
- package/dist/ui/table/cell/TableCellArray.svelte +3 -5
- package/dist/ui/table/cell/TableCellBoolean.svelte +3 -4
- package/dist/ui/table/cell/TableCellNumber.svelte +1 -2
- package/dist/ui/table/cell/TableCellString.svelte +2 -5
- package/dist/ui/table/head/OrderButtons.svelte +37 -0
- package/dist/ui/table/head/OrderButtons.svelte.d.ts +20 -0
- package/dist/ui/table/head/TableHeadBoolean.svelte +3 -6
- package/dist/ui/table/head/TableHeadDate.svelte +110 -61
- package/dist/ui/table/head/TableHeadDefault.svelte +2 -5
- package/dist/ui/table/head/TableHeadNumber.svelte +76 -67
- package/dist/ui/table/head/TableHeadSelect.svelte +41 -47
- package/dist/ui/table/head/TableHeadString.svelte +8 -14
- package/dist/ui/tabs/Tabs.svelte +5 -8
- package/dist/ui/tabs/TabsIcon.svelte +28 -31
- package/dist/validation/zod.d.ts +12 -0
- package/dist/validation/zod.js +4 -2
- package/package.json +1 -1
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export let inputElement: HTMLInputElement | undefined = undefined
|
|
1
|
+
<script>import { FormControl, bindValueWithParams } from "./index.js";
|
|
2
|
+
$:
|
|
3
|
+
({ input, value: _value, classWrapper, bindWithParams, ...props } = $$props);
|
|
4
|
+
$:
|
|
5
|
+
({ class: inputClass, ...inputProps } = input || {});
|
|
6
|
+
export let value = _value;
|
|
7
|
+
export let inputElement = void 0;
|
|
9
8
|
</script>
|
|
10
9
|
|
|
11
10
|
<FormControl {...props} enhanceDisabled={props.enhanceDisabled || bindWithParams} let:key>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
<script>import { FormControl } from "./index.js";
|
|
2
|
+
$:
|
|
3
|
+
({ textarea, value: _value, ...props } = $$props);
|
|
4
|
+
$:
|
|
5
|
+
({ class: inputClass, ...inputProps } = textarea || {});
|
|
6
|
+
export let value = _value;
|
|
7
7
|
</script>
|
|
8
8
|
|
|
9
9
|
<FormControl {...props} let:key>
|
|
@@ -1,32 +1,26 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
date.getFullYear().toString(),
|
|
25
|
-
(date.getMonth() + 1).toString().padStart(2, '0'),
|
|
26
|
-
date.getDate().toString().padStart(2, '0')
|
|
27
|
-
].join('-')
|
|
28
|
-
return new Date(`${dateString}T${v}`)
|
|
29
|
-
}
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { FormControl } from "./index.js";
|
|
3
|
+
import dayjs from "dayjs";
|
|
4
|
+
export let value = void 0;
|
|
5
|
+
export let input = {};
|
|
6
|
+
$:
|
|
7
|
+
({ class: inputClass = "", ...inputProps } = input);
|
|
8
|
+
const dispatch = createEventDispatcher();
|
|
9
|
+
const onInput = ({ currentTarget }) => {
|
|
10
|
+
value = getDateTime(currentTarget.value);
|
|
11
|
+
dispatch("input", value);
|
|
12
|
+
};
|
|
13
|
+
function getDateTime(v) {
|
|
14
|
+
if (!v)
|
|
15
|
+
return value;
|
|
16
|
+
const date = new Date(value || 0);
|
|
17
|
+
const dateString = [
|
|
18
|
+
date.getFullYear().toString(),
|
|
19
|
+
(date.getMonth() + 1).toString().padStart(2, "0"),
|
|
20
|
+
date.getDate().toString().padStart(2, "0")
|
|
21
|
+
].join("-");
|
|
22
|
+
return /* @__PURE__ */ new Date(`${dateString}T${v}`);
|
|
23
|
+
}
|
|
30
24
|
</script>
|
|
31
25
|
|
|
32
26
|
<FormControl {...$$restProps} let:key>
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export let createTitle = ''
|
|
11
|
-
export let createIcon = mdiPlus
|
|
12
|
-
|
|
13
|
-
const dispatch = createEventDispatcher<{ unselect: void; create: void }>()
|
|
1
|
+
<script>import { fade } from "svelte/transition";
|
|
2
|
+
import { createEventDispatcher } from "svelte";
|
|
3
|
+
import { mdiLoading, mdiPlus } from "@mdi/js";
|
|
4
|
+
import Icon from "../icon/Icon.svelte";
|
|
5
|
+
export let isLoading;
|
|
6
|
+
export let createUrl = "";
|
|
7
|
+
export let createTitle = "";
|
|
8
|
+
export let createIcon = mdiPlus;
|
|
9
|
+
const dispatch = createEventDispatcher();
|
|
14
10
|
</script>
|
|
15
11
|
|
|
16
12
|
{#if isLoading}
|
|
@@ -1,19 +1,15 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export let keyDownEvent: KeyboardEvent | undefined = undefined
|
|
14
|
-
export let keyDownPreventDefault = true
|
|
15
|
-
|
|
16
|
-
const dispatch = createEventDispatcher<{ select: number }>()
|
|
1
|
+
<script generics="Item extends {id: string}">import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { selector } from "../../action/selector.js";
|
|
3
|
+
let klass = "";
|
|
4
|
+
export { klass as class };
|
|
5
|
+
export let items;
|
|
6
|
+
export let isError = false;
|
|
7
|
+
export let isLoading = false;
|
|
8
|
+
export let focusIndex = 0;
|
|
9
|
+
export let trigger = void 0;
|
|
10
|
+
export let keyDownEvent = void 0;
|
|
11
|
+
export let keyDownPreventDefault = true;
|
|
12
|
+
const dispatch = createEventDispatcher();
|
|
17
13
|
</script>
|
|
18
14
|
|
|
19
15
|
<ul
|
|
@@ -11,10 +11,6 @@ declare class __sveltets_Render<Item extends {
|
|
|
11
11
|
trigger?: HTMLElement | undefined;
|
|
12
12
|
keyDownEvent?: KeyboardEvent | undefined;
|
|
13
13
|
keyDownPreventDefault?: boolean | undefined;
|
|
14
|
-
children?: import("svelte").Snippet<[{
|
|
15
|
-
item: Item;
|
|
16
|
-
index: any;
|
|
17
|
-
}]> | undefined;
|
|
18
14
|
};
|
|
19
15
|
events(): {
|
|
20
16
|
select: CustomEvent<number>;
|
|
@@ -1,60 +1,53 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const updateValue = debounce(() => {
|
|
52
|
-
if (!editor) return
|
|
53
|
-
const newValue = JSON.stringify(editor.getJSON())
|
|
54
|
-
if (newValue === value) return
|
|
55
|
-
value = newValue
|
|
56
|
-
dispatch('change')
|
|
57
|
-
}, 120)
|
|
1
|
+
<script>import { createEventDispatcher, onMount } from "svelte";
|
|
2
|
+
import { Editor } from "@tiptap/core";
|
|
3
|
+
import debounce from "debounce";
|
|
4
|
+
import { jsonParse } from "../../../utils/jsonParse.js";
|
|
5
|
+
import { FormControl } from "../index.js";
|
|
6
|
+
import ToolsBar from "./ToolsBar.svelte";
|
|
7
|
+
import { extensions } from "./extensions.js";
|
|
8
|
+
export let value = "";
|
|
9
|
+
export let classToolbar = "";
|
|
10
|
+
let element;
|
|
11
|
+
let editor = null;
|
|
12
|
+
const dispatch = createEventDispatcher();
|
|
13
|
+
onMount(() => {
|
|
14
|
+
initEditor();
|
|
15
|
+
return () => {
|
|
16
|
+
if (editor)
|
|
17
|
+
editor.destroy();
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
export function setImage(image) {
|
|
21
|
+
if (!editor)
|
|
22
|
+
return false;
|
|
23
|
+
return editor.commands.setImage(image);
|
|
24
|
+
}
|
|
25
|
+
function initEditor() {
|
|
26
|
+
const valueAsHtml = !value.startsWith("{") && value !== "null";
|
|
27
|
+
editor = new Editor({
|
|
28
|
+
element,
|
|
29
|
+
content: valueAsHtml ? value : jsonParse(value, void 0),
|
|
30
|
+
editorProps: {
|
|
31
|
+
attributes: {
|
|
32
|
+
class: "prose max-w-[210mm] mx-auto focus:outline-none"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
extensions,
|
|
36
|
+
onTransaction() {
|
|
37
|
+
editor = editor;
|
|
38
|
+
updateValue();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
const updateValue = debounce(() => {
|
|
43
|
+
if (!editor)
|
|
44
|
+
return;
|
|
45
|
+
const newValue = JSON.stringify(editor.getJSON());
|
|
46
|
+
if (newValue === value)
|
|
47
|
+
return;
|
|
48
|
+
value = newValue;
|
|
49
|
+
dispatch("change");
|
|
50
|
+
}, 120);
|
|
58
51
|
</script>
|
|
59
52
|
|
|
60
53
|
<FormControl {...$$restProps} let:key>
|
|
@@ -16,9 +16,6 @@ declare const __propDef: {
|
|
|
16
16
|
prefixFor?: string | number | undefined;
|
|
17
17
|
enhanceDisabled?: boolean | undefined;
|
|
18
18
|
labelPosition?: ("top" | "left" | "right") | undefined;
|
|
19
|
-
children?: import("svelte").Snippet<[{
|
|
20
|
-
key: string;
|
|
21
|
-
}]> | undefined;
|
|
22
19
|
} & {
|
|
23
20
|
value?: string | undefined;
|
|
24
21
|
classToolbar?: string | undefined;
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
const item = props.items[index]
|
|
11
|
-
if (!item) return
|
|
12
|
-
props.command(item)
|
|
13
|
-
}
|
|
1
|
+
<script>import { SelectorList } from "../index.js";
|
|
2
|
+
export let props;
|
|
3
|
+
export let keyDownEvent = void 0;
|
|
4
|
+
function handleSelect(index) {
|
|
5
|
+
const item = props.items[index];
|
|
6
|
+
if (!item)
|
|
7
|
+
return;
|
|
8
|
+
props.command(item);
|
|
9
|
+
}
|
|
14
10
|
</script>
|
|
15
11
|
|
|
16
12
|
<SelectorList
|
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
export let action: () => void
|
|
11
|
-
|
|
12
|
-
$: isActive = editor.isActive(key)
|
|
1
|
+
<script>import { Icon } from "../../icon/index.js";
|
|
2
|
+
import { tip } from "../../../action/tip.js";
|
|
3
|
+
export let editor;
|
|
4
|
+
export let key;
|
|
5
|
+
export let label;
|
|
6
|
+
export let icon;
|
|
7
|
+
export let action;
|
|
8
|
+
$:
|
|
9
|
+
isActive = editor.isActive(key);
|
|
13
10
|
</script>
|
|
14
11
|
|
|
15
12
|
<button
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
function handleClick() {
|
|
13
|
-
inputColor.click()
|
|
14
|
-
setColor(color)
|
|
15
|
-
}
|
|
1
|
+
<script>import { Icon } from "../../icon/index.js";
|
|
2
|
+
import { tip } from "../../../action/tip.js";
|
|
3
|
+
export let icon;
|
|
4
|
+
export let label;
|
|
5
|
+
export let color;
|
|
6
|
+
export let setColor;
|
|
7
|
+
let inputColor;
|
|
8
|
+
function handleClick() {
|
|
9
|
+
inputColor.click();
|
|
10
|
+
setColor(color);
|
|
11
|
+
}
|
|
16
12
|
</script>
|
|
17
13
|
|
|
18
14
|
<div class="flex align-bottom">
|
|
@@ -1,49 +1,41 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
dialogLink.close()
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function handleKeyDown(event: KeyboardEvent) {
|
|
43
|
-
if (event.key !== 'Enter') return
|
|
44
|
-
event.preventDefault()
|
|
45
|
-
handleNewLink()
|
|
46
|
-
}
|
|
1
|
+
<script>import { mdiLinkVariant } from "@mdi/js";
|
|
2
|
+
import { Dialog } from "../../dialog/index.js";
|
|
3
|
+
import { InputText } from "../index.js";
|
|
4
|
+
import { z } from "../../../validation/zod.js";
|
|
5
|
+
import ToolMark from "./ToolMark.svelte";
|
|
6
|
+
export let editor;
|
|
7
|
+
let dialogLink;
|
|
8
|
+
let linkHref = "";
|
|
9
|
+
let linkError = "";
|
|
10
|
+
async function handleNewLink() {
|
|
11
|
+
if (!linkHref) {
|
|
12
|
+
linkError = "URL requis";
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
const isEmail = z.string().email().safeParse(linkHref);
|
|
16
|
+
if (isEmail.success)
|
|
17
|
+
linkHref = "mailto:" + linkHref;
|
|
18
|
+
else if (!linkHref.match(/^http(s)?:\/\//)) {
|
|
19
|
+
linkHref = "https://" + linkHref;
|
|
20
|
+
}
|
|
21
|
+
const isUrl = z.string().url().safeParse(linkHref);
|
|
22
|
+
if (!isUrl.success) {
|
|
23
|
+
linkError = "URL invalide";
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
editor.chain().focus().setLink({ href: linkHref }).run();
|
|
27
|
+
dialogLink.close();
|
|
28
|
+
}
|
|
29
|
+
function handleRemoveLink() {
|
|
30
|
+
editor.chain().focus().unsetLink().run();
|
|
31
|
+
dialogLink.close();
|
|
32
|
+
}
|
|
33
|
+
function handleKeyDown(event) {
|
|
34
|
+
if (event.key !== "Enter")
|
|
35
|
+
return;
|
|
36
|
+
event.preventDefault();
|
|
37
|
+
handleNewLink();
|
|
38
|
+
}
|
|
47
39
|
</script>
|
|
48
40
|
|
|
49
41
|
<ToolMark
|
|
@@ -1,37 +1,22 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export let hideLabel = false
|
|
21
|
-
|
|
22
|
-
let dropdown: DropDown
|
|
23
|
-
|
|
24
|
-
function handleClick(tool: Tool) {
|
|
25
|
-
tool.action()
|
|
26
|
-
dropdown.hide()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
$: toolSelected =
|
|
30
|
-
tools.find((t) => {
|
|
31
|
-
if (t.key) return editor.isActive(t.key, t.attributes)
|
|
32
|
-
if (t.attributes) return editor.isActive(t.attributes)
|
|
33
|
-
return false
|
|
34
|
-
}) || tools[0]
|
|
1
|
+
<script>import { mdiChevronDown } from "@mdi/js";
|
|
2
|
+
import { Icon } from "../../icon/index.js";
|
|
3
|
+
import { DropDown } from "../../menu/index.js";
|
|
4
|
+
export let editor;
|
|
5
|
+
export let tools;
|
|
6
|
+
export let hideLabel = false;
|
|
7
|
+
let dropdown;
|
|
8
|
+
function handleClick(tool) {
|
|
9
|
+
tool.action();
|
|
10
|
+
dropdown.hide();
|
|
11
|
+
}
|
|
12
|
+
$:
|
|
13
|
+
toolSelected = tools.find((t) => {
|
|
14
|
+
if (t.key)
|
|
15
|
+
return editor.isActive(t.key, t.attributes);
|
|
16
|
+
if (t.attributes)
|
|
17
|
+
return editor.isActive(t.attributes);
|
|
18
|
+
return false;
|
|
19
|
+
}) || tools[0];
|
|
35
20
|
</script>
|
|
36
21
|
|
|
37
22
|
<DropDown hideOnBlur bind:this={dropdown}>
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
import ToolMenu from './ToolMenu.svelte'
|
|
12
|
-
|
|
13
|
-
export let editor: Editor
|
|
1
|
+
<script>import {
|
|
2
|
+
mdiAlignHorizontalLeft,
|
|
3
|
+
mdiAlignHorizontalCenter,
|
|
4
|
+
mdiAlignHorizontalRight,
|
|
5
|
+
mdiFormatIndentIncrease,
|
|
6
|
+
mdiFormatIndentDecrease
|
|
7
|
+
} from "@mdi/js";
|
|
8
|
+
import ToolMenu from "./ToolMenu.svelte";
|
|
9
|
+
export let editor;
|
|
14
10
|
</script>
|
|
15
11
|
|
|
16
12
|
<ToolMenu
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { suggestionItems } from './suggestion.js'
|
|
9
|
-
|
|
10
|
-
export let editor: Editor
|
|
11
|
-
|
|
12
|
-
const dispatch = createEventDispatcher<{ insertMedia: void }>()
|
|
1
|
+
<script>import { createEventDispatcher } from "svelte";
|
|
2
|
+
import { mdiPlus, mdiMinus, mdiImageOutline, mdiYoutube, mdiAt } from "@mdi/js";
|
|
3
|
+
import { Icon } from "../../icon/index.js";
|
|
4
|
+
import ToolMenu from "./ToolMenu.svelte";
|
|
5
|
+
import { suggestionItems } from "./suggestion.js";
|
|
6
|
+
export let editor;
|
|
7
|
+
const dispatch = createEventDispatcher();
|
|
13
8
|
</script>
|
|
14
9
|
|
|
15
10
|
<ToolMenu
|
|
@@ -1,17 +1,13 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import ToolMenu from './ToolMenu.svelte'
|
|
13
|
-
|
|
14
|
-
export let editor: Editor
|
|
1
|
+
<script>import {
|
|
2
|
+
mdiText,
|
|
3
|
+
mdiFormatListBulleted,
|
|
4
|
+
mdiFormatListNumbered,
|
|
5
|
+
mdiFormatHeader1,
|
|
6
|
+
mdiFormatHeader3,
|
|
7
|
+
mdiFormatHeader2
|
|
8
|
+
} from "@mdi/js";
|
|
9
|
+
import ToolMenu from "./ToolMenu.svelte";
|
|
10
|
+
export let editor;
|
|
15
11
|
</script>
|
|
16
12
|
|
|
17
13
|
<ToolMenu
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
<script
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
export let editor: Editor
|
|
14
|
-
let klass = ''
|
|
15
|
-
export { klass as class }
|
|
1
|
+
<script>import { mdiFormatBold, mdiFormatColorFill, mdiFormatColorText, mdiFormatItalic } from "@mdi/js";
|
|
2
|
+
import { toast } from "svelte-sonner";
|
|
3
|
+
import ToolMenuNode from "./ToolMenuNode.svelte";
|
|
4
|
+
import ToolMark from "./ToolMark.svelte";
|
|
5
|
+
import ToolMarkColor from "./ToolMarkColor.svelte";
|
|
6
|
+
import ToolMarkLink from "./ToolMarkLink.svelte";
|
|
7
|
+
import ToolMenuAlign from "./ToolMenuAlign.svelte";
|
|
8
|
+
import ToolMenuInsert from "./ToolMenuInsert.svelte";
|
|
9
|
+
export let editor;
|
|
10
|
+
let klass = "";
|
|
11
|
+
export { klass as class };
|
|
16
12
|
</script>
|
|
17
13
|
|
|
18
14
|
<div
|