@jinntec/jinntap 1.13.1 → 1.13.3

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 +26 -27
  2. package/package.json +1 -1
@@ -21896,37 +21896,36 @@ class Ix {
21896
21896
  }
21897
21897
  updatePanelForCurrentPosition(e) {
21898
21898
  this.panel.innerHTML = "";
21899
- const { from: t, to: i } = e.state.selection, r = e.state.doc.nodeAt(t), s = [];
21900
- let o;
21901
- if (r) {
21902
- r.isText && (o = Ph(e, t, i));
21903
- let l = t, c = e.state.doc.resolve(l).depth;
21904
- const u = e.state.doc.resolve(l);
21899
+ const { from: t, to: i } = e.state.selection, r = e.state.doc.resolve(t), s = r.node(), o = [];
21900
+ let a;
21901
+ if (s) {
21902
+ s.isText && (a = Ph(e, t, i));
21903
+ let c = r.depth;
21905
21904
  for (; c > 0; ) {
21906
- const d = u.node(c);
21907
- if (d) {
21908
- const h = {
21909
- type: d.type.name,
21910
- node: d,
21911
- pos: { from: u.start(c), to: u.end(c) }
21905
+ const u = r.node(c);
21906
+ if (u) {
21907
+ const d = {
21908
+ type: u.type.name,
21909
+ node: u,
21910
+ pos: { from: r.start(c), to: r.end(c) }
21912
21911
  };
21913
- s.push(h);
21912
+ o.push(d);
21914
21913
  }
21915
21914
  c--;
21916
21915
  }
21917
21916
  }
21918
- let a = document.createElement("ul");
21919
- s.reverse().forEach((l, c) => {
21917
+ let l = document.createElement("ul");
21918
+ o.reverse().forEach((c, u) => {
21919
+ const d = document.createElement("li"), h = document.createElement("a");
21920
+ h.setAttribute("href", "#"), h.textContent = c.type, h.addEventListener("click", (p) => {
21921
+ p.preventDefault(), this.editor.chain().focus().setNodeSelection(c.pos.from - 1).run(), this.attributePanel.showNodeAttributes(c.node);
21922
+ }), d.appendChild(h), l.appendChild(d);
21923
+ }), a && a.forEach((c) => {
21920
21924
  const u = document.createElement("li"), d = document.createElement("a");
21921
- d.setAttribute("href", "#"), d.textContent = l.type, d.addEventListener("click", (h) => {
21922
- h.preventDefault(), this.editor.chain().focus().setNodeSelection(l.pos.from - 1).run(), this.attributePanel.showNodeAttributes(l.node);
21923
- }), u.appendChild(d), a.appendChild(u);
21924
- }), o && o.forEach((l) => {
21925
- const c = document.createElement("li"), u = document.createElement("a");
21926
- u.setAttribute("href", "#"), u.textContent = l.mark.type.name, u.addEventListener("click", (d) => {
21927
- d.preventDefault(), this.editor.chain().focus().extendMarkRange(l.mark.type).run(), this.attributePanel.showMarkAttributes(l.mark, l.text);
21928
- }), c.appendChild(u), a.appendChild(c);
21929
- }), this.panel.appendChild(a);
21925
+ d.setAttribute("href", "#"), d.textContent = c.mark.type.name, d.addEventListener("click", (h) => {
21926
+ h.preventDefault(), this.editor.chain().focus().extendMarkRange(c.mark.type).run(), this.attributePanel.showMarkAttributes(c.mark, c.text);
21927
+ }), u.appendChild(d), l.appendChild(u);
21928
+ }), this.panel.appendChild(l);
21930
21929
  }
21931
21930
  }
21932
21931
  class zx {
@@ -38853,7 +38852,7 @@ class Ux extends HTMLElement {
38853
38852
  url: o,
38854
38853
  document: this.doc,
38855
38854
  onSynced: () => {
38856
- !this.doc.getMap("config").get("initialContentLoaded") && this.editor && (this.doc.getMap("config").set("initialContentLoaded", !0), this.editor.chain().focus().setContent(t).run());
38855
+ !this.doc.getMap("config").get("initialContentLoaded") && this.editor && (this.doc.getMap("config").set("initialContentLoaded", !0), this.editor.chain().setContent(t).setTextSelection(0).focus().run());
38857
38856
  }
38858
38857
  // onAwarenessChange: ({ states }) => {
38859
38858
  // console.log('onAwarenessChange: %o', states);
@@ -38874,7 +38873,7 @@ class Ux extends HTMLElement {
38874
38873
  includeChildren: !0
38875
38874
  })
38876
38875
  ],
38877
- autofocus: "start",
38876
+ autofocus: !1,
38878
38877
  onCreate: () => {
38879
38878
  this.dispatchContentChange(), this.dispatchEvent(new CustomEvent("ready"));
38880
38879
  },
@@ -38889,7 +38888,7 @@ class Ux extends HTMLElement {
38889
38888
  name: this.collabUser,
38890
38889
  color: _x()
38891
38890
  }
38892
- }))) : (s.extensions.push(qb), s.content = t), this.editor = new Nb(s), this.attributePanel = new Nx(this, this._schema), this.navigationPanel = new Ix(this, this.attributePanel), this.toolbar = new zx(this, this._schema);
38891
+ }))) : s.extensions.push(qb), this.editor = new Nb(s), this.attributePanel = new Nx(this, this._schema), this.navigationPanel = new Ix(this, this.attributePanel), this.toolbar = new zx(this, this._schema), this.collabEnabled || (this.content = t);
38893
38892
  }
38894
38893
  dispatchContentChange() {
38895
38894
  this.dispatchEvent(new CustomEvent("content-change", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jinntec/jinntap",
3
- "version": "1.13.1",
3
+ "version": "1.13.3",
4
4
  "type": "module",
5
5
  "main": "./dist/index.es.js",
6
6
  "module": "./dist/index.es.js",