@ixo/editor 1.7.0 → 1.8.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.
@@ -6104,26 +6104,9 @@ var ActionsTab = ({ actions, onActionsChange, editor, block }) => {
6104
6104
 
6105
6105
  // src/mantine/blocks/proposal/template/VoteTab.tsx
6106
6106
  import React73 from "react";
6107
- import { Stack as Stack59, TextInput as TextInput32, Switch as Switch4 } from "@mantine/core";
6108
- var VoteTab = ({
6109
- voteEnabled,
6110
- voteTitle,
6111
- voteSubtitle,
6112
- voteIcon,
6113
- onVoteEnabledChange,
6114
- onVoteTitleChange,
6115
- onVoteSubtitleChange,
6116
- onVoteIconChange
6117
- }) => {
6118
- return /* @__PURE__ */ React73.createElement(Stack59, { gap: "md" }, /* @__PURE__ */ React73.createElement(
6119
- Switch4,
6120
- {
6121
- label: "Enable Voting",
6122
- description: "Allow users to vote on this proposal",
6123
- checked: voteEnabled,
6124
- onChange: (event) => onVoteEnabledChange(event.currentTarget.checked)
6125
- }
6126
- ), voteEnabled && /* @__PURE__ */ React73.createElement(React73.Fragment, null, /* @__PURE__ */ React73.createElement(TextInput32, { label: "Vote Button Title", placeholder: "Vote on this proposal", value: voteTitle, onChange: (event) => onVoteTitleChange(event.currentTarget.value) }), /* @__PURE__ */ React73.createElement(TextInput32, { label: "Vote Button Subtitle", placeholder: "Cast your vote", value: voteSubtitle, onChange: (event) => onVoteSubtitleChange(event.currentTarget.value) }), /* @__PURE__ */ React73.createElement(TextInput32, { label: "Vote Icon", placeholder: "checklist", value: voteIcon, onChange: (event) => onVoteIconChange(event.currentTarget.value) })));
6107
+ import { Stack as Stack59, TextInput as TextInput32 } from "@mantine/core";
6108
+ var VoteTab = ({ voteTitle, voteSubtitle, voteIcon, onVoteTitleChange, onVoteSubtitleChange, onVoteIconChange }) => {
6109
+ return /* @__PURE__ */ React73.createElement(Stack59, { gap: "md" }, /* @__PURE__ */ React73.createElement(TextInput32, { label: "Vote Button Title", placeholder: "Vote on this proposal", value: voteTitle, onChange: (event) => onVoteTitleChange(event.currentTarget.value) }), /* @__PURE__ */ React73.createElement(TextInput32, { label: "Vote Button Subtitle", placeholder: "Cast your vote", value: voteSubtitle, onChange: (event) => onVoteSubtitleChange(event.currentTarget.value) }), /* @__PURE__ */ React73.createElement(TextInput32, { label: "Vote Icon", placeholder: "checklist", value: voteIcon, onChange: (event) => onVoteIconChange(event.currentTarget.value) }));
6127
6110
  };
6128
6111
 
6129
6112
  // src/mantine/blocks/proposal/template/TemplateConfig.tsx
@@ -6192,11 +6175,9 @@ var TemplateConfig2 = ({ editor, block }) => {
6192
6175
  content: /* @__PURE__ */ React74.createElement(
6193
6176
  VoteTab,
6194
6177
  {
6195
- voteEnabled: block.props.voteEnabled || false,
6196
6178
  voteTitle: block.props.voteTitle || "",
6197
6179
  voteSubtitle: block.props.voteSubtitle || "",
6198
6180
  voteIcon: block.props.voteIcon || "checklist",
6199
- onVoteEnabledChange: (value) => updateProp("voteEnabled", value),
6200
6181
  onVoteTitleChange: (value) => updateProp("voteTitle", value),
6201
6182
  onVoteSubtitleChange: (value) => updateProp("voteSubtitle", value),
6202
6183
  onVoteIconChange: (value) => updateProp("voteIcon", value)
@@ -6984,10 +6965,8 @@ var FlowConfig = ({ editor, block }) => {
6984
6965
  label: "Actions",
6985
6966
  value: "actions",
6986
6967
  content: /* @__PURE__ */ React79.createElement(ActionsTab2, { actions: block.props.actions || "[]", onActionsChange: handleActionsChange, editor, block, isProposalCreated })
6987
- }
6988
- ];
6989
- if (block.props.voteEnabled) {
6990
- extraTabs.push({
6968
+ },
6969
+ {
6991
6970
  label: "Vote",
6992
6971
  value: "vote",
6993
6972
  content: /* @__PURE__ */ React79.createElement(
@@ -7004,8 +6983,8 @@ var FlowConfig = ({ editor, block }) => {
7004
6983
  status: voteLogic.status
7005
6984
  }
7006
6985
  )
7007
- });
7008
- }
6986
+ }
6987
+ ];
7009
6988
  return /* @__PURE__ */ React79.createElement(
7010
6989
  Paper4,
7011
6990
  {
@@ -7104,7 +7083,7 @@ var ProposalBlockSpec = createReactBlockSpec4(
7104
7083
  },
7105
7084
  // Vote configuration (from proposalVote)
7106
7085
  voteEnabled: {
7107
- default: false
7086
+ default: true
7108
7087
  },
7109
7088
  voteTitle: {
7110
7089
  default: ""
@@ -7879,7 +7858,7 @@ var EnumChecklistPreviewStep = ({ listType, onAddToBlock, onPrev }) => {
7879
7858
 
7880
7859
  // src/mantine/blocks/enumChecklist/EnumChecklistConfigurationStep.tsx
7881
7860
  import React92 from "react";
7882
- import { Stack as Stack71, TextInput as TextInput35, Text as Text46, Button as Button24, Group as Group29, Switch as Switch5, Select as Select10 } from "@mantine/core";
7861
+ import { Stack as Stack71, TextInput as TextInput35, Text as Text46, Button as Button24, Group as Group29, Switch as Switch4, Select as Select10 } from "@mantine/core";
7883
7862
  var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onConfigChange, onPrev, onNext, isValid }) => {
7884
7863
  const typeConfig = ENUM_LIST_CONFIG[listType];
7885
7864
  const configFields = getEnumListTypesConfigFields(listType);
@@ -7899,7 +7878,7 @@ var EnumChecklistConfigurationStep = ({ enumChecklistType: listType, config, onC
7899
7878
  );
7900
7879
  case "switch":
7901
7880
  return /* @__PURE__ */ React92.createElement(
7902
- Switch5,
7881
+ Switch4,
7903
7882
  {
7904
7883
  label: field.label,
7905
7884
  description: field.description,
@@ -8623,22 +8602,9 @@ function useMatrixProvider({
8623
8602
  // src/mantine/hooks/useCollaborativeYDoc.ts
8624
8603
  import { useMemo as useMemo15 } from "react";
8625
8604
  import * as Y from "yjs";
8626
- function useCollaborativeYDoc(options) {
8605
+ function useCollaborativeYDoc(_options) {
8627
8606
  return useMemo15(() => {
8628
8607
  const doc = new Y.Doc();
8629
- const root = doc.getMap("root");
8630
- root.set("@context", "https://ixo.world/flow/0.3");
8631
- root.set("_type", "ixo.flow.crdt");
8632
- root.set("schema_version", "0.3");
8633
- root.set("doc_id", options.docId || `flow_${Date.now()}`);
8634
- root.set("createdAt", (/* @__PURE__ */ new Date()).toISOString());
8635
- root.set("createdBy", options.user?.id || "anonymous");
8636
- root.set("docType", "");
8637
- const titleText = doc.getText("title");
8638
- if (titleText.length === 0 && options.title) {
8639
- titleText.insert(0, options.title);
8640
- }
8641
- doc.getMap("auditTrail");
8642
8608
  return doc;
8643
8609
  }, []);
8644
8610
  }
@@ -8659,7 +8625,8 @@ function useCreateCollaborativeIxoEditor(options) {
8659
8625
  filePanel = true,
8660
8626
  tableHandles = true,
8661
8627
  user,
8662
- matrixClient
8628
+ matrixClient,
8629
+ permissions = { read: false, write: false }
8663
8630
  } = options || {};
8664
8631
  const memoizedUser = useMemo16(
8665
8632
  () => ({
@@ -8790,6 +8757,28 @@ function useCreateCollaborativeIxoEditor(options) {
8790
8757
  ixoEditor.isEditable = editable;
8791
8758
  }
8792
8759
  }, [ixoEditor, editable]);
8760
+ useEffect19(() => {
8761
+ if (connectionStatus !== "connected") {
8762
+ return;
8763
+ }
8764
+ const existingDocId = root.get("doc_id");
8765
+ if (existingDocId) {
8766
+ return;
8767
+ }
8768
+ if (!permissions.write) {
8769
+ return;
8770
+ }
8771
+ root.set("@context", "https://ixo.world/flow/0.3");
8772
+ root.set("_type", "ixo.flow.crdt");
8773
+ root.set("schema_version", "0.3");
8774
+ root.set("doc_id", options.docId || `flow_${Date.now()}`);
8775
+ root.set("createdAt", (/* @__PURE__ */ new Date()).toISOString());
8776
+ root.set("createdBy", memoizedUser.id || "anonymous");
8777
+ root.set("docType", "");
8778
+ if (titleText.length === 0 && options.title) {
8779
+ titleText.insert(0, options.title);
8780
+ }
8781
+ }, [connectionStatus, root, titleText, permissions.write, options.docId, options.title, memoizedUser.id]);
8793
8782
  return {
8794
8783
  editor: ixoEditor,
8795
8784
  connectionStatus,
@@ -9005,4 +8994,4 @@ export {
9005
8994
  ixoGraphQLClient,
9006
8995
  getEntity
9007
8996
  };
9008
- //# sourceMappingURL=chunk-URIMM24H.mjs.map
8997
+ //# sourceMappingURL=chunk-HCXEWG4Z.mjs.map