@sparqjs/schema-vue 0.2.3 → 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
@@ -1563,7 +1563,7 @@ function Mr(e, t) {
1563
1563
  return e === void 0 ? t : Math.max(1, Math.floor(e));
1564
1564
  }
1565
1565
  //#endregion
1566
- //#region ../../../../internal/frontend-core/src/kernel.ts
1566
+ //#region ../../../frontend-core/dist/kernel.js
1567
1567
  var Nr = {
1568
1568
  builtin: 0,
1569
1569
  plugin: 100,
@@ -3125,22 +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
3162
+ },
3163
+ onClick(t) {
3164
+ !e.disabled && t.target instanceof Element && t.target.closest(".w-e-text-container") && n.value?.focus();
3144
3165
  }
3145
3166
  }, [
3146
3167
  O("div", {
@@ -3149,26 +3170,14 @@ var no = {
3149
3170
  width: "100%",
3150
3171
  ...l.value ?? {}
3151
3172
  }
3152
- }, [O(r.value, {
3153
- editor: i.value,
3154
- mode: e.mode,
3155
- defaultConfig: u.value
3173
+ }, [O("div", {
3174
+ ref: r,
3175
+ class: "sparq-rich-text-editor__toolbar"
3156
3176
  }), e.source ? f() : void 0]),
3157
- O(n.value, {
3158
- modelValue: a.value,
3159
- mode: e.mode,
3160
- class: o.value ? "is-source-hidden" : void 0,
3161
- style: c.value,
3162
- defaultConfig: d.value,
3163
- onOnCreated(t) {
3164
- i.value = t, e.disabled && t.disable();
3165
- },
3166
- "onUpdate:modelValue"(e) {
3167
- a.value = e, t("update:modelValue", e);
3168
- },
3169
- onBlur() {
3170
- t("blur");
3171
- }
3177
+ O("div", {
3178
+ ref: i,
3179
+ class: [o.value ? "is-source-hidden" : void 0],
3180
+ style: c.value
3172
3181
  }),
3173
3182
  o.value ? O("textarea", {
3174
3183
  class: "sparq-rich-text-editor__source",
@@ -3185,7 +3194,7 @@ var no = {
3185
3194
  return O("button", {
3186
3195
  type: "button",
3187
3196
  class: ["sparq-rich-text-editor__source-toggle", o.value ? "is-active" : void 0],
3188
- disabled: e.disabled || !i.value,
3197
+ disabled: e.disabled || !n.value,
3189
3198
  title: o.value ? "返回编辑" : "HTML源码",
3190
3199
  onClick() {
3191
3200
  p();
@@ -3193,12 +3202,12 @@ var no = {
3193
3202
  }, o.value ? "返回编辑" : "HTML源码");
3194
3203
  }
3195
3204
  function p() {
3196
- if (!(e.disabled || !i.value)) {
3205
+ if (!(e.disabled || !n.value)) {
3197
3206
  if (o.value) {
3198
- 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;
3199
3208
  return;
3200
3209
  }
3201
- s.value = i.value.getHtml(), o.value = !0;
3210
+ s.value = n.value.getHtml(), o.value = !0;
3202
3211
  }
3203
3212
  }
3204
3213
  }