Skip to content

Commit 7698e98

Browse files
committed
build: v1.4.0 release (^.^)YYa!!
1 parent bd567ee commit 7698e98

File tree

7 files changed

+62
-5
lines changed

7 files changed

+62
-5
lines changed

changes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# AiEditor ChangeLog
22

3+
4+
## v1.4.0 20250625:
5+
- feat: Added video attributes autoplay, loop, muted, preload
6+
- feat: Upgraded related dependencies to the latest version
7+
- fix: Fixed the issue that the video does not display in read-only mode
8+
- fix: Fixed the issue that the video attributes poster and controls do not take effect
9+
- fix: In the code block, the issue that the pasted code does not display
10+
- fix: fixed when pasting images in a table, the table is lost when data is backfilled
11+
12+
---
13+
- 新增:新增视频属性 autoplay, loop, muted, preload
14+
- 优化:升级相关依赖到最新版本
15+
- 修复:修复只读模式下,视频不显示的问题
16+
- 修复:修复视频属性 poster、controls 不生效问题
17+
- 修复:在代码块中,粘贴代码不显示的问题
18+
- 修复:在 table 内粘贴图片时,当数据回填的时候 table 丢失的问题
19+
20+
21+
322
## v1.3.9 20250603:
423
- fix: fixed paste in new line if pasteAsText options enable
524
- fix: fix: fixed Uncaught RangeError: Invalid content for node tableCell: `<>`

dist/index.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ img.ProseMirror-separator {
227227
<option value="_blank">${te("link-open-blank")}</option>
228228
</select>
229229
</div>
230-
`),e.onConfirmClick(n=>{var o,a;const r=n.popper.querySelector("#href").value;if(r.trim()===""){(o=this.editor)==null||o.chain().focus().extendMarkRange("link").unsetLink().run();return}let i=n.popper.querySelector("#target").value;i.trim()===""&&(i=null),(a=this.editor)==null||a.chain().focus().extendMarkRange("link").setLink({href:r,target:i,rel:null}).run()}),e.onShow(n=>{var i;const r=(i=this.editor)==null?void 0:i.getAttributes("link");r&&r.href?n.popper.querySelector("#href").value=r.href:n.popper.querySelector("#href").value="",r&&r.target?n.popper.querySelector("#target").value=r.target:n.popper.querySelector("#target").value=""}),e.setTrigger(this.querySelector("div"),"bottom")}onActive(e){return e.isActive("link")}};const Sl=t=>{const e=document.createElement("div");return e.innerHTML=t,e.firstElementChild},xv=(t,e)=>{const n=new RegExp(`<${e}[^>]*>(.*?)</${e}>`,"gi");return t.replace(n,(r,i)=>i)},Dv=(t,e)=>{for(let n of e)t=xv(t,n);return t},wv=(t,e,n)=>{function r(u){const d=document.createDocumentFragment();for(;u.firstChild;){const p=u.removeChild(u.firstChild),_=i(p);_&&d.appendChild(_)}return d}function i(u){var d;if(u.nodeType===Node.ELEMENT_NODE){const p=u;if(e.includes(p.tagName.toLowerCase())){if(!(((d=p.textContent)==null?void 0:d.trim())||""))return p;for(;p.attributes.length>0;)p.removeAttribute(p.attributes[0].name);return p.appendChild(r(p)),p}else return r(p)}else if(u.nodeType===Node.TEXT_NODE&&u.textContent&&u.textContent.trim().length>0)return u;return null}function o(u){const d=u.querySelectorAll("br");for(let p=0;p<d.length-1;p++){const _=d[p],m=d[p+1];if(_.nextSibling===m){let f=_.previousSibling;const h=[];for(;f&&f.nodeName!=="P";)h.unshift(f),f=f.previousSibling;const E=document.createElement("p");h.forEach(S=>E.appendChild(S)),_.replaceWith(E),m.remove(),p++}}}t=t.replace(/(\n)/gm," ");const s=new DOMParser().parseFromString(t,"text/html"),l=i(s.body),c=document.createElement("div");return l&&(c.appendChild(l),o(c)),c.innerHTML},Mv=t=>{var i;const e=t.documentElement.getAttributeNames();if(e&&e.length>0)for(let o of e){const a=t.documentElement.getAttribute(o);if(a!=null&&a.includes("microsoft")||a!=null&&a.includes("excel"))return!0}let n=t.getElementsByTagName("meta");for(let o of n){let a=o.getAttribute("name"),s=o.getAttribute("content");if(a&&a.toLowerCase()==="generator"&&(s!=null&&s.includes("Microsoft")||s!=null&&s.includes("LibreOffice")||s!=null&&s.includes("OpenOffice")))return!0}const r=(i=t.body.innerHTML)==null?void 0:i.trim();return!!(r!=null&&r.startsWith("<table")&&(r!=null&&r.endsWith("</table>")))},Lv=t=>{const e=document.createElement("div");return e.innerHTML=t,e.querySelectorAll("p").forEach(r=>{(!r.textContent||r.textContent.trim()==="")&&(r.querySelector("img")||r.remove())}),e.innerHTML},kv=t=>["table","thead","tbody","tr","th","td","ul","ol","li","pre","blockquote","figure","iframe","video","audio","svg","math","embed"].includes(t.tagName.toLowerCase()),Pv=t=>{const n=new DOMParser().parseFromString(t,"text/html"),r=document.createDocumentFragment(),i=n.body.children;for(let a of i){if(kv(a)){r.appendChild(a.cloneNode(!0));continue}a.hasAttribute("data-pm-slice")?a.childNodes.forEach(s=>{r.appendChild(s.cloneNode(!0))}):r.appendChild(a.cloneNode(!0))}const o=document.createElement("div");return o.appendChild(r),o.innerHTML},Bi=t=>{if(!t)return"";const n=new DOMParser().parseFromString(t,"text/html"),r=n.querySelectorAll("ul");r&&r.length>0&&r.forEach(l=>{var c;if((c=l.getAttribute("class"))!=null&&c.includes("task-list")){l.getAttributeNames().forEach(p=>{l.removeAttribute(p)}),l.setAttribute("data-type","taskList");const u=l.firstElementChild;if((u==null?void 0:u.tagName)==="P"){const p=document.createDocumentFragment();u.childNodes.forEach(_=>{p.append(_.cloneNode(!0))}),u.replaceWith(p)}l.querySelectorAll("li").forEach(p=>{p.getAttributeNames().forEach(m=>{l.removeAttribute(m)});const _=p.querySelector("input[type='checkbox']");_&&(p.setAttribute("data-type","taskItem"),p.setAttribute("data-checked",_.hasAttribute("checked")?"true":"false"))})}});const i=n.querySelectorAll("li");i&&i.length>0&&i.forEach(l=>{l.innerHTML||(l.innerHTML="<p></p>")});const o=n.querySelectorAll("body>p>img");if(o.length>0){const l=n.querySelector("body");for(const c of o){const u=c.parentNode,d=Array.prototype.indexOf.call(l.children,u);l.insertBefore(c,l.children[d])}}const a=n.querySelectorAll("table");a.length>0&&a.forEach(l=>{bu(l)});let s="";return n.body.childNodes.forEach(l=>{if(l.nodeType===Node.TEXT_NODE)s+=l.textContent;else if(l.nodeType===Node.ELEMENT_NODE){const c=l;c.querySelector("img")&&c.tagName!=="A"?s+=c.innerHTML:s+=c.outerHTML}}),s},Fv=t=>{if(!t)return"";const n=new DOMParser().parseFromString(t.trim(),"text/html");let r="";return n.body.childNodes.forEach(i=>{if(i.nodeType===Node.TEXT_NODE)r+=i.textContent;else if(i.nodeType===Node.ELEMENT_NODE){const o=i;o===n.body.firstChild&&o.tagName==="P"?r+=o.innerHTML:r+=o.outerHTML}}),r},Bv=t=>{const n=new DOMParser().parseFromString(t,"text/html");return n.querySelectorAll("table").forEach(i=>{bu(i)}),n.body.innerHTML},bu=t=>{if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(["TABLE","THEAD","TBODY","TFOOT","TR","COLGROUP","COL"].includes(e.tagName)&&Array.from(e.childNodes).forEach(i=>{i.nodeType===Node.TEXT_NODE?/^[\s\n\r]*$/.test(i.textContent||"")&&e.removeChild(i):bu(i)}),(e.tagName==="TD"||e.tagName==="TH")&&!e.hasChildNodes()){const r=document.createElement("p");e.appendChild(r)}}};class Uv extends fe{constructor(){super(),this.template=`
230+
`),e.onConfirmClick(n=>{var o,a;const r=n.popper.querySelector("#href").value;if(r.trim()===""){(o=this.editor)==null||o.chain().focus().extendMarkRange("link").unsetLink().run();return}let i=n.popper.querySelector("#target").value;i.trim()===""&&(i=null),(a=this.editor)==null||a.chain().focus().extendMarkRange("link").setLink({href:r,target:i,rel:null}).run()}),e.onShow(n=>{var i;const r=(i=this.editor)==null?void 0:i.getAttributes("link");r&&r.href?n.popper.querySelector("#href").value=r.href:n.popper.querySelector("#href").value="",r&&r.target?n.popper.querySelector("#target").value=r.target:n.popper.querySelector("#target").value=""}),e.setTrigger(this.querySelector("div"),"bottom")}onActive(e){return e.isActive("link")}};const Sl=t=>{const e=document.createElement("div");return e.innerHTML=t,e.firstElementChild},xv=(t,e)=>{const n=new RegExp(`<${e}[^>]*>(.*?)</${e}>`,"gi");return t.replace(n,(r,i)=>i)},Dv=(t,e)=>{for(let n of e)t=xv(t,n);return t},wv=(t,e,n)=>{function r(u){const d=document.createDocumentFragment();for(;u.firstChild;){const p=u.removeChild(u.firstChild),_=i(p);_&&d.appendChild(_)}return d}function i(u){var d;if(u.nodeType===Node.ELEMENT_NODE){const p=u;if(e.includes(p.tagName.toLowerCase())){if(!(((d=p.textContent)==null?void 0:d.trim())||""))return p;for(;p.attributes.length>0;)p.removeAttribute(p.attributes[0].name);return p.appendChild(r(p)),p}else return r(p)}else if(u.nodeType===Node.TEXT_NODE&&u.textContent&&u.textContent.trim().length>0)return u;return null}function o(u){const d=u.querySelectorAll("br");for(let p=0;p<d.length-1;p++){const _=d[p],m=d[p+1];if(_.nextSibling===m){let f=_.previousSibling;const h=[];for(;f&&f.nodeName!=="P";)h.unshift(f),f=f.previousSibling;const E=document.createElement("p");h.forEach(S=>E.appendChild(S)),_.replaceWith(E),m.remove(),p++}}}t=t.replace(/(\n)/gm," ");const s=new DOMParser().parseFromString(t,"text/html"),l=i(s.body),c=document.createElement("div");return l&&(c.appendChild(l),o(c)),c.innerHTML},Mv=t=>{var i;const e=t.documentElement.getAttributeNames();if(e&&e.length>0)for(let o of e){const a=t.documentElement.getAttribute(o);if(a!=null&&a.includes("microsoft")||a!=null&&a.includes("excel"))return!0}let n=t.getElementsByTagName("meta");for(let o of n){let a=o.getAttribute("name"),s=o.getAttribute("content");if(a&&a.toLowerCase()==="generator"&&(s!=null&&s.includes("Microsoft")||s!=null&&s.includes("LibreOffice")||s!=null&&s.includes("OpenOffice")))return!0}const r=(i=t.body.innerHTML)==null?void 0:i.trim();return!!(r!=null&&r.startsWith("<table")&&(r!=null&&r.endsWith("</table>")))},Lv=t=>{const e=document.createElement("div");return e.innerHTML=t,e.querySelectorAll("p").forEach(r=>{(!r.textContent||r.textContent.trim()==="")&&(r.querySelector("img")||r.remove())}),e.innerHTML},kv=t=>["table","thead","tbody","tr","th","td","ul","ol","li","pre","blockquote","figure","iframe","video","audio","svg","math","embed"].includes(t.tagName.toLowerCase()),Pv=t=>{const n=new DOMParser().parseFromString(t,"text/html"),r=document.createDocumentFragment(),i=n.body.children;for(let a of i){if(kv(a)){r.appendChild(a.cloneNode(!0));continue}a.hasAttribute("data-pm-slice")?a.childNodes.forEach(s=>{r.appendChild(s.cloneNode(!0))}):r.appendChild(a.cloneNode(!0))}const o=document.createElement("div");return o.appendChild(r),o.innerHTML},Bi=t=>{if(!t)return"";const n=new DOMParser().parseFromString(t,"text/html"),r=n.querySelectorAll("ul");r&&r.length>0&&r.forEach(l=>{var c;if((c=l.getAttribute("class"))!=null&&c.includes("task-list")){l.getAttributeNames().forEach(p=>{l.removeAttribute(p)}),l.setAttribute("data-type","taskList");const u=l.firstElementChild;if((u==null?void 0:u.tagName)==="P"){const p=document.createDocumentFragment();u.childNodes.forEach(_=>{p.append(_.cloneNode(!0))}),u.replaceWith(p)}l.querySelectorAll("li").forEach(p=>{p.getAttributeNames().forEach(m=>{l.removeAttribute(m)});const _=p.querySelector("input[type='checkbox']");_&&(p.setAttribute("data-type","taskItem"),p.setAttribute("data-checked",_.hasAttribute("checked")?"true":"false"))})}});const i=n.querySelectorAll("li");i&&i.length>0&&i.forEach(l=>{l.innerHTML||(l.innerHTML="<p></p>")});const o=n.querySelectorAll("body>p>img");if(o.length>0){const l=n.querySelector("body");for(const c of o){const u=c.parentNode,d=Array.prototype.indexOf.call(l.children,u);l.insertBefore(c,l.children[d])}}const a=n.querySelectorAll("table");a.length>0&&a.forEach(l=>{bu(l)});let s="";return n.body.childNodes.forEach(l=>{if(l.nodeType===Node.TEXT_NODE)s+=l.textContent;else if(l.nodeType===Node.ELEMENT_NODE){const c=l;c.querySelector("img")&&c.tagName!=="A"&&c.tagName!=="TABLE"?s+=c.innerHTML:s+=c.outerHTML}}),s},Fv=t=>{if(!t)return"";const n=new DOMParser().parseFromString(t.trim(),"text/html");let r="";return n.body.childNodes.forEach(i=>{if(i.nodeType===Node.TEXT_NODE)r+=i.textContent;else if(i.nodeType===Node.ELEMENT_NODE){const o=i;o===n.body.firstChild&&o.tagName==="P"?r+=o.innerHTML:r+=o.outerHTML}}),r},Bv=t=>{const n=new DOMParser().parseFromString(t,"text/html");return n.querySelectorAll("table").forEach(i=>{bu(i)}),n.body.innerHTML},bu=t=>{if(t.nodeType===Node.ELEMENT_NODE){const e=t;if(["TABLE","THEAD","TBODY","TFOOT","TR","COLGROUP","COL"].includes(e.tagName)&&Array.from(e.childNodes).forEach(i=>{i.nodeType===Node.TEXT_NODE?/^[\s\n\r]*$/.test(i.textContent||"")&&e.removeChild(i):bu(i)}),(e.tagName==="TD"||e.tagName==="TH")&&!e.hasChildNodes()){const r=document.createElement("p");e.appendChild(r)}}};class Uv extends fe{constructor(){super(),this.template=`
231231
<div>
232232
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 4C2 3.44772 2.44772 3 3 3H21C21.5523 3 22 3.44772 22 4V20C22 20.5523 21.5523 21 21 21H3C2.44772 21 2 20.5523 2 20V4ZM4 19H20V9H4V19ZM11 13H6V17H11V13Z"></path></svg>
233233
</div>

dist/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16231,7 +16231,7 @@ const Sl = (t) => {
1623116231
s += l.textContent;
1623216232
else if (l.nodeType === Node.ELEMENT_NODE) {
1623316233
const c = l;
16234-
c.querySelector("img") && c.tagName !== "A" ? s += c.innerHTML : s += c.outerHTML;
16234+
c.querySelector("img") && c.tagName !== "A" && c.tagName !== "TABLE" ? s += c.innerHTML : s += c.outerHTML;
1623516235
}
1623616236
}), s;
1623716237
}, wv = (t) => {

docs/changes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# AiEditor ChangeLog
22

3+
4+
## v1.4.0 20250625:
5+
- feat: Added video attributes autoplay, loop, muted, preload
6+
- feat: Upgraded related dependencies to the latest version
7+
- fix: Fixed the issue that the video does not display in read-only mode
8+
- fix: Fixed the issue that the video attributes poster and controls do not take effect
9+
- fix: In the code block, the issue that the pasted code does not display
10+
- fix: fixed when pasting images in a table, the table is lost when data is backfilled
11+
12+
---
13+
- 新增:新增视频属性 autoplay, loop, muted, preload
14+
- 优化:升级相关依赖到最新版本
15+
- 修复:修复只读模式下,视频不显示的问题
16+
- 修复:修复视频属性 poster、controls 不生效问题
17+
- 修复:在代码块中,粘贴代码不显示的问题
18+
- 修复:在 table 内粘贴图片时,当数据回填的时候 table 丢失的问题
19+
20+
21+
322
## v1.3.9 20250603:
423
- fix: fixed paste in new line if pasteAsText options enable
524
- fix: fix: fixed Uncaught RangeError: Invalid content for node tableCell: `<>`

docs/zh/changes.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,24 @@
11
# AiEditor ChangeLog
22

3+
4+
## v1.4.0 20250625:
5+
- feat: Added video attributes autoplay, loop, muted, preload
6+
- feat: Upgraded related dependencies to the latest version
7+
- fix: Fixed the issue that the video does not display in read-only mode
8+
- fix: Fixed the issue that the video attributes poster and controls do not take effect
9+
- fix: In the code block, the issue that the pasted code does not display
10+
- fix: fixed when pasting images in a table, the table is lost when data is backfilled
11+
12+
---
13+
- 新增:新增视频属性 autoplay, loop, muted, preload
14+
- 优化:升级相关依赖到最新版本
15+
- 修复:修复只读模式下,视频不显示的问题
16+
- 修复:修复视频属性 poster、controls 不生效问题
17+
- 修复:在代码块中,粘贴代码不显示的问题
18+
- 修复:在 table 内粘贴图片时,当数据回填的时候 table 丢失的问题
19+
20+
21+
322
## v1.3.9 20250603:
423
- fix: fixed paste in new line if pasteAsText options enable
524
- fix: fix: fixed Uncaught RangeError: Invalid content for node tableCell: `<>`

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "aieditor",
33
"author": "yangfuhai",
4-
"version": "1.3.9",
4+
"version": "1.4.0",
55
"type": "module",
66
"keywords": [
77
"editor",

0 commit comments

Comments
 (0)