@sparqjs/schema-vue 0.2.4 → 0.2.5

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.js CHANGED
@@ -3125,25 +3125,43 @@ var no = {
3125
3125
  let n = M(), r = M(), i = M(), a = j(e.modelValue), o = j(!1), s = j(e.modelValue), c = E(() => e.height ? { height: co(e.height) } : void 0), l = E(() => yo(e.toolbar)), u = E(() => oo(e.toolbarConfig, e.toolbar)), d = E(() => ({
3126
3126
  placeholder: e.placeholder,
3127
3127
  readOnly: e.disabled,
3128
- ...lo(e.assetService, e.editorConfig)
3128
+ ...lo(e.assetService, e.editorConfig),
3129
+ onChange(e) {
3130
+ let n = e.getHtml();
3131
+ a.value = n, s.value = n, t("update:modelValue", n);
3132
+ },
3133
+ onBlur() {
3134
+ t("blur");
3135
+ }
3129
3136
  }));
3130
- return At(async () => {
3131
- let e = await import("@wangeditor/editor-for-vue");
3132
- n.value = e.Editor, r.value = e.Toolbar;
3137
+ return At(() => {
3138
+ import("./index.esm-B3ROeNbW.js").then((t) => {
3139
+ i.value && (n.value = t.createEditor({
3140
+ selector: i.value,
3141
+ mode: e.mode,
3142
+ html: a.value,
3143
+ config: d.value
3144
+ }), r.value && n.value && t.createToolbar({
3145
+ editor: n.value,
3146
+ selector: r.value,
3147
+ mode: e.mode,
3148
+ config: u.value
3149
+ }), e.disabled && n.value.disable());
3150
+ });
3133
3151
  }), N(() => e.modelValue, (e) => {
3134
- a.value = e || "", o.value || (s.value = e || "");
3152
+ a.value = e || "", o.value || (s.value = e || "", n.value && n.value.getHtml() !== (e || "") && n.value.setHtml(e || ""));
3135
3153
  }), N(() => e.disabled, (e) => {
3136
- e ? i.value?.disable() : i.value?.enable();
3154
+ e ? n.value?.disable() : n.value?.enable();
3137
3155
  }), kt(() => {
3138
- i.value?.destroy(), i.value = void 0;
3139
- }), () => !n.value || !r.value ? O("div", { class: "sparq-rich-text-editor sparq-rich-text-editor--wang sparq-rich-text-editor--loading" }) : O("div", {
3156
+ n.value?.destroy(), n.value = void 0;
3157
+ }), () => O("div", {
3140
3158
  class: "sparq-rich-text-editor sparq-rich-text-editor--wang",
3141
3159
  style: {
3142
3160
  width: "100%",
3143
3161
  minWidth: 0
3144
3162
  },
3145
3163
  onClick(t) {
3146
- !e.disabled && t.target instanceof Element && t.target.closest(".w-e-text-container") && i.value?.focus();
3164
+ !e.disabled && t.target instanceof Element && t.target.closest(".w-e-text-container") && n.value?.focus();
3147
3165
  }
3148
3166
  }, [
3149
3167
  O("div", {
@@ -3152,26 +3170,14 @@ var no = {
3152
3170
  width: "100%",
3153
3171
  ...l.value ?? {}
3154
3172
  }
3155
- }, [O(r.value, {
3156
- editor: i.value,
3157
- mode: e.mode,
3158
- defaultConfig: u.value
3173
+ }, [O("div", {
3174
+ ref: r,
3175
+ class: "sparq-rich-text-editor__toolbar"
3159
3176
  }), e.source ? f() : void 0]),
3160
- O(n.value, {
3161
- modelValue: a.value,
3162
- mode: e.mode,
3163
- class: o.value ? "is-source-hidden" : void 0,
3164
- style: c.value,
3165
- defaultConfig: d.value,
3166
- onOnCreated(t) {
3167
- i.value = t, e.disabled && t.disable();
3168
- },
3169
- "onUpdate:modelValue"(e) {
3170
- a.value = e, t("update:modelValue", e);
3171
- },
3172
- onBlur() {
3173
- t("blur");
3174
- }
3177
+ O("div", {
3178
+ ref: i,
3179
+ class: [o.value ? "is-source-hidden" : void 0],
3180
+ style: c.value
3175
3181
  }),
3176
3182
  o.value ? O("textarea", {
3177
3183
  class: "sparq-rich-text-editor__source",
@@ -3188,7 +3194,7 @@ var no = {
3188
3194
  return O("button", {
3189
3195
  type: "button",
3190
3196
  class: ["sparq-rich-text-editor__source-toggle", o.value ? "is-active" : void 0],
3191
- disabled: e.disabled || !i.value,
3197
+ disabled: e.disabled || !n.value,
3192
3198
  title: o.value ? "返回编辑" : "HTML源码",
3193
3199
  onClick() {
3194
3200
  p();
@@ -3196,12 +3202,12 @@ var no = {
3196
3202
  }, o.value ? "返回编辑" : "HTML源码");
3197
3203
  }
3198
3204
  function p() {
3199
- if (!(e.disabled || !i.value)) {
3205
+ if (!(e.disabled || !n.value)) {
3200
3206
  if (o.value) {
3201
- i.value.setHtml(s.value), a.value = s.value, t("update:modelValue", s.value), o.value = !1;
3207
+ n.value.setHtml(s.value), a.value = s.value, t("update:modelValue", s.value), o.value = !1;
3202
3208
  return;
3203
3209
  }
3204
- s.value = i.value.getHtml(), o.value = !0;
3210
+ s.value = n.value.getHtml(), o.value = !0;
3205
3211
  }
3206
3212
  }
3207
3213
  }