@edifice.io/react 2.6.10-develop-pedago.20261022145938 → 2.6.10-develop-pedago.20261023145636

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.
@@ -51,12 +51,19 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
51
51
  } = useForm({
52
52
  mode: "onChange",
53
53
  defaultValues: {
54
- description: isUpdating ? resource == null ? void 0 : resource.description : "",
55
- enablePublic: isUpdating ? resource == null ? void 0 : resource.public : !1,
56
- title: isUpdating ? resource == null ? void 0 : resource.name : "",
57
- formSlug: isUpdating ? resource == null ? void 0 : resource.slug : "",
58
- allowReplies: isUpdating ? resource == null ? void 0 : resource.allowReplies : !0
59
- }
54
+ description: "",
55
+ enablePublic: !1,
56
+ title: "",
57
+ formSlug: "",
58
+ allowReplies: !0
59
+ },
60
+ values: isUpdating && resource ? {
61
+ description: resource.description ?? "",
62
+ enablePublic: resource.public ?? !1,
63
+ title: resource.name ?? "",
64
+ formSlug: resource.slug ?? "",
65
+ allowReplies: resource.allowReplies ?? !0
66
+ } : void 0
60
67
  }), {
61
68
  ref: mediaLibraryRef,
62
69
  libraryMedia,
@@ -143,9 +150,9 @@ const DEFAULT_INPUT_MAX_LENGTH = 60, DEFAULT_TEXTAREA_MAX_LENGTH = 400, Resource
143
150
  maxLength: textareaMaxLength
144
151
  }), placeholder: ((_f = customT.placeholder) == null ? void 0 : _f.description) ?? t("explorer.resource.editModal.description.placeholder"), size: "md", maxLength: textareaMaxLength, showCounter: !0 })
145
152
  ] }),
146
- application === "blog" && hasOptionalCommentRepliesWorkflow === !0 && /* @__PURE__ */ jsxs(FormControl, { id: "allowReplies", className: "d-flex gap-8 mt-16 mb-8", children: [
147
- /* @__PURE__ */ jsx(FormControl.Input, { type: "checkbox", defaultChecked: isUpdating ? resource.allowReplies : !0, ...register("allowReplies"), className: "form-check-input mt-0", size: "sm" }),
148
- /* @__PURE__ */ jsx(FormControl.Label, { className: "form-check-label mb-0", children: t("explorer.resource.editModal.comments.allowReplies") })
153
+ application === "blog" && hasOptionalCommentRepliesWorkflow === !0 && /* @__PURE__ */ jsxs("div", { className: "form-check d-flex align-items-center gap-8 mt-16 mb-8", children: [
154
+ /* @__PURE__ */ jsx("input", { id: "allowReplies", type: "checkbox", className: "form-check-input mt-0", defaultChecked: isUpdating ? resource.allowReplies : !0, ...register("allowReplies") }),
155
+ /* @__PURE__ */ jsx("label", { htmlFor: "allowReplies", className: "form-check-label mb-0", children: t("explorer.resource.editModal.comments.allowReplies") })
149
156
  ] })
150
157
  ] })
151
158
  ] }),
@@ -4,8 +4,7 @@ import SvgIconCopy from "../../../icons/components/IconCopy.js";
4
4
  import { useSlug } from "../hooks/useSlug.js";
5
5
  import Heading from "../../../../components/Heading/Heading.js";
6
6
  import Alert from "../../../../components/Alert/Alert.js";
7
- import FormControl from "../../../../components/Form/FormControl.js";
8
- import Input from "../../../../components/Input/Input.js";
7
+ import Switch from "../../../../components/Switch/Switch.js";
9
8
  import Button from "../../../../components/Button/Button.js";
10
9
  const BlogPublic = ({
11
10
  appCode,
@@ -34,18 +33,15 @@ const BlogPublic = ({
34
33
  appCode
35
34
  ] }),
36
35
  /* @__PURE__ */ jsx(Alert, { type: "info", children: t("explorer.resource.editModal.access.alert") }),
37
- /* @__PURE__ */ jsxs(FormControl, { id: "flexSwitchCheckDefault", className: "form-switch d-flex gap-8 mt-16 mb-8", children: [
38
- /* @__PURE__ */ jsx(FormControl.Input, { type: "checkbox", role: "switch", defaultChecked: isUpdating ? resource.public : !1, ...register("enablePublic", {
39
- disabled: !resourceName,
40
- onChange: (event) => {
41
- const checked = event.target.checked;
42
- onPublicChange(checked);
43
- }
44
- }), className: "form-check-input mt-0", size: "md" }),
45
- /* @__PURE__ */ jsx(FormControl.Label, { className: "form-check-label mb-0", children: t("explorer.resource.editModal.access.flexSwitchCheckDefault.label") })
46
- ] }),
36
+ /* @__PURE__ */ jsx(Switch, { id: "flexSwitchCheckDefault", role: "switch", className: "mt-16 mb-8", label: t("explorer.resource.editModal.access.flexSwitchCheckDefault.label"), defaultChecked: isUpdating ? resource.public : !1, ...register("enablePublic", {
37
+ disabled: !resourceName,
38
+ onChange: (event) => {
39
+ const checked = event.target.checked;
40
+ onPublicChange(checked);
41
+ }
42
+ }) }),
47
43
  isPublic && /* @__PURE__ */ jsxs(Fragment, { children: [
48
- /* @__PURE__ */ jsx(FormControl, { id: "formSlug", children: /* @__PURE__ */ jsx(Input, { type: "text", hidden: !0, defaultValue: isUpdating ? slug : "", ...register("formSlug"), size: "sm" }) }, slug),
44
+ /* @__PURE__ */ jsx("input", { type: "hidden", defaultValue: isUpdating ? slug : "", ...register("formSlug") }, slug),
49
45
  /* @__PURE__ */ jsxs("div", { className: "d-flex flex-wrap align-items-center gap-4", children: [
50
46
  /* @__PURE__ */ jsxs("p", { className: "text-break", children: [
51
47
  window.location.origin,
@@ -1,5 +1,5 @@
1
1
  import { Slice, Fragment } from "../../../../prosemirror-model@1.25.12/node_modules/prosemirror-model/dist/index.js";
2
- import { ReplaceStep, ReplaceAroundStep } from "../../../../prosemirror-transform@1.12.3/node_modules/prosemirror-transform/dist/index.js";
2
+ import { ReplaceStep, ReplaceAroundStep } from "../../../../prosemirror-transform@1.12.4/node_modules/prosemirror-transform/dist/index.js";
3
3
  const classesById = /* @__PURE__ */ Object.create(null);
4
4
  class Selection {
5
5
  /**
@@ -235,8 +235,6 @@ class AddMarkStep extends Step {
235
235
  super(), this.from = from, this.to = to, this.mark = mark;
236
236
  }
237
237
  apply(doc) {
238
- if (this.from == this.to)
239
- return new StepResult(doc, null);
240
238
  let oldSlice = doc.slice(this.from, this.to), $from = doc.resolve(this.from), parent = $from.node($from.sharedDepth(this.to)), slice = new Slice(mapFragment(oldSlice.content, (node, parent2) => !node.isAtom || !parent2.type.allowsMarkType(this.mark.type) ? node : node.mark(this.mark.addToSet(node.marks)), parent), oldSlice.openStart, oldSlice.openEnd);
241
239
  return StepResult.fromReplace(doc, this.from, this.to, slice);
242
240
  }
@@ -247,12 +245,12 @@ class AddMarkStep extends Step {
247
245
  let added = this.mark.addToSet(node.marks);
248
246
  if (!Mark.sameSet(added, node.marks)) {
249
247
  let from = Math.max(this.from, pos), to = Math.min(this.to, pos + node.nodeSize);
250
- steps.push(new RemoveMarkStep(from, to, this.mark));
248
+ pushMarkStep(RemoveMarkStep, from, to, this.mark, steps);
251
249
  for (let mark of node.marks)
252
- mark.isInSet(added) || steps.push(new AddMarkStep(from, to, mark));
250
+ mark.isInSet(added) || pushMarkStep(AddMarkStep, from, to, mark, steps);
253
251
  }
254
252
  }
255
- }), steps.length == 0 ? new RemoveMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
253
+ }), steps.length == 1 ? steps[0] : new MarkSetStep(steps);
256
254
  }
257
255
  map(mapping) {
258
256
  let from = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
@@ -287,16 +285,14 @@ class RemoveMarkStep extends Step {
287
285
  super(), this.from = from, this.to = to, this.mark = mark;
288
286
  }
289
287
  apply(doc) {
290
- if (this.from == this.to)
291
- return new StepResult(doc, null);
292
288
  let oldSlice = doc.slice(this.from, this.to), slice = new Slice(mapFragment(oldSlice.content, (node) => node.mark(this.mark.removeFromSet(node.marks)), doc), oldSlice.openStart, oldSlice.openEnd);
293
289
  return StepResult.fromReplace(doc, this.from, this.to, slice);
294
290
  }
295
291
  invert(doc) {
296
292
  let steps = [];
297
293
  return doc.nodesBetween(this.from, this.to, (node, pos) => {
298
- node.isInline && node.isAtom && this.mark.isInSet(node.marks) && steps.push(new AddMarkStep(Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark));
299
- }), steps.length == 0 ? new AddMarkStep(this.from, this.from, this.mark) : steps.length == 1 ? steps[0] : new MarkSetStep(steps);
294
+ node.isInline && node.isAtom && this.mark.isInSet(node.marks) && pushMarkStep(AddMarkStep, Math.max(this.from, pos), Math.min(this.to, pos + node.nodeSize), this.mark, steps);
295
+ }), steps.length == 1 ? steps[0] : new MarkSetStep(steps);
300
296
  }
301
297
  map(mapping) {
302
298
  let from = mapping.map(this.from, 1), to = mapping.map(this.to, -1);
@@ -323,6 +319,10 @@ class RemoveMarkStep extends Step {
323
319
  }
324
320
  }
325
321
  Step.jsonID("removeMark", RemoveMarkStep);
322
+ function pushMarkStep(cls, from, to, mark, target) {
323
+ let last = target.length ? target[target.length - 1] : null;
324
+ last && last instanceof cls && last.to == from && last.mark.eq(mark) ? target[target.length - 1] = new cls(last.from, to, mark) : target.push(new cls(from, to, mark));
325
+ }
326
326
  class MarkSetStep extends Step {
327
327
  constructor(steps) {
328
328
  super(), this.steps = steps;
@@ -350,7 +350,7 @@ class MarkSetStep extends Step {
350
350
  toJSON() {
351
351
  return { stepType: "markSet", steps: this.steps.map((s) => s.toJSON()) };
352
352
  }
353
- fromJSON(schema, json) {
353
+ static fromJSON(schema, json) {
354
354
  if (!Array.isArray(json.steps) || !json.steps.every((s) => s.stepType == "addMark" || s.stepType == "removeMark"))
355
355
  throw new RangeError("Invalid JSON for MarkSetStep");
356
356
  return new MarkSetStep(json.steps.map((s) => Step.fromJSON(schema, s)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@edifice.io/react",
3
- "version": "2.6.10-develop-pedago.20261022145938",
3
+ "version": "2.6.10-develop-pedago.20261023145636",
4
4
  "description": "Edifice React Library",
5
5
  "keywords": [
6
6
  "react",
@@ -132,9 +132,9 @@
132
132
  "swiper": "10.1.0",
133
133
  "ua-parser-js": "1.0.36",
134
134
  "zustand": "4.5.7",
135
- "@edifice.io/utilities": "2.6.10-develop-pedago.20261022145938",
136
- "@edifice.io/tiptap-extensions": "2.6.10-develop-pedago.20261022145938",
137
- "@edifice.io/bootstrap": "2.6.10-develop-pedago.20261022145938"
135
+ "@edifice.io/bootstrap": "2.6.10-develop-pedago.20261023145636",
136
+ "@edifice.io/tiptap-extensions": "2.6.10-develop-pedago.20261023145636",
137
+ "@edifice.io/utilities": "2.6.10-develop-pedago.20261023145636"
138
138
  },
139
139
  "devDependencies": {
140
140
  "@babel/plugin-transform-react-pure-annotations": "7.27.1",
@@ -165,8 +165,8 @@
165
165
  "vite": "5.4.14",
166
166
  "vite-plugin-dts": "4.5.4",
167
167
  "vite-tsconfig-paths": "5.1.4",
168
- "@edifice.io/client": "2.6.10-develop-pedago.20261022145938",
169
- "@edifice.io/config": "2.6.10-develop-pedago.20261022145938"
168
+ "@edifice.io/client": "2.6.10-develop-pedago.20261023145636",
169
+ "@edifice.io/config": "2.6.10-develop-pedago.20261023145636"
170
170
  },
171
171
  "peerDependencies": {
172
172
  "@react-spring/web": "9.7.5",