@shwfed/config 3.0.13 → 3.0.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/dist/module.json +1 -1
- package/dist/module.mjs +20 -1
- package/dist/runtime/components/actions/ai-l1.md +1 -1
- package/dist/runtime/components/actions/buttons/2026-05-15/com.shwfed.actions.button.event.dispatch/prompt.md +1 -1
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.d.ts +1 -1
- package/dist/runtime/components/actions/buttons/2026-05-21/com.shwfed.actions.button.http.download/schema.js +2 -2
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/prompt.md +1 -1
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/runtime.vue +1 -1
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/schema.d.ts +2 -4
- package/dist/runtime/components/actions/buttons/2026-07-13/com.shwfed.actions.button.state.write/schema.js +1 -1
- package/dist/runtime/components/actions/components/trigger-row-scope.vue +6 -3
- package/dist/runtime/components/actions/utils/steps.d.ts +1 -1
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.digital/config.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.digital/config.vue +10 -2
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.digital/config.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.digital/runtime.d.vue.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.digital/runtime.vue.d.ts +2 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.digital/schema.d.ts +1 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.digital/schema.js +5 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/config.d.vue.ts +96 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/config.vue +385 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/config.vue.d.ts +96 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/items-colgroup.d.vue.ts +3 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/items-colgroup.vue +20 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/items-colgroup.vue.d.ts +3 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/runtime.d.vue.ts +96 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/runtime.vue +177 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/runtime.vue.d.ts +96 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/schema.d.ts +102 -0
- package/dist/runtime/components/config/blocks/2026-07-17/com.shwfed.block.invoice.realestate.lease/schema.js +186 -0
- package/dist/runtime/components/config/schema.js +2 -2
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-24/com.shwfed.form.field.combobox.single/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.d.vue.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.daterange/config.vue.d.ts +6 -6
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.d.vue.ts +8 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.datetimerange/config.vue.d.ts +8 -8
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.d.vue.ts +2 -2
- package/dist/runtime/components/form/fields/2026-04-27/com.shwfed.form.field.timerange/config.vue.d.ts +2 -2
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-13/com.shwfed.form.field.combobox.single.remote/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.d.vue.ts +6 -6
- package/dist/runtime/components/form/fields/2026-05-24/com.shwfed.form.field.monthrange/config.vue.d.ts +6 -6
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.d.vue.ts +16 -16
- package/dist/runtime/components/form/fields/2026-05-25/com.shwfed.form.field.combobox.multi/config.vue.d.ts +16 -16
- package/dist/runtime/components/form/fields/2026-06-09/com.shwfed.form.field.upload/prompt.md +1 -1
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/RichTextEditor.d.vue.ts +33 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/RichTextEditor.vue +269 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/RichTextEditor.vue.d.ts +33 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/config.d.vue.ts +107 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/config.vue +370 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/config.vue.d.ts +107 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/extensions.d.ts +27 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/extensions.js +83 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/features.d.ts +21 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/features.js +16 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/indent.d.ts +26 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/indent.js +64 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/prompt.md +33 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/runtime.d.vue.ts +8 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/runtime.vue +121 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/runtime.vue.d.ts +8 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/schema.d.ts +133 -0
- package/dist/runtime/components/form/fields/2026-07-18/com.shwfed.form.field.richtext/schema.js +65 -0
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/runtime.js +16 -4
- package/dist/runtime/components/operations/2026-06-11/com.shwfed.operation.http.request.json/schema.js +10 -3
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.http.download/schema.js +2 -2
- package/dist/runtime/components/operations/2026-06-15/com.shwfed.operation.navigation/schema.js +1 -1
- package/dist/runtime/components/operations/utils/resolve.d.ts +1 -1
- package/dist/runtime/components/operations/utils/step-vars.d.ts +16 -4
- package/dist/runtime/components/operations/utils/step-vars.js +14 -1
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-27/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-05-28/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-multi/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.d.vue.ts +2 -2
- package/dist/runtime/components/table/columns/2026-06-14/com.shwfed.table.column.tree-combobox-single/config.vue.d.ts +2 -2
- package/dist/runtime/components/table/columns/2026-07-16/com.shwfed.table.column.upload/prompt.md +1 -1
- package/dist/runtime/components/table/columns/2026-07-16/com.shwfed.table.column.upload/runtime.vue +8 -2
- package/dist/runtime/components/ui/calendar/Calendar.d.vue.ts +8 -4
- package/dist/runtime/components/ui/calendar/Calendar.vue +39 -10
- package/dist/runtime/components/ui/calendar/Calendar.vue.d.ts +8 -4
- package/dist/runtime/components/ui/date-picker/DatePicker.vue +3 -1
- package/dist/runtime/components/ui/date-picker/DatePickerDatePanel.vue +6 -0
- package/dist/runtime/components/ui/date-picker/DatePickerDateTimePanel.vue +6 -0
- package/dist/runtime/components/ui/date-picker/DatePickerInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerInput.vue +7 -9
- package/dist/runtime/components/ui/date-picker/DatePickerInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.d.vue.ts +1 -1
- package/dist/runtime/components/ui/date-picker/DatePickerTimeInput.vue.d.ts +1 -1
- package/dist/runtime/components/ui/date-range-picker/DateRangePicker.vue +10 -7
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.d.vue.ts +3 -5
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.vue +28 -26
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerInput.vue.d.ts +3 -5
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.d.vue.ts +2 -2
- package/dist/runtime/components/ui/date-range-picker/DateRangePickerTimeInput.vue.d.ts +2 -2
- package/dist/runtime/components/ui/expression-editor/picker-entries.js +1 -1
- package/dist/runtime/components/ui/expression-editor/step-chip-extension.js +1 -1
- package/dist/runtime/components/ui/expression-editor/step-refs.js +1 -1
- package/dist/runtime/components/ui/range-calendar/RangeCalendar.d.vue.ts +5 -5
- package/dist/runtime/components/ui/range-calendar/RangeCalendar.vue +22 -5
- package/dist/runtime/components/ui/range-calendar/RangeCalendar.vue.d.ts +5 -5
- package/dist/runtime/components/ui/range-calendar/RangeCalendarNextButton.vue +0 -1
- package/dist/runtime/components/ui/range-calendar/RangeCalendarPrevButton.vue +0 -1
- package/dist/runtime/share/event-bus.d.ts +16 -0
- package/dist/runtime/share/event-bus.js +18 -13
- package/dist/runtime/share/idempotency-key.d.ts +18 -0
- package/dist/runtime/share/idempotency-key.js +9 -0
- package/dist/runtime/share/slot-renderer.vue +83 -24
- package/dist/runtime/utils/cel-context.d.ts +3 -2
- package/dist/runtime/utils/cel-context.js +1 -0
- package/dist/runtime/vendor/cel-js/CLAUDE.md +3 -1
- package/dist/runtime/vendor/cel-js/PROMPT.md +31 -2
- package/dist/runtime/vendor/cel-js/lib/functions.js +28 -1
- package/dist/runtime/vendor/cel-js/lib/registry.js +2 -1
- package/package.json +8 -1
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
<script setup>
|
|
2
|
+
import { Icon } from "@iconify/vue";
|
|
3
|
+
import { EditorContent, useEditor } from "@tiptap/vue-3";
|
|
4
|
+
import { computed, ref, watch } from "vue";
|
|
5
|
+
import { useI18n } from "vue-i18n";
|
|
6
|
+
import { cn } from "../../../../../utils/cn";
|
|
7
|
+
import { Toggle } from "../../../../ui/toggle";
|
|
8
|
+
import { richTextExtensions } from "./extensions";
|
|
9
|
+
import { resolveFeatures } from "./features";
|
|
10
|
+
defineOptions({ name: "ShwfedRichTextEditor" });
|
|
11
|
+
const props = defineProps({
|
|
12
|
+
modelValue: { type: String, required: false, default: "" },
|
|
13
|
+
placeholder: { type: String, required: false },
|
|
14
|
+
editable: { type: Boolean, required: false, default: true },
|
|
15
|
+
features: { type: Object, required: false },
|
|
16
|
+
id: { type: String, required: false },
|
|
17
|
+
class: { type: [Boolean, null, String, Object, Array], required: false, skipCheck: true }
|
|
18
|
+
});
|
|
19
|
+
const emits = defineEmits(["update:modelValue", "blur"]);
|
|
20
|
+
const { t } = useI18n({
|
|
21
|
+
inheritLocale: true,
|
|
22
|
+
messages: {
|
|
23
|
+
zh: {
|
|
24
|
+
"richtext-bold": "\u52A0\u7C97",
|
|
25
|
+
"richtext-italic": "\u659C\u4F53",
|
|
26
|
+
"richtext-underline": "\u4E0B\u5212\u7EBF",
|
|
27
|
+
"richtext-strike": "\u5220\u9664\u7EBF",
|
|
28
|
+
"richtext-align-left": "\u5DE6\u5BF9\u9F50",
|
|
29
|
+
"richtext-align-center": "\u5C45\u4E2D\u5BF9\u9F50",
|
|
30
|
+
"richtext-align-right": "\u53F3\u5BF9\u9F50",
|
|
31
|
+
"richtext-indent": "\u589E\u52A0\u7F29\u8FDB",
|
|
32
|
+
"richtext-outdent": "\u51CF\u5C11\u7F29\u8FDB",
|
|
33
|
+
"richtext-bullet-list": "\u65E0\u5E8F\u5217\u8868",
|
|
34
|
+
"richtext-ordered-list": "\u6709\u5E8F\u5217\u8868"
|
|
35
|
+
},
|
|
36
|
+
en: {
|
|
37
|
+
"richtext-bold": "Bold",
|
|
38
|
+
"richtext-italic": "Italic",
|
|
39
|
+
"richtext-underline": "Underline",
|
|
40
|
+
"richtext-strike": "Strikethrough",
|
|
41
|
+
"richtext-align-left": "Align left",
|
|
42
|
+
"richtext-align-center": "Align center",
|
|
43
|
+
"richtext-align-right": "Align right",
|
|
44
|
+
"richtext-indent": "Increase indent",
|
|
45
|
+
"richtext-outdent": "Decrease indent",
|
|
46
|
+
"richtext-bullet-list": "Bulleted list",
|
|
47
|
+
"richtext-ordered-list": "Numbered list"
|
|
48
|
+
},
|
|
49
|
+
ja: {
|
|
50
|
+
"richtext-bold": "\u592A\u5B57",
|
|
51
|
+
"richtext-italic": "\u659C\u4F53",
|
|
52
|
+
"richtext-underline": "\u4E0B\u7DDA",
|
|
53
|
+
"richtext-strike": "\u53D6\u308A\u6D88\u3057\u7DDA",
|
|
54
|
+
"richtext-align-left": "\u5DE6\u63C3\u3048",
|
|
55
|
+
"richtext-align-center": "\u4E2D\u592E\u63C3\u3048",
|
|
56
|
+
"richtext-align-right": "\u53F3\u63C3\u3048",
|
|
57
|
+
"richtext-indent": "\u30A4\u30F3\u30C7\u30F3\u30C8\u3092\u5897\u3084\u3059",
|
|
58
|
+
"richtext-outdent": "\u30A4\u30F3\u30C7\u30F3\u30C8\u3092\u6E1B\u3089\u3059",
|
|
59
|
+
"richtext-bullet-list": "\u7B87\u6761\u66F8\u304D",
|
|
60
|
+
"richtext-ordered-list": "\u756A\u53F7\u4ED8\u304D\u30EA\u30B9\u30C8"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
const features = computed(() => props.features ?? resolveFeatures());
|
|
65
|
+
const tick = ref(0);
|
|
66
|
+
function currentHtml() {
|
|
67
|
+
const editorInstance = editor.value;
|
|
68
|
+
if (!editorInstance) return "";
|
|
69
|
+
return editorInstance.isEmpty ? "" : editorInstance.getHTML();
|
|
70
|
+
}
|
|
71
|
+
const editor = useEditor({
|
|
72
|
+
content: props.modelValue,
|
|
73
|
+
editable: props.editable,
|
|
74
|
+
extensions: richTextExtensions({
|
|
75
|
+
features: features.value,
|
|
76
|
+
getPlaceholder: () => props.placeholder ?? ""
|
|
77
|
+
}),
|
|
78
|
+
// The field stores HTML, not Markdown. Input rules are what turn `**x**`,
|
|
79
|
+
// `- `, `# ` and friends into nodes as you type, and paste rules do the same
|
|
80
|
+
// for pasted text — both are off wholesale. Note this is not the whole story:
|
|
81
|
+
// `OrderedList` also ships a `handlePaste` PLUGIN that neither switch
|
|
82
|
+
// reaches, which `extensions.ts` strips separately.
|
|
83
|
+
enableInputRules: false,
|
|
84
|
+
enablePasteRules: false,
|
|
85
|
+
editorProps: {
|
|
86
|
+
attributes: {
|
|
87
|
+
class: "prose prose-sm prose-zinc max-w-none focus:outline-none",
|
|
88
|
+
...props.id ? { id: props.id } : {}
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
onUpdate: () => emits("update:modelValue", currentHtml()),
|
|
92
|
+
onBlur: () => emits("blur"),
|
|
93
|
+
onTransaction: () => {
|
|
94
|
+
tick.value++;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
watch(() => props.modelValue, (next) => {
|
|
98
|
+
if (!editor.value) return;
|
|
99
|
+
const incoming = next ?? "";
|
|
100
|
+
if (incoming === currentHtml()) return;
|
|
101
|
+
editor.value.commands.setContent(incoming, { emitUpdate: false });
|
|
102
|
+
});
|
|
103
|
+
watch(() => props.editable, (editable) => {
|
|
104
|
+
editor.value?.setEditable(editable);
|
|
105
|
+
});
|
|
106
|
+
function run(fn) {
|
|
107
|
+
if (!editor.value) return;
|
|
108
|
+
fn(editor.value.chain().focus()).run();
|
|
109
|
+
}
|
|
110
|
+
function isActive(name) {
|
|
111
|
+
void tick.value;
|
|
112
|
+
return editor.value?.isActive(name) ?? false;
|
|
113
|
+
}
|
|
114
|
+
const ALL_DECORATIONS = [
|
|
115
|
+
{ kind: "bold", icon: "fluent:text-bold-20-regular", label: "richtext-bold", toggle: (c) => c.toggleBold() },
|
|
116
|
+
{ kind: "italic", icon: "fluent:text-italic-20-regular", label: "richtext-italic", toggle: (c) => c.toggleItalic() },
|
|
117
|
+
{ kind: "underline", icon: "fluent:text-underline-20-regular", label: "richtext-underline", toggle: (c) => c.toggleUnderline() },
|
|
118
|
+
{ kind: "strike", icon: "fluent:text-strikethrough-20-regular", label: "richtext-strike", toggle: (c) => c.toggleStrike() }
|
|
119
|
+
];
|
|
120
|
+
const decorationButtons = computed(() => ALL_DECORATIONS.filter((d) => features.value.inline.has(d.kind)));
|
|
121
|
+
const ALIGNMENTS = [
|
|
122
|
+
{ value: "left", icon: "fluent:text-align-left-20-regular", label: "richtext-align-left" },
|
|
123
|
+
{ value: "center", icon: "fluent:text-align-center-20-regular", label: "richtext-align-center" },
|
|
124
|
+
{ value: "right", icon: "fluent:text-align-right-20-regular", label: "richtext-align-right" }
|
|
125
|
+
];
|
|
126
|
+
function setAlign(value) {
|
|
127
|
+
run((chain) => chain.setTextAlign(value));
|
|
128
|
+
}
|
|
129
|
+
function alignActive(value) {
|
|
130
|
+
void tick.value;
|
|
131
|
+
const instance = editor.value;
|
|
132
|
+
if (!instance) return false;
|
|
133
|
+
return (instance.getAttributes("paragraph").textAlign ?? "left") === value;
|
|
134
|
+
}
|
|
135
|
+
function indent() {
|
|
136
|
+
run((chain) => chain.first(({ commands }) => [
|
|
137
|
+
() => commands.sinkListItem("listItem"),
|
|
138
|
+
() => commands.indent()
|
|
139
|
+
]));
|
|
140
|
+
}
|
|
141
|
+
function outdent() {
|
|
142
|
+
run((chain) => chain.first(({ commands }) => [
|
|
143
|
+
() => commands.liftListItem("listItem"),
|
|
144
|
+
() => commands.outdent()
|
|
145
|
+
]));
|
|
146
|
+
}
|
|
147
|
+
function canIndent() {
|
|
148
|
+
void tick.value;
|
|
149
|
+
const instance = editor.value;
|
|
150
|
+
if (!instance) return false;
|
|
151
|
+
return instance.can().sinkListItem("listItem") || instance.can().indent();
|
|
152
|
+
}
|
|
153
|
+
function canOutdent() {
|
|
154
|
+
void tick.value;
|
|
155
|
+
const instance = editor.value;
|
|
156
|
+
if (!instance) return false;
|
|
157
|
+
return instance.can().liftListItem("listItem") || instance.can().outdent();
|
|
158
|
+
}
|
|
159
|
+
</script>
|
|
160
|
+
|
|
161
|
+
<template>
|
|
162
|
+
<div :class="cn('flex flex-col overflow-hidden rounded-md border border-zinc-200 bg-white', props.class)">
|
|
163
|
+
<!-- `mousedown.prevent` throughout: without it every toolbar click blurs
|
|
164
|
+
the editor, which fires the field's commit before the command runs. -->
|
|
165
|
+
<div
|
|
166
|
+
class="flex flex-wrap items-center gap-0.5 border-b border-zinc-200 bg-zinc-50/60 px-1.5 py-1"
|
|
167
|
+
@mousedown.prevent
|
|
168
|
+
>
|
|
169
|
+
<Toggle
|
|
170
|
+
v-for="decoration in decorationButtons"
|
|
171
|
+
:key="decoration.kind"
|
|
172
|
+
size="xs"
|
|
173
|
+
:aria-label="t(decoration.label)"
|
|
174
|
+
:title="t(decoration.label)"
|
|
175
|
+
:model-value="isActive(decoration.kind)"
|
|
176
|
+
:disabled="!props.editable"
|
|
177
|
+
@update:model-value="run(decoration.toggle)"
|
|
178
|
+
>
|
|
179
|
+
<Icon :icon="decoration.icon" />
|
|
180
|
+
</Toggle>
|
|
181
|
+
|
|
182
|
+
<div
|
|
183
|
+
v-if="decorationButtons.length"
|
|
184
|
+
class="mx-1 h-5 w-px bg-zinc-200"
|
|
185
|
+
/>
|
|
186
|
+
|
|
187
|
+
<Toggle
|
|
188
|
+
v-for="alignment in ALIGNMENTS"
|
|
189
|
+
:key="alignment.value"
|
|
190
|
+
size="xs"
|
|
191
|
+
:aria-label="t(alignment.label)"
|
|
192
|
+
:title="t(alignment.label)"
|
|
193
|
+
:model-value="alignActive(alignment.value)"
|
|
194
|
+
:disabled="!props.editable"
|
|
195
|
+
@update:model-value="setAlign(alignment.value)"
|
|
196
|
+
>
|
|
197
|
+
<Icon :icon="alignment.icon" />
|
|
198
|
+
</Toggle>
|
|
199
|
+
|
|
200
|
+
<div class="mx-1 h-5 w-px bg-zinc-200" />
|
|
201
|
+
|
|
202
|
+
<!-- `Toggle` with a pinned `false`, not `Button`: indent and outdent are
|
|
203
|
+
momentary actions with no on-state, but they sit in a row of toggles
|
|
204
|
+
and have to carry the same size, padding and hover treatment. Pinning
|
|
205
|
+
the model value keeps them from ever rendering as pressed. -->
|
|
206
|
+
<Toggle
|
|
207
|
+
size="xs"
|
|
208
|
+
:aria-label="t('richtext-outdent')"
|
|
209
|
+
:title="t('richtext-outdent')"
|
|
210
|
+
:model-value="false"
|
|
211
|
+
:disabled="!props.editable || !canOutdent()"
|
|
212
|
+
@update:model-value="outdent"
|
|
213
|
+
>
|
|
214
|
+
<Icon icon="fluent:text-indent-decrease-ltr-20-regular" />
|
|
215
|
+
</Toggle>
|
|
216
|
+
<Toggle
|
|
217
|
+
size="xs"
|
|
218
|
+
:aria-label="t('richtext-indent')"
|
|
219
|
+
:title="t('richtext-indent')"
|
|
220
|
+
:model-value="false"
|
|
221
|
+
:disabled="!props.editable || !canIndent()"
|
|
222
|
+
@update:model-value="indent"
|
|
223
|
+
>
|
|
224
|
+
<Icon icon="fluent:text-indent-increase-ltr-20-regular" />
|
|
225
|
+
</Toggle>
|
|
226
|
+
|
|
227
|
+
<div
|
|
228
|
+
v-if="features.block.has('bulletList') || features.block.has('orderedList')"
|
|
229
|
+
class="mx-1 h-5 w-px bg-zinc-200"
|
|
230
|
+
/>
|
|
231
|
+
|
|
232
|
+
<Toggle
|
|
233
|
+
v-if="features.block.has('bulletList')"
|
|
234
|
+
size="xs"
|
|
235
|
+
:aria-label="t('richtext-bullet-list')"
|
|
236
|
+
:title="t('richtext-bullet-list')"
|
|
237
|
+
:model-value="isActive('bulletList')"
|
|
238
|
+
:disabled="!props.editable"
|
|
239
|
+
@update:model-value="run((chain) => chain.toggleBulletList())"
|
|
240
|
+
>
|
|
241
|
+
<Icon icon="fluent:text-bullet-list-ltr-20-regular" />
|
|
242
|
+
</Toggle>
|
|
243
|
+
<Toggle
|
|
244
|
+
v-if="features.block.has('orderedList')"
|
|
245
|
+
size="xs"
|
|
246
|
+
:aria-label="t('richtext-ordered-list')"
|
|
247
|
+
:title="t('richtext-ordered-list')"
|
|
248
|
+
:model-value="isActive('orderedList')"
|
|
249
|
+
:disabled="!props.editable"
|
|
250
|
+
@update:model-value="run((chain) => chain.toggleOrderedList())"
|
|
251
|
+
>
|
|
252
|
+
<Icon icon="fluent:text-number-list-ltr-20-regular" />
|
|
253
|
+
</Toggle>
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
<!-- `v-if` is the SSR guard: `useEditor` builds the instance in
|
|
257
|
+
`onMounted`, so `editor` is undefined during the server render.
|
|
258
|
+
(`immediatelyRender` is a @tiptap/react option — it does nothing here.) -->
|
|
259
|
+
<EditorContent
|
|
260
|
+
v-if="editor"
|
|
261
|
+
:editor="editor"
|
|
262
|
+
class="rt-content min-h-32 flex-1 overflow-y-auto px-3 py-2"
|
|
263
|
+
/>
|
|
264
|
+
</div>
|
|
265
|
+
</template>
|
|
266
|
+
|
|
267
|
+
<style scoped>
|
|
268
|
+
.rt-content :deep(.ProseMirror){outline:none}.rt-content :deep(.ProseMirror ul){list-style-position:outside;list-style-type:disc}.rt-content :deep(.ProseMirror ol){list-style-position:outside;list-style-type:decimal}.rt-content :deep(.ProseMirror ul ul){list-style-type:circle}.rt-content :deep(.ProseMirror ul ul ul){list-style-type:square}.rt-content :deep(.ProseMirror ol ol){list-style-type:lower-alpha}.rt-content :deep(.ProseMirror ol ol ol){list-style-type:lower-roman}.rt-content :deep(.ProseMirror li::marker){color:var(--color-zinc-500)}.rt-content :deep(.ProseMirror li>p){margin-bottom:0;margin-top:0}.rt-content :deep(.is-editor-empty:first-child:before){color:var(--color-zinc-300);content:attr(data-placeholder);float:left;height:0;pointer-events:none}
|
|
269
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { HTMLAttributes } from 'vue';
|
|
2
|
+
import { type RichTextFeatures } from './features.js';
|
|
3
|
+
type __VLS_Props = {
|
|
4
|
+
modelValue?: string;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
editable?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Which capabilities the config left switched on. Note that this is read once
|
|
9
|
+
* when the editor is constructed — the extension set cannot be swapped on a
|
|
10
|
+
* live instance. Callers that let a user flip these at runtime (the config
|
|
11
|
+
* editor's live preview) must re-key this component; `runtime.vue` does.
|
|
12
|
+
*/
|
|
13
|
+
features?: RichTextFeatures;
|
|
14
|
+
/**
|
|
15
|
+
* Declared rather than left to fall through: it has to land on the
|
|
16
|
+
* contenteditable so the field's `<FieldLabel for>` focuses the editor.
|
|
17
|
+
* As an undeclared attr it would settle on the wrapper div instead.
|
|
18
|
+
*/
|
|
19
|
+
id?: string;
|
|
20
|
+
class?: HTMLAttributes['class'];
|
|
21
|
+
};
|
|
22
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
|
+
blur: () => any;
|
|
24
|
+
"update:modelValue": (payload: string) => any;
|
|
25
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
26
|
+
onBlur?: (() => any) | undefined;
|
|
27
|
+
"onUpdate:modelValue"?: ((payload: string) => any) | undefined;
|
|
28
|
+
}>, {
|
|
29
|
+
modelValue: string;
|
|
30
|
+
editable: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const _default: typeof __VLS_export;
|
|
33
|
+
export default _default;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { type Value } from './schema.js';
|
|
2
|
+
type __VLS_ModelProps = {
|
|
3
|
+
modelValue: Value;
|
|
4
|
+
};
|
|
5
|
+
declare const __VLS_export: import("vue").DefineComponent<__VLS_ModelProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
6
|
+
"update:modelValue": (value: {
|
|
7
|
+
readonly label?: readonly [{
|
|
8
|
+
readonly locale: "zh";
|
|
9
|
+
readonly message: string;
|
|
10
|
+
}, ...{
|
|
11
|
+
readonly locale: "en" | "ja" | "ko";
|
|
12
|
+
readonly message: string;
|
|
13
|
+
}[]] | undefined;
|
|
14
|
+
readonly disabled?: string | undefined;
|
|
15
|
+
readonly type: "com.shwfed.form.field.richtext";
|
|
16
|
+
readonly id: string;
|
|
17
|
+
readonly inline: readonly ("bold" | "strike" | "italic" | "underline")[];
|
|
18
|
+
readonly hidden?: string | undefined;
|
|
19
|
+
readonly block: readonly ("bulletList" | "orderedList")[];
|
|
20
|
+
readonly tooltip?: readonly [{
|
|
21
|
+
readonly locale: "zh";
|
|
22
|
+
readonly message: string;
|
|
23
|
+
}, ...{
|
|
24
|
+
readonly locale: "en" | "ja" | "ko";
|
|
25
|
+
readonly message: string;
|
|
26
|
+
}[]] | undefined;
|
|
27
|
+
readonly required?: string | undefined;
|
|
28
|
+
readonly displayName?: string | undefined;
|
|
29
|
+
readonly compatibilityDate: "2026-07-18";
|
|
30
|
+
readonly placeholder?: readonly [{
|
|
31
|
+
readonly locale: "zh";
|
|
32
|
+
readonly message: string;
|
|
33
|
+
}, ...{
|
|
34
|
+
readonly locale: "en" | "ja" | "ko";
|
|
35
|
+
readonly message: string;
|
|
36
|
+
}[]] | undefined;
|
|
37
|
+
readonly readonly?: string | undefined;
|
|
38
|
+
readonly binding?: string | undefined;
|
|
39
|
+
readonly derived?: {
|
|
40
|
+
readonly mode: "formula" | "prefill";
|
|
41
|
+
readonly expression: string;
|
|
42
|
+
} | undefined;
|
|
43
|
+
readonly validations?: readonly {
|
|
44
|
+
readonly message: readonly [{
|
|
45
|
+
readonly locale: "zh";
|
|
46
|
+
readonly message: string;
|
|
47
|
+
}, ...{
|
|
48
|
+
readonly locale: "en" | "ja" | "ko";
|
|
49
|
+
readonly message: string;
|
|
50
|
+
}[]];
|
|
51
|
+
readonly warning?: boolean | undefined;
|
|
52
|
+
readonly when: string;
|
|
53
|
+
}[] | undefined;
|
|
54
|
+
}) => any;
|
|
55
|
+
}, string, import("vue").PublicProps, Readonly<__VLS_ModelProps> & Readonly<{
|
|
56
|
+
"onUpdate:modelValue"?: ((value: {
|
|
57
|
+
readonly label?: readonly [{
|
|
58
|
+
readonly locale: "zh";
|
|
59
|
+
readonly message: string;
|
|
60
|
+
}, ...{
|
|
61
|
+
readonly locale: "en" | "ja" | "ko";
|
|
62
|
+
readonly message: string;
|
|
63
|
+
}[]] | undefined;
|
|
64
|
+
readonly disabled?: string | undefined;
|
|
65
|
+
readonly type: "com.shwfed.form.field.richtext";
|
|
66
|
+
readonly id: string;
|
|
67
|
+
readonly inline: readonly ("bold" | "strike" | "italic" | "underline")[];
|
|
68
|
+
readonly hidden?: string | undefined;
|
|
69
|
+
readonly block: readonly ("bulletList" | "orderedList")[];
|
|
70
|
+
readonly tooltip?: readonly [{
|
|
71
|
+
readonly locale: "zh";
|
|
72
|
+
readonly message: string;
|
|
73
|
+
}, ...{
|
|
74
|
+
readonly locale: "en" | "ja" | "ko";
|
|
75
|
+
readonly message: string;
|
|
76
|
+
}[]] | undefined;
|
|
77
|
+
readonly required?: string | undefined;
|
|
78
|
+
readonly displayName?: string | undefined;
|
|
79
|
+
readonly compatibilityDate: "2026-07-18";
|
|
80
|
+
readonly placeholder?: readonly [{
|
|
81
|
+
readonly locale: "zh";
|
|
82
|
+
readonly message: string;
|
|
83
|
+
}, ...{
|
|
84
|
+
readonly locale: "en" | "ja" | "ko";
|
|
85
|
+
readonly message: string;
|
|
86
|
+
}[]] | undefined;
|
|
87
|
+
readonly readonly?: string | undefined;
|
|
88
|
+
readonly binding?: string | undefined;
|
|
89
|
+
readonly derived?: {
|
|
90
|
+
readonly mode: "formula" | "prefill";
|
|
91
|
+
readonly expression: string;
|
|
92
|
+
} | undefined;
|
|
93
|
+
readonly validations?: readonly {
|
|
94
|
+
readonly message: readonly [{
|
|
95
|
+
readonly locale: "zh";
|
|
96
|
+
readonly message: string;
|
|
97
|
+
}, ...{
|
|
98
|
+
readonly locale: "en" | "ja" | "ko";
|
|
99
|
+
readonly message: string;
|
|
100
|
+
}[]];
|
|
101
|
+
readonly warning?: boolean | undefined;
|
|
102
|
+
readonly when: string;
|
|
103
|
+
}[] | undefined;
|
|
104
|
+
}) => any) | undefined;
|
|
105
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
106
|
+
declare const _default: typeof __VLS_export;
|
|
107
|
+
export default _default;
|