@sendbird/actionbook-core 0.9.9 → 0.10.0
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/ui/index.js +51 -12
- package/dist/ui/index.js.map +1 -1
- package/package.json +1 -1
package/dist/ui/index.js
CHANGED
|
@@ -2649,6 +2649,18 @@ function useEditorView(config) {
|
|
|
2649
2649
|
viewInstanceRef.current = null;
|
|
2650
2650
|
};
|
|
2651
2651
|
}, []);
|
|
2652
|
+
const prevEditableRef = useRef(config.editable);
|
|
2653
|
+
useEffect(() => {
|
|
2654
|
+
if (prevEditableRef.current !== config.editable) {
|
|
2655
|
+
prevEditableRef.current = config.editable;
|
|
2656
|
+
const view = viewInstanceRef.current;
|
|
2657
|
+
if (view) {
|
|
2658
|
+
const tr = view.state.tr;
|
|
2659
|
+
tr.setMeta("editableChanged", true);
|
|
2660
|
+
view.dispatch(tr);
|
|
2661
|
+
}
|
|
2662
|
+
}
|
|
2663
|
+
}, [config.editable]);
|
|
2652
2664
|
const viewRef = useCallback((container) => {
|
|
2653
2665
|
if (container === containerRef.current) return;
|
|
2654
2666
|
if (viewInstanceRef.current) {
|
|
@@ -5918,7 +5930,7 @@ function createJinjaDecorationPlugin() {
|
|
|
5918
5930
|
// src/ui/plugin/jinjaIfBlockPlugin.tsx
|
|
5919
5931
|
import { useEffect as useEffect2, useRef as useRef2, useState as useState3 } from "react";
|
|
5920
5932
|
import { createRoot as createRoot2 } from "react-dom/client";
|
|
5921
|
-
import { TextSelection as TextSelection4 } from "prosemirror-state";
|
|
5933
|
+
import { Plugin as Plugin5, TextSelection as TextSelection4 } from "prosemirror-state";
|
|
5922
5934
|
import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
5923
5935
|
var PLACEHOLDER_TEXT = "Describe what AI agent should do when this condition is met";
|
|
5924
5936
|
var CONDITION_PLACEHOLDER = "Write a condition in natural language";
|
|
@@ -6711,10 +6723,13 @@ var JinjaIfBranchView = class {
|
|
|
6711
6723
|
this.root = createRoot2(this.headerContainer);
|
|
6712
6724
|
this._onSiblingsChanged = () => this.render();
|
|
6713
6725
|
this.dom.addEventListener("jinja-siblings-changed", this._onSiblingsChanged);
|
|
6726
|
+
this._onEditableChanged = () => this.render();
|
|
6727
|
+
this.dom.addEventListener("jinja-editable-changed", this._onEditableChanged);
|
|
6714
6728
|
this.syncDOM();
|
|
6715
6729
|
this.render();
|
|
6716
6730
|
}
|
|
6717
6731
|
_onSiblingsChanged = null;
|
|
6732
|
+
_onEditableChanged = null;
|
|
6718
6733
|
syncDOM() {
|
|
6719
6734
|
const branchType = this.node.attrs.branchType;
|
|
6720
6735
|
this.dom.className = `jinja-branch jinja-branch-${branchType}`;
|
|
@@ -6800,13 +6815,37 @@ var JinjaIfBranchView = class {
|
|
|
6800
6815
|
if (this._onSiblingsChanged) {
|
|
6801
6816
|
this.dom.removeEventListener("jinja-siblings-changed", this._onSiblingsChanged);
|
|
6802
6817
|
}
|
|
6818
|
+
if (this._onEditableChanged) {
|
|
6819
|
+
this.dom.removeEventListener("jinja-editable-changed", this._onEditableChanged);
|
|
6820
|
+
}
|
|
6803
6821
|
StyleManager.release();
|
|
6804
6822
|
setTimeout(() => this.root.unmount(), 0);
|
|
6805
6823
|
}
|
|
6806
6824
|
};
|
|
6825
|
+
function createEditableWatcherPlugin() {
|
|
6826
|
+
let lastEditable = null;
|
|
6827
|
+
return new Plugin5({
|
|
6828
|
+
view(editorView) {
|
|
6829
|
+
lastEditable = editorView.editable;
|
|
6830
|
+
return {
|
|
6831
|
+
update(view) {
|
|
6832
|
+
const currentEditable = view.editable;
|
|
6833
|
+
if (lastEditable !== null && lastEditable !== currentEditable) {
|
|
6834
|
+
const event = new Event("jinja-editable-changed", { bubbles: true });
|
|
6835
|
+
view.dom.querySelectorAll("[data-jinja-branch]").forEach((el) => {
|
|
6836
|
+
el.dispatchEvent(event);
|
|
6837
|
+
});
|
|
6838
|
+
}
|
|
6839
|
+
lastEditable = currentEditable;
|
|
6840
|
+
}
|
|
6841
|
+
};
|
|
6842
|
+
}
|
|
6843
|
+
});
|
|
6844
|
+
}
|
|
6807
6845
|
function createJinjaIfBlockPlugin() {
|
|
6808
6846
|
return {
|
|
6809
6847
|
name: "jinjaIfBlock",
|
|
6848
|
+
plugins: () => [createEditableWatcherPlugin()],
|
|
6810
6849
|
nodeViews: () => ({
|
|
6811
6850
|
jinjaIfBlock: (() => new JinjaIfBlockView()),
|
|
6812
6851
|
jinjaIfBranch: ((node, view, getPos) => new JinjaIfBranchView(node, view, getPos))
|
|
@@ -6816,7 +6855,7 @@ function createJinjaIfBlockPlugin() {
|
|
|
6816
6855
|
|
|
6817
6856
|
// src/ui/plugin/linkPlugin.ts
|
|
6818
6857
|
import { InputRule as InputRule2, inputRules as inputRules2 } from "prosemirror-inputrules";
|
|
6819
|
-
import { Plugin as
|
|
6858
|
+
import { Plugin as Plugin6, PluginKey as PluginKey5, TextSelection as TextSelection5 } from "prosemirror-state";
|
|
6820
6859
|
var LINK_INPUT_RE = /\\?\[([^\]]*?)\\?\]\(([^)\s]*?)(?:\s+"([^"]*)")?\)$/;
|
|
6821
6860
|
var LINK_FULL_RE = /^\\?\[([^\]]*?)\\?\]\(([^)\s]*?)(?:\s+"([^"]*)")?\)$/;
|
|
6822
6861
|
var linkEditKey = new PluginKey5("linkEdit");
|
|
@@ -6867,7 +6906,7 @@ function explodeLinkToRaw(state) {
|
|
|
6867
6906
|
return tr;
|
|
6868
6907
|
}
|
|
6869
6908
|
function createLinkEditPlugin() {
|
|
6870
|
-
return new
|
|
6909
|
+
return new Plugin6({
|
|
6871
6910
|
key: linkEditKey,
|
|
6872
6911
|
state: {
|
|
6873
6912
|
init: () => ({ rawRange: null }),
|
|
@@ -6937,7 +6976,7 @@ function createLinkInputRule() {
|
|
|
6937
6976
|
);
|
|
6938
6977
|
}
|
|
6939
6978
|
function createLinkClickPlugin() {
|
|
6940
|
-
return new
|
|
6979
|
+
return new Plugin6({
|
|
6941
6980
|
key: new PluginKey5("linkClick"),
|
|
6942
6981
|
props: {
|
|
6943
6982
|
handleDOMEvents: {
|
|
@@ -6990,7 +7029,7 @@ function createLinkPlugin() {
|
|
|
6990
7029
|
}
|
|
6991
7030
|
|
|
6992
7031
|
// src/ui/plugin/dragHandlePlugin.ts
|
|
6993
|
-
import { Plugin as
|
|
7032
|
+
import { Plugin as Plugin7, PluginKey as PluginKey6 } from "prosemirror-state";
|
|
6994
7033
|
var PLUGIN_KEY = new PluginKey6("dragHandle");
|
|
6995
7034
|
var GRIP_SVG = `<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
|
|
6996
7035
|
<circle cx="4" cy="2.5" r="1.2"/><circle cx="8" cy="2.5" r="1.2"/>
|
|
@@ -7798,7 +7837,7 @@ function createDragHandlePlugin() {
|
|
|
7798
7837
|
plugins: () => {
|
|
7799
7838
|
let controller = null;
|
|
7800
7839
|
return [
|
|
7801
|
-
new
|
|
7840
|
+
new Plugin7({
|
|
7802
7841
|
key: PLUGIN_KEY,
|
|
7803
7842
|
view(editorView) {
|
|
7804
7843
|
controller = new DragHandleController(editorView);
|
|
@@ -7921,7 +7960,7 @@ function createTodoNodeViewPlugin() {
|
|
|
7921
7960
|
}
|
|
7922
7961
|
|
|
7923
7962
|
// src/ui/plugin/placeholderPlugin.ts
|
|
7924
|
-
import { Plugin as
|
|
7963
|
+
import { Plugin as Plugin8, PluginKey as PluginKey7 } from "prosemirror-state";
|
|
7925
7964
|
import { Decoration as Decoration4, DecorationSet as DecorationSet4 } from "prosemirror-view";
|
|
7926
7965
|
var PLACEHOLDER_TEXT2 = "Type to start writing, or press / to insert an action.";
|
|
7927
7966
|
var pluginKey2 = new PluginKey7("placeholder");
|
|
@@ -7950,7 +7989,7 @@ function createPlaceholderPlugin() {
|
|
|
7950
7989
|
return {
|
|
7951
7990
|
name: "placeholder",
|
|
7952
7991
|
plugins: () => [
|
|
7953
|
-
new
|
|
7992
|
+
new Plugin8({
|
|
7954
7993
|
key: pluginKey2,
|
|
7955
7994
|
state: {
|
|
7956
7995
|
init(_, state) {
|
|
@@ -7974,7 +8013,7 @@ function createPlaceholderPlugin() {
|
|
|
7974
8013
|
}
|
|
7975
8014
|
|
|
7976
8015
|
// src/ui/plugin/slashCommandPlugin.ts
|
|
7977
|
-
import { Plugin as
|
|
8016
|
+
import { Plugin as Plugin9, PluginKey as PluginKey8 } from "prosemirror-state";
|
|
7978
8017
|
var slashCommandKey = new PluginKey8("slashCommand");
|
|
7979
8018
|
var TRIGGER_RE = /(?:^|\s)(\/[^\s]*)$/;
|
|
7980
8019
|
function deriveState(state, dismissedFrom) {
|
|
@@ -8002,7 +8041,7 @@ function deriveState(state, dismissedFrom) {
|
|
|
8002
8041
|
};
|
|
8003
8042
|
}
|
|
8004
8043
|
function createSlashCommandPlugin() {
|
|
8005
|
-
const plugin = new
|
|
8044
|
+
const plugin = new Plugin9({
|
|
8006
8045
|
key: slashCommandKey,
|
|
8007
8046
|
state: {
|
|
8008
8047
|
init(_, state) {
|
|
@@ -9757,7 +9796,7 @@ function FloatingMenu({ view, editorState }) {
|
|
|
9757
9796
|
}
|
|
9758
9797
|
|
|
9759
9798
|
// src/ui/plugin/inlineSuggestPlugin.ts
|
|
9760
|
-
import { Plugin as
|
|
9799
|
+
import { Plugin as Plugin10, PluginKey as PluginKey9 } from "prosemirror-state";
|
|
9761
9800
|
import { Decoration as Decoration5, DecorationSet as DecorationSet5 } from "prosemirror-view";
|
|
9762
9801
|
var inlineSuggestKey = new PluginKey9("inlineSuggest");
|
|
9763
9802
|
var DEBOUNCE_MS = 600;
|
|
@@ -9766,7 +9805,7 @@ function createInlineSuggestPlugin(provider, endpoint, options) {
|
|
|
9766
9805
|
return {
|
|
9767
9806
|
name: "inlineSuggest",
|
|
9768
9807
|
plugins: () => [
|
|
9769
|
-
new
|
|
9808
|
+
new Plugin10({
|
|
9770
9809
|
key: inlineSuggestKey,
|
|
9771
9810
|
state: {
|
|
9772
9811
|
init: () => ({ suggestion: null, anchorPos: null }),
|