@jinntec/jinntap 1.21.0 → 1.21.2

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.
Files changed (2) hide show
  1. package/dist/jinn-tap.es.js +16 -13
  2. package/package.json +1 -1
@@ -20945,20 +20945,20 @@ class rG extends H1 {
20945
20945
  }
20946
20946
  }
20947
20947
  crypto.getRandomValues.bind(crypto);
20948
- function fv(n) {
20949
- const t = n.state.doc.toJSON(), i = new iG(n);
20950
- let s = [];
20951
- return t.content.forEach((a) => {
20952
- s.push(i.serialize(a));
20953
- }), s.join(`
20948
+ function fv(n, e) {
20949
+ const i = n.state.doc.toJSON(), s = new iG(n, e);
20950
+ let a = [];
20951
+ return i.content.forEach((c) => {
20952
+ a.push(s.serialize(c));
20953
+ }), a.join(`
20954
20954
  `);
20955
20955
  }
20956
20956
  function la(n, e) {
20957
20957
  return n.type === e.type && JSON.stringify(n.attrs) === JSON.stringify(e.attrs);
20958
20958
  }
20959
20959
  class iG {
20960
- constructor(e) {
20961
- this.editor = e, this.openMarks = [];
20960
+ constructor(e, t) {
20961
+ this.editor = e, this.openMarks = [], this.schemaDef = t;
20962
20962
  }
20963
20963
  serialize(e, t, i) {
20964
20964
  if (e.type === "text") {
@@ -20980,8 +20980,8 @@ class iG {
20980
20980
  return ((C = i == null ? void 0 : i.marks) != null && C.some((T) => la(T, y)) ? 1 : 0) - w;
20981
20981
  }), h.forEach((m) => {
20982
20982
  this.openMarks.push(m);
20983
- const y = m.type, w = m.attrs ? Object.entries(m.attrs).filter(([k, A]) => A !== null).map(([k, A]) => `${k}="${A}"`).join(" ") : "";
20984
- d += `<${y}${w ? " " + w : ""}>`;
20983
+ const y = this.schemaDef.schema[m.type], w = m.type, k = m.attrs ? Object.entries(m.attrs).filter(([A, C]) => C !== null).map(([A, C]) => `${A}="${C}"`) : [];
20984
+ y.preserveSpace && k.push('xml:space="preserve"'), d += `<${w}${k.length > 0 ? " " + k.join(" ") : ""}>`;
20985
20985
  }), d += e.text, i || (this.openMarks.reverse().forEach((m) => {
20986
20986
  d += `</${m.type}>`;
20987
20987
  }), this.openMarks = []);
@@ -48177,6 +48177,7 @@ const N4 = /* @__PURE__ */ A4(T4), B4 = {
48177
48177
  choice: {
48178
48178
  type: "inline",
48179
48179
  content: "abbr expan",
48180
+ preserveSpace: !0,
48180
48181
  toolbar: {
48181
48182
  Choice: {
48182
48183
  select: "Textcritical",
@@ -48461,7 +48462,7 @@ class R4 extends HTMLElement {
48461
48462
  }))) : a.extensions.push(LP), this.editor = new BP(a), this.attributePanel = new xG(this, this._schema), this.navigationPanel = new AG(this, this.attributePanel), this.toolbar = new CG(this, this._schema), this.collaboration || (this.content = t);
48462
48463
  }
48463
48464
  dispatchContentChange() {
48464
- const e = fv(this.editor);
48465
+ const e = fv(this.editor, this._schema);
48465
48466
  this.dispatchEvent(new CustomEvent("content-change", {
48466
48467
  detail: {
48467
48468
  body: e,
@@ -48481,7 +48482,7 @@ class R4 extends HTMLElement {
48481
48482
  }
48482
48483
  // Getter for the full XML content
48483
48484
  get xml() {
48484
- return Dv(fv(this.editor), this.document);
48485
+ return Dv(fv(this.editor, this._schema), this.document);
48485
48486
  }
48486
48487
  // Setter for the full XML content
48487
48488
  set xml(e) {
@@ -48490,7 +48491,9 @@ class R4 extends HTMLElement {
48490
48491
  }
48491
48492
  newDocument() {
48492
48493
  const { doc: e, content: t } = x4();
48493
- this.document = e, this.content = t;
48494
+ this.document = e, this.content = t, this.metadata = {
48495
+ name: "untitled.xml"
48496
+ };
48494
48497
  }
48495
48498
  // Method to focus the editor
48496
48499
  focus() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinntec/jinntap",
3
- "version": "1.21.0",
3
+ "version": "1.21.2",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "module": "./dist/index.es.js",