@oliasoft-open-source/react-ui-library 10.2.3 → 10.3.0-beta-1
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/index.d.ts +1 -0
- package/dist/index.js +40 -38
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1375,6 +1375,7 @@ export declare interface IRichTextInputProps {
|
|
|
1375
1375
|
onChange?: (markdown: string, meta: {
|
|
1376
1376
|
mentionedIds: string[];
|
|
1377
1377
|
}) => void;
|
|
1378
|
+
onMention?: (item: IMentionItem) => void;
|
|
1378
1379
|
placeholder?: string;
|
|
1379
1380
|
value?: string;
|
|
1380
1381
|
toolbarComponent?: ReactNode;
|
package/dist/index.js
CHANGED
|
@@ -6757,68 +6757,70 @@ var ko = (e) => e.replace(/^lch\(\s*(\d+(?:\.\d+)?)(?!%)\s+/, "lch($1% "), Ao =
|
|
|
6757
6757
|
command: t,
|
|
6758
6758
|
items: r,
|
|
6759
6759
|
editable: n.view.dom
|
|
6760
|
-
}), pf = c(o(({ placeholder: e, onChange: t,
|
|
6761
|
-
var
|
|
6762
|
-
let
|
|
6760
|
+
}), pf = c(o(({ placeholder: e, onChange: t, onMention: n, value: r, disabled: i, toolbarComponent: a, mentions: o, testId: s }, c) => {
|
|
6761
|
+
var l, f, m, g;
|
|
6762
|
+
let y = u(W), b = i || y, x = !!o, w = _(o), T = _(null), E = _(r == null ? "" : r), [D, O] = v(null);
|
|
6763
6763
|
d(() => {
|
|
6764
|
-
|
|
6765
|
-
}, [
|
|
6766
|
-
let
|
|
6764
|
+
w.current = o;
|
|
6765
|
+
}, [o]);
|
|
6766
|
+
let k = h(() => [
|
|
6767
6767
|
di,
|
|
6768
6768
|
fi.configure({ placeholder: e }),
|
|
6769
6769
|
pi,
|
|
6770
|
-
lf(() =>
|
|
6771
|
-
onStart: (e) =>
|
|
6772
|
-
onUpdate: (e) =>
|
|
6773
|
-
onExit: () =>
|
|
6770
|
+
lf(() => w.current, () => ({
|
|
6771
|
+
onStart: (e) => O(ff(e)),
|
|
6772
|
+
onUpdate: (e) => O(ff(e)),
|
|
6773
|
+
onExit: () => O(null),
|
|
6774
6774
|
onKeyDown: ({ event: e }) => {
|
|
6775
6775
|
var t, n;
|
|
6776
|
-
return (t = (n =
|
|
6776
|
+
return (t = (n = T.current) == null ? void 0 : n.onKeyDown(e)) != null && t;
|
|
6777
6777
|
}
|
|
6778
6778
|
}))
|
|
6779
|
-
], []),
|
|
6780
|
-
extensions:
|
|
6781
|
-
content:
|
|
6779
|
+
], []), A = ui({
|
|
6780
|
+
extensions: k,
|
|
6781
|
+
content: E.current,
|
|
6782
6782
|
contentType: "markdown",
|
|
6783
|
-
editable: !
|
|
6783
|
+
editable: !b,
|
|
6784
6784
|
editorProps: { attributes: { class: uf.editable } },
|
|
6785
6785
|
onUpdate: ({ editor: e }) => {
|
|
6786
6786
|
t == null || t(e.getMarkdown(), { mentionedIds: sf(e) });
|
|
6787
6787
|
}
|
|
6788
6788
|
});
|
|
6789
6789
|
return d(() => {
|
|
6790
|
-
|
|
6790
|
+
A && r !== void 0 && r !== A.getMarkdown() && A.commands.setContent(r, {
|
|
6791
6791
|
emitUpdate: !1,
|
|
6792
6792
|
contentType: "markdown"
|
|
6793
6793
|
});
|
|
6794
|
-
}, [
|
|
6795
|
-
|
|
6796
|
-
}, [
|
|
6797
|
-
clearContent: () =>
|
|
6798
|
-
editor:
|
|
6799
|
-
getMentionedIds: () => sf(
|
|
6800
|
-
}), [
|
|
6794
|
+
}, [r, A]), d(() => {
|
|
6795
|
+
A && A.setEditable(!b);
|
|
6796
|
+
}, [b, A]), p(c, () => ({
|
|
6797
|
+
clearContent: () => A == null ? void 0 : A.commands.clearContent(!1),
|
|
6798
|
+
editor: A,
|
|
6799
|
+
getMentionedIds: () => sf(A)
|
|
6800
|
+
}), [A]), /* @__PURE__ */ C("div", {
|
|
6801
6801
|
className: uf.richTextInput,
|
|
6802
|
-
"data-testid":
|
|
6802
|
+
"data-testid": s,
|
|
6803
6803
|
children: [
|
|
6804
6804
|
/* @__PURE__ */ S($d, {
|
|
6805
|
-
editor:
|
|
6806
|
-
disabled:
|
|
6807
|
-
showMentionButton:
|
|
6808
|
-
toolbarComponent:
|
|
6809
|
-
testId:
|
|
6805
|
+
editor: A,
|
|
6806
|
+
disabled: b,
|
|
6807
|
+
showMentionButton: x && ((l = o == null ? void 0 : o.showMentionButton) == null || l),
|
|
6808
|
+
toolbarComponent: a,
|
|
6809
|
+
testId: s && `${s}-toolbar`
|
|
6810
6810
|
}),
|
|
6811
6811
|
/* @__PURE__ */ S(li, {
|
|
6812
|
-
editor:
|
|
6813
|
-
"data-testid":
|
|
6812
|
+
editor: A,
|
|
6813
|
+
"data-testid": s && `${s}-editor`
|
|
6814
6814
|
}),
|
|
6815
|
-
|
|
6816
|
-
ref:
|
|
6817
|
-
editable: (
|
|
6818
|
-
getRect: (
|
|
6819
|
-
items: (
|
|
6820
|
-
onDismiss: () =>
|
|
6821
|
-
onSelect: (e) =>
|
|
6815
|
+
x && /* @__PURE__ */ S($i, { children: /* @__PURE__ */ S(df, {
|
|
6816
|
+
ref: T,
|
|
6817
|
+
editable: (f = D == null ? void 0 : D.editable) == null ? null : f,
|
|
6818
|
+
getRect: (m = D == null ? void 0 : D.clientRect) == null ? null : m,
|
|
6819
|
+
items: (g = D == null ? void 0 : D.items) == null ? [] : g,
|
|
6820
|
+
onDismiss: () => O(null),
|
|
6821
|
+
onSelect: (e) => {
|
|
6822
|
+
n == null || n(e), D == null || D.command(e);
|
|
6823
|
+
}
|
|
6822
6824
|
}) })
|
|
6823
6825
|
]
|
|
6824
6826
|
});
|
package/package.json
CHANGED