This commit is contained in:
2024-05-24 11:03:42 +08:00
parent ce89cd4052
commit 65b7669bf5
3 changed files with 39 additions and 16 deletions

View File

@ -89,6 +89,7 @@ export default ({
addnode: { addnode: {
fileName: '', fileName: '',
fileSpan: '', fileSpan: '',
fieldMark: "",
}, },
modify: false, modify: false,
} }
@ -107,6 +108,7 @@ export default ({
if (el.labelFieldId == item[1]) { if (el.labelFieldId == item[1]) {
this.addnode.fileSpan = el.fieldName this.addnode.fileSpan = el.fieldName
this.addnode.fileName = e.fieldName this.addnode.fileName = e.fieldName
this.addnode.fieldMark = el.fieldMark
} }
}) })
}) })
@ -116,6 +118,7 @@ export default ({
if (el.labelFieldId == item[1]) { if (el.labelFieldId == item[1]) {
this.addnode.fileSpan = el.fieldName this.addnode.fileSpan = el.fieldName
this.addnode.fileName = e.fieldName this.addnode.fileName = e.fieldName
this.addnode.fieldMark = el.fieldMark
} }
}) })
}) })
@ -135,6 +138,7 @@ export default ({
type: 'attachment', type: 'attachment',
link: '', link: '',
fileName: this.addnode.fileName, fileName: this.addnode.fileName,
fieldMark: this.addnode.fieldMark,
fileSpan: this.addnode.fileSpan, fileSpan: this.addnode.fileSpan,
children: [{ text: '' }], // void children children: [{ text: '' }], // void children
} }
@ -142,6 +146,7 @@ export default ({
this.addnode = { this.addnode = {
fileName: '', fileName: '',
fileSpan: '', fileSpan: '',
fieldMark: "",
} }
this.editor.focus() this.editor.focus()
}, 100); }, 100);
@ -160,6 +165,7 @@ export default ({
type: 'attachmenttwo', type: 'attachmenttwo',
link: '', link: '',
fileName: this.addnode.fileName, fileName: this.addnode.fileName,
fieldMark: this.addnode.fieldMark,
fileSpan: this.addnode.fileSpan, fileSpan: this.addnode.fileSpan,
children: [{ text: '' }], // void children children: [{ text: '' }], // void children
} }
@ -167,6 +173,7 @@ export default ({
this.addnode = { this.addnode = {
fileName: '', fileName: '',
fileSpan: '', fileSpan: '',
fieldMark: "",
} }
this.editor.focus() this.editor.focus()
}, 100); }, 100);
@ -206,9 +213,7 @@ export default ({
}, },
watch: { watch: {
nodeContent(newValue, oldValue) { nodeContent(newValue, oldValue) {
if (newValue) { this.html = newValue;
this.html = newValue;
}
} }
}, },
mounted() { mounted() {
@ -311,7 +316,7 @@ function withAttachment(editor) { // JS 语法
Boot.registerPlugin(withAttachment) Boot.registerPlugin(withAttachment)
function renderAttachment(elem, children, editor) { // JS function renderAttachment(elem, children, editor) { // JS
// myResume // myResume
const { fileName = '', link = '', fileSpan = '' } = elem const { fileName = '', link = '', fileSpan = '', fieldMark = '' } = elem
// icon vnode // icon vnode
const iconVnode = h( const iconVnode = h(
// HTML tag // HTML tag
@ -387,7 +392,7 @@ function renderAttachment(elem, children, editor) {
} }
function renderAttachmenttwo(elem, children, editor) { // JS function renderAttachmenttwo(elem, children, editor) { // JS
// myResume // myResume
const { fileName = '', link = '', fileSpan = '' } = elem const { fileName = '', link = '', fileSpan = '', fieldMark = '' } = elem
// icon vnode // icon vnode
const iconVnode = h( const iconVnode = h(
// HTML tag // HTML tag
@ -480,13 +485,14 @@ const rendermodule = { // JS 语法
Boot.registerModule(rendermodule) Boot.registerModule(rendermodule)
function attachmentToHtml(elem, childrenHtml) { // JS function attachmentToHtml(elem, childrenHtml) { // JS
// //
const { link = '', fileName = '', fileSpan = '' } = elem const { link = '', fileName = '', fileSpan = '', fieldMark = '' } = elem
// HTML // HTML
const html = `<span data-w-e-type="attachment" const html = `<span data-w-e-type="attachment"
data-w-e-is-void data-w-e-is-void
data-w-e-is-inline data-w-e-is-inline
data-link="${link}" data-link="${link}"
data-fileSpan="${fileSpan}" data-fileSpan="${fileSpan}"
data-fieldMark="${fieldMark}"
data-fileName="${fileName}"> data-fileName="${fileName}">
<span class="path-tag-wrap"> <span class="path-tag-wrap">
<span>${fileName}</span> <span>${fileName}</span>
@ -497,13 +503,14 @@ function attachmentToHtml(elem, childrenHtml) { // JS 语法
} }
function attachmentToHtmltwo(elem, childrenHtml) { // JS function attachmentToHtmltwo(elem, childrenHtml) { // JS
// //
const { link = '', fileName = '', fileSpan = '' } = elem const { link = '', fileName = '', fileSpan = '', fieldMark = '' } = elem
// HTML // HTML
const html = `<span data-w-e-type="attachmenttwo" const html = `<span data-w-e-type="attachmenttwo"
data-w-e-is-void data-w-e-is-void
data-w-e-is-inline data-w-e-is-inline
data-link="${link}" data-link="${link}"
data-fileSpan="${fileSpan}" data-fileSpan="${fileSpan}"
data-fieldMark="${fieldMark}"
data-fileName="${fileName}"> data-fileName="${fileName}">
<span class="path-tag-wrap"> <span class="path-tag-wrap">
<span>${fileName}</span> <span>${fileName}</span>
@ -529,12 +536,14 @@ function parseAttachmentHtml(domElem, children, editor) {
const link = domElem.getAttribute('data-link') || '' const link = domElem.getAttribute('data-link') || ''
const fileName = domElem.getAttribute('data-fileName') || '' const fileName = domElem.getAttribute('data-fileName') || ''
const fileSpan = domElem.getAttribute('data-fileSpan') || '' const fileSpan = domElem.getAttribute('data-fileSpan') || ''
const fieldMark = domElem.getAttribute('data-fieldMark') || ''
// //
const myResume = { const myResume = {
type: 'attachment', type: 'attachment',
link, link,
fileName, fileName,
fileSpan, fileSpan,
fieldMark,
children: [{ text: '' }], // void node children children: [{ text: '' }], // void node children
} }
return myResume return myResume
@ -544,11 +553,13 @@ function parseAttachmentHtmltwo(domElem, children, editor) {
const link = domElem.getAttribute('data-link') || '' const link = domElem.getAttribute('data-link') || ''
const fileName = domElem.getAttribute('data-fileName') || '' const fileName = domElem.getAttribute('data-fileName') || ''
const fileSpan = domElem.getAttribute('data-fileSpan') || '' const fileSpan = domElem.getAttribute('data-fileSpan') || ''
const fieldMark = domElem.getAttribute('data-fieldMark') || ''
// //
const myResume = { const myResume = {
type: 'attachmenttwo', type: 'attachmenttwo',
link, link,
fileName, fileName,
fieldMark,
fileSpan, fileSpan,
children: [{ text: '' }], // void node children children: [{ text: '' }], // void node children
} }

View File

@ -442,7 +442,7 @@ export default {
required: true, required: true,
trigger: "blur", trigger: "blur",
validator: validateInput // validator: validateInput
}, },
// { pattern:/^$W*$/, message: '$', trigger: 'blur' } // { pattern:/^$W*$/, message: '$', trigger: 'blur' }
], ],
@ -479,7 +479,7 @@ export default {
required: true, required: true,
// message: "", // message: "",
trigger: "blur", trigger: "blur",
validator: validateInput // validator: validateInput
}, },
], ],

View File

@ -89,6 +89,7 @@ export default ({
addnode: { addnode: {
fileName: '', fileName: '',
fileSpan: '', fileSpan: '',
fieldMark: "",
}, },
modify: false, modify: false,
} }
@ -104,6 +105,7 @@ export default ({
if (el.labelFieldId == item[1]) { if (el.labelFieldId == item[1]) {
this.addnode.fileSpan = el.fieldName this.addnode.fileSpan = el.fieldName
this.addnode.fileName = e.fieldName this.addnode.fileName = e.fieldName
this.addnode.fieldMark = el.fieldMark
} }
}) })
}) })
@ -113,6 +115,7 @@ export default ({
if (el.labelFieldId == item[1]) { if (el.labelFieldId == item[1]) {
this.addnode.fileSpan = el.fieldName this.addnode.fileSpan = el.fieldName
this.addnode.fileName = e.fieldName this.addnode.fileName = e.fieldName
this.addnode.fieldMark = el.fieldMark
} }
}) })
}) })
@ -133,12 +136,14 @@ export default ({
link: '', link: '',
fileName: this.addnode.fileName, fileName: this.addnode.fileName,
fileSpan: this.addnode.fileSpan, fileSpan: this.addnode.fileSpan,
fieldMark: this.addnode.fieldMark,
children: [{ text: '' }], // void children children: [{ text: '' }], // void children
} }
this.editor.insertNode(resume) this.editor.insertNode(resume)
this.addnode = { this.addnode = {
fileName: '', fileName: '',
fileSpan: '', fileSpan: '',
fieldMark: '',
} }
this.editor.focus() this.editor.focus()
}, 100); }, 100);
@ -158,11 +163,13 @@ export default ({
link: '', link: '',
fileName: this.addnode.fileName, fileName: this.addnode.fileName,
fileSpan: this.addnode.fileSpan, fileSpan: this.addnode.fileSpan,
fieldMark: this.addnode.fieldMark,
children: [{ text: '' }], // void children children: [{ text: '' }], // void children
} }
this.editor.insertNode(resume) this.editor.insertNode(resume)
this.addnode = { this.addnode = {
fileName: '', fileName: '',
fieldMark: '',
fileSpan: '', fileSpan: '',
} }
this.editor.focus() this.editor.focus()
@ -205,9 +212,8 @@ export default ({
}, },
watch: { watch: {
nodeContent(newValue, oldValue) { nodeContent(newValue, oldValue) {
if (newValue) { console.log(newValue, oldValue)
this.html = newValue; this.html = newValue;
}
} }
}, },
mounted() { mounted() {
@ -310,7 +316,7 @@ function withAttachment(editor) { // JS 语法
Boot.registerPlugin(withAttachment) Boot.registerPlugin(withAttachment)
function renderAttachment(elem, children, editor) { // JS function renderAttachment(elem, children, editor) { // JS
// myResume // myResume
const { fileName = '', link = '', fileSpan = '' } = elem const { fileName = '', link = '', fileSpan = '', fieldMark } = elem
// icon vnode // icon vnode
const iconVnode = h( const iconVnode = h(
// HTML tag // HTML tag
@ -386,7 +392,7 @@ function renderAttachment(elem, children, editor) {
} }
function renderAttachmenttwo(elem, children, editor) { // JS function renderAttachmenttwo(elem, children, editor) { // JS
// myResume // myResume
const { fileName = '', link = '', fileSpan = '' } = elem const { fileName = '', link = '', fileSpan = '', fieldMark = '' } = elem
// icon vnode // icon vnode
const iconVnode = h( const iconVnode = h(
// HTML tag // HTML tag
@ -479,13 +485,14 @@ const rendermodule = { // JS 语法
Boot.registerModule(rendermodule) Boot.registerModule(rendermodule)
function attachmentToHtml(elem, childrenHtml) { // JS function attachmentToHtml(elem, childrenHtml) { // JS
// //
const { link = '', fileName = '', fileSpan = '' } = elem const { link = '', fileName = '', fileSpan = '', fieldMark = '' } = elem
// HTML // HTML
const html = `<span data-w-e-type="attachment" const html = `<span data-w-e-type="attachment"
data-w-e-is-void data-w-e-is-void
data-w-e-is-inline data-w-e-is-inline
data-link="${link}" data-link="${link}"
data-fileSpan="${fileSpan}" data-fileSpan="${fileSpan}"
data-fieldMark="${fieldMark}"
data-fileName="${fileName}"> data-fileName="${fileName}">
<span class="path-tag-wrap"> <span class="path-tag-wrap">
<span>${fileName}</span> <span>${fileName}</span>
@ -496,13 +503,14 @@ function attachmentToHtml(elem, childrenHtml) { // JS 语法
} }
function attachmentToHtmltwo(elem, childrenHtml) { // JS function attachmentToHtmltwo(elem, childrenHtml) { // JS
// //
const { link = '', fileName = '', fileSpan = '' } = elem const { link = '', fileName = '', fileSpan = '', fieldMark = '' } = elem
// HTML // HTML
const html = `<span data-w-e-type="attachmenttwo" const html = `<span data-w-e-type="attachmenttwo"
data-w-e-is-void data-w-e-is-void
data-w-e-is-inline data-w-e-is-inline
data-link="${link}" data-link="${link}"
data-fileSpan="${fileSpan}" data-fileSpan="${fileSpan}"
data-fieldMark="${fieldMark}"
data-fileName="${fileName}"> data-fileName="${fileName}">
<span class="path-tag-wrap"> <span class="path-tag-wrap">
<span>${fileName}</span> <span>${fileName}</span>
@ -528,12 +536,14 @@ function parseAttachmentHtml(domElem, children, editor) {
const link = domElem.getAttribute('data-link') || '' const link = domElem.getAttribute('data-link') || ''
const fileName = domElem.getAttribute('data-fileName') || '' const fileName = domElem.getAttribute('data-fileName') || ''
const fileSpan = domElem.getAttribute('data-fileSpan') || '' const fileSpan = domElem.getAttribute('data-fileSpan') || ''
const fieldMark = domElem.getAttribute('data-fieldMark') || ''
// //
const myResume = { const myResume = {
type: 'attachment', type: 'attachment',
link, link,
fileName, fileName,
fileSpan, fileSpan,
fieldMark,
children: [{ text: '' }], // void node children children: [{ text: '' }], // void node children
} }
return myResume return myResume
@ -543,12 +553,14 @@ function parseAttachmentHtmltwo(domElem, children, editor) {
const link = domElem.getAttribute('data-link') || '' const link = domElem.getAttribute('data-link') || ''
const fileName = domElem.getAttribute('data-fileName') || '' const fileName = domElem.getAttribute('data-fileName') || ''
const fileSpan = domElem.getAttribute('data-fileSpan') || '' const fileSpan = domElem.getAttribute('data-fileSpan') || ''
const fieldMark = domElem.getAttribute('data-fieldMark') || ''
// //
const myResume = { const myResume = {
type: 'attachmenttwo', type: 'attachmenttwo',
link, link,
fileName, fileName,
fileSpan, fileSpan,
fieldMark,
children: [{ text: '' }], // void node children children: [{ text: '' }], // void node children
} }
return myResume return myResume