@qxs-bns/components-wc 0.0.2 → 0.0.4

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.
@@ -1 +1 @@
1
- {"version":3,"file":"text-fill.mjs","sources":["../../../../packages/components-wc/src/subject/text-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\n\ninterface TextAnswer { title: string, tag: string, showInput: boolean }\n\nconst TAG_COLORS = [\n { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' }, // primary\n { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' }, // success\n { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' }, // warning\n { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' }, // danger\n { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' }, // info\n]\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-text-fill')\nexport class QxsTextFill extends LitElement {\n private readonly _iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\n private readonly _iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\n\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = false\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean, keywordCount: number } = { isInOrder: true, isIgnoreCase: true, keywordCount: 1 }\n\n @property({ type: Array, attribute: 'answer-list' }) answerList: any[] = []\n\n @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _isInOrder = true\n @state() private _isIgnoreCase = true\n @state() private _keywordCount = 1\n @state() private _correct = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 200\n\n updated(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n this._keywordCount = this.examAnswerSetting.keywordCount || 1\n }\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\n if (this.examExpand) {\n this._correct = this.examExpand\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n }\n\n private _addTag(i: number) {\n const a = { ...this._answers[i] }\n if (a.tag) {\n a.title = a.title ? [a.title, a.tag].join(',') : a.tag\n a.tag = ''\n }\n a.showInput = false\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n private _closeTag(tag: string, i: number) {\n const a = { ...this._answers[i] }\n a.title = a.title.split(',').filter(t => t !== tag).join(',')\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 2 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\n }\n\n private _save(e?: Event) {\n e?.stopImmediatePropagation()\n if (!this._title) { showToast('题目标题不能为空!'); return }\n if (this._keywordCount || this._correct) {\n if (!this._keywordCount) { showToast('请完善答题设置!'); return }\n if (!this._correct) { showToast('请输入问题正确答案!'); return }\n if (this._answers.length !== this._keywordCount) { showToast('关键词个数设置有误!'); return }\n const msg: string[] = []\n this._answers.forEach((item, i) => {\n if (!item.title) { msg.push(`关键词${i + 1}未设置`) }\n })\n if (msg.length) { showToast(msg.join(',')); return }\n }\n this._emit('save', {\n title: this._title,\n answers: this._answers.filter(a => a.title).map(a => ({ title: a.title })),\n analysis: this._analysis,\n isSetCorrectAnswer: !!this._correct,\n isKey: this.isKey,\n examExpand: this._correct,\n examAnswerSettingBO: { isIgnoreCase: this._isIgnoreCase, isInOrder: this._isInOrder, keywordCount: this._keywordCount },\n examRichTextContent: this._showRichText ? this._richText : '',\n })\n }\n\n private _renderPreview() {\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${this.title}(问答题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div style=\"margin-top:8px;color:#a8abb2\">\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">关键词${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this._correct ? html`<div style=\"margin-top:8px;color:#a8abb2\">正确答案:${this._correct}</div>` : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【问答题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <div style=\"flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px\">\n <span style=\"font-size:13px;color:#606266\">共答对</span>\n <input type=\"number\" style=\"width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px\"\n .value=${String(this._keywordCount)} min=\"1\"\n @change=${(e: Event) => { this._keywordCount = Number((e.target as HTMLInputElement).value) }} />\n <span style=\"font-size:13px;color:#606266\">个关键词,算是正确的</span>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答案:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._correct} ?disabled=${this.isSave}\n maxlength=\"200\"\n @input=${(e: Event) => { this._correct = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入正确答案\"></textarea>\n <span class=\"char-counter\">${this._correct.length}/200</span>\n </div>\n </div>\n </div>\n\n <div class=\"answer-list\" style=\"margin-top:12px\">\n <span style=\"padding-left:60px;font-size:12px;color:#909399\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">关键词${i + 1}:</span>\n <div class=\"answer-tags\" style=\"display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px\">\n ${a.title.split(',').filter(Boolean).map((tag) => {\n const c = TAG_COLORS[i % TAG_COLORS.length]; return html`\n <span style=\"display:inline-flex;align-items:center;background:${c.bg};color:${c.color};border:1px solid ${c.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px\">\n ${tag}\n ${!this.isSave ? html`<span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, i)}>×</span>` : ''}\n </span>\n `\n })}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" style=\"width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._addTag(i) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._addTag(i)} />\n <button class=\"el-link\" @click=${() => this._addTag(i)}>确认</button>\n `\n : html`\n <button class=\"link\" @click=${() => { this._answers = this._answers.map((x, j) => j === i ? { ...x, showInput: true } : x); this.updateComplete.then(() => { (this.shadowRoot?.querySelector(`input[style*=\"width:80px\"]`) as HTMLInputElement)?.focus() }) }}>\n ${a.title ? '添加同义词' : '添加关键词'}\n </button>\n `}\n `\n : ''}\n </div>\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n <span class=\"icon ${this.isSave || this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(i)}>${this._iconRemove}</span>\n </div>\n `)}\n </div>\n\n ${this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n content=${this._richText}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["TAG_COLORS","bg","color","border","showToast","msg","el","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","orderIndex","title","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","keywordCount","answerList","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","TITLE_MAX","updated","changed","has","_syncProps","length","map","a","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","e","target","value","slice","_addTag","i","join","x","j","_closeTag","split","filter","t","_addAnswer","_deleteAnswer","index","_","_save","stopImmediatePropagation","forEach","item","push","answers","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_renderPreview","some","_renderEdit","String","Number","checked","Boolean","c","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","attribute","prototype","Array","state","safeCustomElement"],"mappings":"qjBAMA,MAAMA,EAAa,CACjB,CAAEC,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,YAG7C,SAASC,EAAUC,GACjB,MAAMC,EAAKC,SAASC,cAAc,OAClCF,EAAGG,YAAcJ,EACjBK,OAAOC,OAAOL,EAAGM,MAAO,CACtBC,SAAU,QAASC,IAAK,OAAQC,KAAM,MAAOC,UAAW,mBACxDC,QAAS,YAAaC,aAAc,MAAOC,SAAU,OAAQjB,MAAO,OACpEkB,WAAY,UAAWC,OAAQ,QAASC,UAAW,6BACnDC,WAAY,cAAeC,QAAS,MAEtCjB,SAASkB,KAAKC,YAAYpB,GAC1BqB,WAAW,KAAQrB,EAAGM,MAAMY,QAAU,IAAKG,WAAW,IAAMrB,EAAGsB,SAAU,MAAQ,KACnF,CAGO,IAAMC,EAAN,cAA0BC,EAA1BC,WAAAA,GAAAC,SAAAC,WACLC,KAAiBC,UAAYC,CAAA,2NAC7BF,KAAiBG,YAAcD,CAAA,qLA6FuBF,KAAAI,WAAa,EACvCJ,KAAAK,MAAQ,GACeL,KAAAM,QAAS,EACTN,KAAAO,QAAS,EACVP,KAAAQ,OAAQ,EACRR,KAAAS,OAAQ,EACHT,KAAAU,YAAa,EACXV,KAAAW,cAAe,EACZX,KAAAY,gBAAkB,GAClDZ,KAAAa,SAAW,GAC6Bb,KAAAc,uBAAyB,EACvCd,KAAAe,WAAa,GAEnEf,KAAAgB,kBAAyF,CAAEC,WAAW,EAAMC,cAAc,EAAMC,aAAc,GAEzFnB,KAAAoB,WAAo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MoG,UAAA,YAAA,GAxHNpG,EAANgG,EAAA,CADNO,EAAkB,kBACNvG"}
1
+ {"version":3,"file":"text-fill.mjs","sources":["../../../../packages/components-wc/src/subject/text-fill.ts"],"sourcesContent":["import { css, html, LitElement } from 'lit'\nimport { property, state } from 'lit/decorators.js'\nimport { safeCustomElement } from '../base/define'\nimport { SubjectError } from './single'\n\ninterface TextAnswer { title: string, tag: string, showInput: boolean }\n\nconst TAG_COLORS = [\n { bg: '#ecf5ff', color: '#3D61E3', border: '#d9ecff' }, // primary\n { bg: '#f0f9eb', color: '#67c23a', border: '#c2e7b0' }, // success\n { bg: '#fdf6ec', color: '#e6a23c', border: '#faecd8' }, // warning\n { bg: '#fef0f0', color: '#f56c6c', border: '#fde2e2' }, // danger\n { bg: '#f4f4f5', color: '#909399', border: '#e9e9eb' }, // info\n]\n\nfunction showToast(msg: string) {\n const el = document.createElement('div')\n el.textContent = msg\n Object.assign(el.style, {\n position: 'fixed', top: '20px', left: '50%', transform: 'translateX(-50%)',\n padding: '10px 20px', borderRadius: '4px', fontSize: '13px', color: '#fff',\n background: '#f56c6c', zIndex: '99999', boxShadow: '0 4px 12px rgba(0,0,0,.15)',\n transition: 'opacity .3s', opacity: '1',\n })\n document.body.appendChild(el)\n setTimeout(() => { el.style.opacity = '0'; setTimeout(() => el.remove(), 300) }, 2500)\n}\n\n@safeCustomElement('qxs-text-fill')\nexport class QxsTextFill extends LitElement {\n private readonly _iconPlus = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"12\" y1=\"5\" x2=\"12\" y2=\"19\"/><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\n private readonly _iconRemove = html`<svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><line x1=\"5\" y1=\"12\" x2=\"19\" y2=\"12\"/></svg>`\n\n static styles = css`\n :host { display: block; font-family: system-ui, -apple-system, \"PingFang SC\", \"Microsoft YaHei\", sans-serif; font-size: 12px; color: #5a5a5a; }\n *, ::before, ::after { box-sizing: border-box; }\n\n .preview { padding: 12px 0; }\n .preview .title { font-size: 14px; color: #303133; }\n .preview .rich-text { margin-top: 8px; }\n .preview .rich-text img { max-width: 100%; }\n .preview-answer { display: flex; flex-direction: column; margin-top: 12px; }\n .preview-answer .radio { margin-top: 8px; padding-left: 8px; display: flex; align-items: center; gap: 6px; }\n .preview-answer .order { color: #909399; }\n .preview-answer .correct { color: #67c23a; }\n .preview-answer .result-info { color: #909399; }\n\n .flex { display: flex; }\n .flex-items-center { display: flex; align-items: center; }\n .flex-items-start { display: flex; align-items: flex-start; }\n .flex-justify-end { display: flex; justify-content: flex-end; }\n .label { min-width: 60px; font-size: 13px; color: #606266; }\n\n textarea {\n border: 1px solid #dcdfe6; border-radius: 3px; padding: 5px 11px;\n font-size: 13px; font-family: inherit; width: 100%; resize: none; transition: border-color .2s;\n line-height: 1.5; display: block; box-sizing: border-box;\n }\n textarea:focus { border-color: #3D61E3; outline: none; }\n textarea:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .el-input { position: relative; display: block; }\n .el-input textarea { padding-bottom: 24px; }\n .el-input .char-counter {\n position: absolute; right: 12px; bottom: 8px;\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-list { margin-top: 12px; }\n .answer-item { display: flex; align-items: center; margin-top: 6px; border-radius: 4px; }\n .answer-item .label { min-width: 60px; font-size: 13px; color: #909399; }\n .answer-item .input { flex: 1; max-width: 360px; position: relative; display: block; }\n .answer-item .input input {\n height: 32px; padding: 0 50px 0 8px;\n font-size: 13px; line-height: 32px;\n border: 1px solid #dcdfe6; border-radius: 3px; width: 100%;\n transition: border-color .2s; box-sizing: border-box;\n }\n .answer-item .input input:focus { border-color: #3D61E3; outline: none; }\n .answer-item .input input:disabled { background: #f5f7fa; color: #c0c4cc; cursor: not-allowed; }\n .answer-item .input .char-counter {\n position: absolute; right: 8px; top: 50%; transform: translateY(-50%);\n font-size: 12px; color: #909399; line-height: 1; pointer-events: none;\n }\n\n .answer-item .correct { margin: 0 10px; color: #909399; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }\n .answer-item .correct:hover { color: #3D61E3; }\n .answer-item .correct.is-correct { color: #67c23a; }\n .answer-item .correct input { width: 14px; height: 14px; cursor: pointer; accent-color: #3D61E3; }\n\n .answer-item .icon {\n margin-left: 6px; cursor: pointer; display: inline-flex;\n align-items: center; justify-content: center;\n width: 24px; height: 24px; border-radius: 4px;\n border: 1px solid #dcdfe6; background: #fff; color: #909399;\n transition: all 0.2s;\n }\n .answer-item .icon:hover { color: #3D61E3; border-color: #3D61E3; background: #ecf5ff; }\n .answer-item .icon.disabled { color: #e4e7ed; border-color: #e4e7ed; cursor: not-allowed; }\n\n .answer-item .link { margin-left: 8px; color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .answer-item .link { color: #3D61E3; cursor: pointer; font-size: 12px; white-space: nowrap; background: none; border: none; padding: 0; margin: 0; font-family: inherit; }\n .answer-item .link:hover { color: #2D4CB8; }\n\n .el-link { color: #3D61E3; cursor: pointer; font-size: 12px; background: none; border: none; padding: 0; margin: 0; font-family: inherit; line-height: 1; }\n .el-link:hover { color: #2D4CB8; }\n .el-link.danger { color: #f56c6c; }\n\n .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 9000; display: flex; align-items: center; justify-content: center; }\n .modal { background: #fff; border-radius: 6px; width: 520px; max-width: 90vw; box-shadow: 0 12px 32px rgba(0,0,0,.12); display: flex; flex-direction: column; }\n .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px 12px; border-bottom: 1px solid #e4e7ed; }\n .modal-title { font-size: 14px; font-weight: 600; color: #303133; }\n .modal-close { background: none; border: none; font-size: 18px; cursor: pointer; color: #909399; padding: 0; line-height: 1; }\n .modal-close:hover { color: #3D61E3; }\n .modal-body { padding: 20px; }\n .modal-body textarea { min-height: 120px; }\n .modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid #e4e7ed; }\n .modal-footer button { padding: 6px 16px; font-size: 12px; border-radius: 3px; cursor: pointer; border: 1px solid #dcdfe6; background: #fff; color: #606266; }\n .modal-footer button:hover { color: #3D61E3; border-color: #a0cfff; }\n .modal-footer button.primary { background: #3D61E3; border-color: #3D61E3; color: #fff; }\n .modal-footer button.primary:hover { background: #2D4CB8; border-color: #2D4CB8; }\n `\n\n @property({ type: Number, attribute: 'order-index' }) orderIndex = 0\n @property({ type: String }) title = ''\n @property({ type: String, attribute: 'custom-id' }) customId = ''\n @property({ type: Boolean, attribute: 'is-edit' }) isEdit = false\n @property({ type: Boolean, attribute: 'is-save' }) isSave = false\n @property({ type: Boolean, attribute: 'is-set' }) isSet = false\n @property({ type: Boolean, attribute: 'is-key' }) isKey = false\n @property({ type: Boolean, attribute: 'show-action' }) showAction = true\n @property({ type: Boolean, attribute: 'show-analysis' }) showAnalysis = true\n @property({ type: String, attribute: 'rich-text-content' }) richTextContent = ''\n @property({ type: String }) analysis = ''\n @property({ type: Number, attribute: 'exam-answer-relation-type' }) examAnswerRelationType = 0\n @property({ type: String, attribute: 'exam-expand' }) examExpand = ''\n @property({ type: Object, attribute: 'exam-answer-setting' })\n examAnswerSetting: { isInOrder: boolean, isIgnoreCase: boolean, keywordCount: number } = { isInOrder: true, isIgnoreCase: true, keywordCount: 1 }\n @property({ type: Object })\n uploadImage: (file: File) => Promise<string> = async (file: File) => {\n return new Promise((resolve, reject) => {\n const reader = new FileReader()\n reader.onload = (e) => resolve(e.target?.result as string)\n reader.onerror = reject\n reader.readAsDataURL(file)\n })\n }\n\n @property({ type: Array, attribute: 'answer-list' }) answerList: any[] = []\n\n @state() private _answers: TextAnswer[] = [{ title: '', tag: '', showInput: false }]\n @state() private _title = ''\n @state() private _analysis = ''\n @state() private _isInOrder = true\n @state() private _isIgnoreCase = true\n @state() private _keywordCount = 1\n @state() private _correct = ''\n @state() private _showRichText = false\n @state() private _richText = ''\n\n private readonly TITLE_MAX = 200\n\n willUpdate(changed: Map<string, unknown>) {\n if (changed.has('isEdit') && this.isEdit) { this._syncProps() }\n }\n\n private _syncProps() {\n this._title = this.title || ''\n this._analysis = this.analysis || ''\n if (this.answerList?.length) {\n this._answers = this.answerList.map((a: any) => ({ title: a.title || '', tag: '', showInput: false }))\n }\n if (this.examAnswerSetting) {\n this._isInOrder = !!this.examAnswerSetting.isInOrder\n this._isIgnoreCase = !!this.examAnswerSetting.isIgnoreCase\n this._keywordCount = this.examAnswerSetting.keywordCount || 1\n }\n if (this.richTextContent) {\n this._richText = this.richTextContent\n this._showRichText = true\n }\n if (this.examExpand) {\n this._correct = this.examExpand\n }\n }\n\n private _emit(name: string, detail?: unknown) {\n this.dispatchEvent(new CustomEvent(name, { bubbles: true, composed: true, detail: detail ?? null }))\n }\n\n private _onTitleInput(e: Event) {\n const el = e.target as HTMLTextAreaElement\n if (el.value.length > this.TITLE_MAX) { el.value = el.value.slice(0, this.TITLE_MAX) }\n this._title = el.value\n }\n\n private _addTag(i: number) {\n const a = { ...this._answers[i] }\n if (a.tag) {\n a.title = a.title ? [a.title, a.tag].join(',') : a.tag\n a.tag = ''\n }\n a.showInput = false\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n private _closeTag(tag: string, i: number) {\n const a = { ...this._answers[i] }\n a.title = a.title.split(',').filter(t => t !== tag).join(',')\n this._answers = this._answers.map((x, j) => j === i ? a : x)\n }\n\n async toJSON(): Promise<any> {\n return new Promise((resolve, reject) => {\n const row = { customId: this.customId || undefined, answerType: 'text_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const analysis = this.isEdit ? this._analysis : this.analysis || ''\n const correct = this.isEdit ? this._correct : (this as any).examExpand || ''\n const keywordCount = this.isEdit ? this._keywordCount : this.examAnswerSetting?.keywordCount || 1\n const isInOrder = this.isEdit ? this._isInOrder : this.examAnswerSetting?.isInOrder ?? true\n const isIgnoreCase = this.isEdit ? this._isIgnoreCase : this.examAnswerSetting?.isIgnoreCase ?? true\n const showRichText = this.isEdit ? this._showRichText : !!this.richTextContent\n const richText = this.isEdit ? this._richText : this.richTextContent || ''\n\n if (!title) {\n reject(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n return\n }\n if (keywordCount || correct) {\n if (!keywordCount) {\n reject(new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row))\n return\n }\n if (!correct) {\n reject(new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row))\n return\n }\n if (answers.length !== keywordCount) {\n reject(new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row))\n return\n }\n const msg: string[] = []\n answers.forEach((item: any, i: number) => {\n if (!item.title) { msg.push(`关键词${i + 1}未设置`) }\n })\n if (msg.length) {\n reject(new SubjectError(msg.join(','), 'KEYWORD_EMPTY', 'answers', row))\n return\n }\n }\n const result: any = {\n answerType: 'text_fill',\n title,\n answers: answers.filter((a: any) => a.title).map((a: any) => ({ title: a.title })),\n analysis,\n isSetCorrectAnswer: !!correct,\n isKey: this.isKey,\n examExpand: correct,\n examAnswerSettingBO: { isIgnoreCase, isInOrder, keywordCount },\n examRichTextContent: showRichText ? richText : '',\n }\n if (this.customId) { result.customId = this.customId }\n resolve(result)\n })\n }\n\n private _addAnswer() {\n if (this.isSave) { return }\n this._answers = [...this._answers, { title: '', tag: '', showInput: false }]\n }\n\n private _deleteAnswer(index: number) {\n if (this._answers.length < 2 || this.isSave) { return }\n this._answers = this._answers.filter((_, i) => i !== index)\n }\n\n private async _save(e?: Event) {\n e?.stopImmediatePropagation()\n try {\n const data = await this.toJSON()\n this._emit('save', data)\n }\n catch (err: any) {\n showToast(err.message)\n }\n }\n\n validate(): SubjectError[] {\n const errors: SubjectError[] = []\n const row = { customId: this.customId || undefined, answerType: 'text_fill', orderIndex: this.orderIndex }\n\n const title = this.isEdit ? this._title : this.title || ''\n const answers = this.isEdit ? this._answers : (this.answerList || [])\n const correct = this.isEdit ? this._correct : (this as any).examExpand || ''\n const keywordCount = this.isEdit ? this._keywordCount : this.examAnswerSetting?.keywordCount || 1\n\n if (!title) {\n errors.push(new SubjectError('题目标题不能为空!', 'EMPTY_TITLE', 'title', row))\n }\n if (keywordCount || correct) {\n if (!keywordCount) {\n errors.push(new SubjectError('请完善答题设置!', 'NO_KEYWORD_COUNT', 'keywordCount', row))\n }\n if (!correct) {\n errors.push(new SubjectError('请输入问题正确答案!', 'NO_CORRECT_ANSWER', 'correct', row))\n }\n if (answers.length !== keywordCount) {\n errors.push(new SubjectError('关键词个数设置有误!', 'KEYWORD_COUNT_MISMATCH', 'answers', row))\n }\n answers.forEach((item: any, i: number) => {\n if (!item.title) {\n errors.push(new SubjectError(`关键词${i + 1}未设置`, 'KEYWORD_EMPTY', 'answers', row))\n }\n })\n }\n\n return errors\n }\n\n private _renderPreview() {\n return html`\n <div class=\"preview\">\n <span class=\"title\">${this.orderIndex + 1}.${this.title}(问答题)</span>\n ${this.richTextContent ? html`<div class=\"rich-text\" .innerHTML=${this.richTextContent}></div>` : ''}\n ${this._answers.some(a => a.title)\n ? html`\n <div style=\"margin-top:8px;color:#a8abb2\">\n ${this._answers.map((a, i) => a.title\n ? html`\n <span style=\"margin-right:10px\">关键词${i + 1}: ${a.title}</span>\n `\n : '')}\n </div>\n `\n : ''}\n ${this._correct ? html`<div style=\"margin-top:8px;color:#a8abb2\">正确答案:${this._correct}</div>` : ''}\n ${this.analysis ? html`<div style=\"color:#909399;font-size:12px;margin-top:8px\">解析: ${this.analysis}</div>` : ''}\n </div>\n `\n }\n\n private _renderEdit() {\n return html`\n <div class=\"flex-items-start\">\n <div class=\"label\"><span>题目:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._title} ?disabled=${this.isSave}\n maxlength=${this.TITLE_MAX}\n @input=${(e: Event) => this._onTitleInput(e)}\n placeholder=\"【问答题】请输入问题\"></textarea>\n <span class=\"char-counter\">${this._title.length}/${this.TITLE_MAX}</span>\n </div>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答题设置:</span></div>\n <div style=\"flex:1;display:flex;align-items:center;flex-wrap:wrap;gap:8px\">\n <span style=\"font-size:13px;color:#606266\">共答对</span>\n <input type=\"number\" style=\"width:60px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:13px\"\n .value=${String(this._keywordCount)} min=\"1\"\n @change=${(e: Event) => { this._keywordCount = Number((e.target as HTMLInputElement).value) }} />\n <span style=\"font-size:13px;color:#606266\">个关键词,算是正确的</span>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isInOrder}\n @change=${(e: Event) => { this._isInOrder = (e.target as HTMLInputElement).checked }} />\n 答案不分顺序\n </label>\n <label style=\"display:inline-flex;align-items:center;gap:4px;cursor:pointer;font-size:12px;color:#606266\">\n <input type=\"checkbox\" .checked=${this._isIgnoreCase}\n @change=${(e: Event) => { this._isIgnoreCase = (e.target as HTMLInputElement).checked }} />\n 忽略大小写\n </label>\n </div>\n </div>\n\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>答案:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._correct} ?disabled=${this.isSave}\n maxlength=\"200\"\n @input=${(e: Event) => { this._correct = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入正确答案\"></textarea>\n <span class=\"char-counter\">${this._correct.length}/200</span>\n </div>\n </div>\n </div>\n\n <div class=\"answer-list\" style=\"margin-top:12px\">\n <span style=\"padding-left:60px;font-size:12px;color:#909399\">*如遇包含特殊字符的关键词,需添加多个同义词,例:'CO₂'需添加同义词'CO2'</span>\n ${this._answers.map((a, i) => html`\n <div class=\"answer-item\">\n <span class=\"label\">关键词${i + 1}:</span>\n <div class=\"answer-tags\" style=\"display:flex;flex-wrap:wrap;gap:5px;align-items:center;flex:1;max-width:360px\">\n ${a.title.split(',').filter(Boolean).map((tag) => {\n const c = TAG_COLORS[i % TAG_COLORS.length]; return html`\n <span style=\"display:inline-flex;align-items:center;background:${c.bg};color:${c.color};border:1px solid ${c.border};border-radius:3px;padding:2px 8px;font-size:12px;line-height:16px\">\n ${tag}\n ${!this.isSave ? html`<span style=\"cursor:pointer;margin-left:4px;color:#909399\" @click=${() => this._closeTag(tag, i)}>×</span>` : ''}\n </span>\n `\n })}\n ${!this.isSave\n ? html`\n ${a.showInput\n ? html`\n <input type=\"text\" style=\"width:80px;height:24px;border:1px solid #dcdfe6;border-radius:3px;padding:0 8px;font-size:12px\"\n @keydown=${(e: KeyboardEvent) => {\n if (e.key === 'Enter') { this._addTag(i) }\n }}\n @input=${(e: Event) => { a.tag = (e.target as HTMLInputElement).value }}\n @blur=${() => this._addTag(i)} />\n <button class=\"el-link\" @click=${() => this._addTag(i)}>确认</button>\n `\n : html`\n <button class=\"link\" @click=${() => { this._answers = this._answers.map((x, j) => j === i ? { ...x, showInput: true } : x); this.updateComplete.then(() => { (this.shadowRoot?.querySelector(`input[style*=\"width:80px\"]`) as HTMLInputElement)?.focus() }) }}>\n ${a.title ? '添加同义词' : '添加关键词'}\n </button>\n `}\n `\n : ''}\n </div>\n <span class=\"icon ${this.isSave ? 'disabled' : ''}\" @click=${() => this._addAnswer()}>${this._iconPlus}</span>\n <span class=\"icon ${this.isSave || this._answers.length < 2 ? 'disabled' : ''}\" @click=${() => this._deleteAnswer(i)}>${this._iconRemove}</span>\n </div>\n `)}\n </div>\n\n ${this._showRichText\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>富文本:</span></div>\n <div style=\"flex:1\">\n <qxs-blocksuite-editor\n .content=${this._richText}\n .uploadImage=${this.uploadImage}\n ?is-edit=${true}\n ></qxs-blocksuite-editor>\n <div class=\"flex-justify-end\" style=\"margin-top:8px\"><span class=\"el-link danger\" @click=${() => { this._showRichText = false; this._richText = '' }}>删除富文本</span></div>\n </div>\n </div>\n `\n : ''}\n\n ${this.showAnalysis\n ? html`\n <div class=\"flex-items-start\" style=\"margin-top:12px\">\n <div class=\"label\"><span>解析:</span></div>\n <div style=\"flex:1\">\n <div class=\"el-input\">\n <textarea rows=\"2\" .value=${this._analysis}\n @input=${(e: Event) => { this._analysis = (e.target as HTMLTextAreaElement).value }}\n placeholder=\"请输入题目解析\"></textarea>\n </div>\n </div>\n </div>\n `\n : ''}\n `\n }\n\n render() {\n return html`\n <qxs-subject-layout ?show-edit=${this.isEdit}>\n <div slot=\"preview\">${this._renderPreview()}</div>\n <div slot=\"edit\">${this._renderEdit()}</div>\n ${this.showAction\n ? html`\n <qxs-subject-action\n ?is-edit=${this.isEdit}\n ?is-set=${this.isSet}\n ?show-other-option=${false}\n exam-answer-relation-type=${this.examAnswerRelationType}\n @delete=${() => this._emit('delete')}\n @save=${this._save}\n @edit=${() => this._emit('edit')}\n @add=${(e: CustomEvent) => this._emit('add', e.detail)}\n @set-key=${(e: CustomEvent) => { this._emit('set-key', e.detail) }}\n @on-show-rich-text=${() => { this._showRichText = true }}\n ></qxs-subject-action>\n `\n : ''}\n </qxs-subject-layout>\n `\n }\n}\n\nexport function register() {}\n"],"names":["TAG_COLORS","bg","color","border","QxsTextFill","LitElement","constructor","super","arguments","this","_iconPlus","html","_iconRemove","orderIndex","title","customId","isEdit","isSave","isSet","isKey","showAction","showAnalysis","richTextContent","analysis","examAnswerRelationType","examExpand","examAnswerSetting","isInOrder","isIgnoreCase","keywordCount","uploadImage","async","Promise","resolve","reject","reader","FileReader","onload","e","target","result","onerror","readAsDataURL","file","answerList","_answers","tag","showInput","_title","_analysis","_isInOrder","_isIgnoreCase","_keywordCount","_correct","_showRichText","_richText","TITLE_MAX","willUpdate","changed","has","_syncProps","length","map","a","_emit","name","detail","dispatchEvent","CustomEvent","bubbles","composed","_onTitleInput","el","value","slice","_addTag","i","join","x","j","_closeTag","split","filter","t","toJSON","row","answerType","answers","correct","showRichText","richText","SubjectError","msg","forEach","item","push","isSetCorrectAnswer","examAnswerSettingBO","examRichTextContent","_addAnswer","_deleteAnswer","index","_","_save","stopImmediatePropagation","data","err","document","createElement","textContent","Object","assign","style","position","top","left","transform","padding","borderRadius","fontSize","background","zIndex","boxShadow","transition","opacity","body","appendChild","setTimeout","remove","showToast","message","validate","errors","_renderPreview","some","_renderEdit","String","Number","checked","Boolean","c","key","updateComplete","then","shadowRoot","querySelector","focus","render","styles","css","__decorateClass","property","type","attribute","prototype","Array","state","safeCustomElement"],"mappings":"imBAOA,MAAMA,EAAa,CACjB,CAAEC,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,WAC3C,CAAEF,GAAI,UAAWC,MAAO,UAAWC,OAAQ,YAiBtC,IAAMC,EAAN,cAA0BC,EAA1BC,WAAAA,GAAAC,SAAAC,WACLC,KAAiBC,UAAYC,CAAA,2NAC7BF,KAAiBG,YAAcD,CAAA,qLA6FuBF,KAAAI,WAAa,EACvCJ,KAAAK,MAAQ,GACgBL,KAAAM,SAAW,GACZN,KAAAO,QAAS,EACTP,KAAAQ,QAAS,EACVR,KAAAS,OAAQ,EACRT,KAAAU,OAAQ,EACHV,KAAAW,YAAa,EACXX,KAAAY,cAAe,EACZZ,KAAAa,gBAAkB,GAClDb,KAAAc,SAAW,GAC6Bd,KAAAe,uBAAyB,EACvCf,KAAAgB,WAAa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sJ,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAhIUxJ,EAgIMsJ,UAAA,WAAA,GACAJ,EAAA,CAAhBM,KAjIUxJ,EAiIMsJ,UAAA,gBAAA,GACAJ,EAAA,CAAhBM,KAlIUxJ,EAkIMsJ,UAAA,YAAA,GAlINtJ,EAANkJ,EAAA,CADNO,EAAkB,kBACNzJ"}
@@ -1,4 +1,4 @@
1
- "use strict";var e=require("@tiptap/core"),t=require("@tiptap/extension-blockquote"),i=require("@tiptap/extension-bold"),o=require("@tiptap/extension-bullet-list"),r=require("@tiptap/extension-code"),l=require("@tiptap/extension-document"),s=require("@tiptap/extension-heading"),n=require("@tiptap/extension-history"),a=require("@tiptap/extension-horizontal-rule"),d=require("@tiptap/extension-image"),c=require("@tiptap/extension-italic"),b=require("@tiptap/extension-link"),h=require("@tiptap/extension-list-item"),p=require("@tiptap/extension-ordered-list"),u=require("@tiptap/extension-paragraph"),g=require("@tiptap/extension-strike"),x=require("@tiptap/extension-table"),v=require("@tiptap/extension-table-cell"),m=require("@tiptap/extension-table-header"),f=require("@tiptap/extension-table-row"),_=require("@tiptap/extension-text"),y=require("@tiptap/extension-text-align"),w=require("@tiptap/extension-underline"),k=require("../node_modules/.pnpm/@tiptap_extension-placeholder@3.20.5_@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs"),C=require("lit"),T=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),M=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),$=require("../base/define.cjs"),B=Object.defineProperty,R=Object.getOwnPropertyDescriptor,A=(e,t,i,o)=>{for(var r,l=o>1?void 0:o?R(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=(o?r(t,i,l):r(l))||l);return o&&l&&B(t,i,l),l};exports.QxsBlocksuiteEditor=class extends C.LitElement{constructor(){super(...arguments),this.content="",this.readonly=!1,this.preview=!1,this._editor=null,this._pendingContent=null,this._tableRows=3,this._tableCols=3,this._hoverRow=0,this._hoverCol=0,this._tableDropdownOpen=!1,this._isLoading=!0,this._tableCellToolbar={x:0,y:0,visible:!1,cellRow:0,cellCol:0},this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},this._imageToolbar={x:0,y:0,visible:!1},this._imageMoreMenuVisible=!1,this._hasSlashCommand=!1,this._tableEdgeDetectionSetup=!1}_initEditor(){if(this._editor)return;const C=this.shadowRoot?.querySelector(".editor-content");if(!C)return void requestAnimationFrame(()=>this._initEditor());this._isLoading=!1;const T=[l,u,_,i,c,w,g,r,s.configure({levels:[1,2,3]}),o,p,h,t,a,n,d.configure({inline:!1,allowBase64:!0}),b.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer"}}),y.configure({types:["heading","paragraph"]}),x.Table.configure({resizable:!0}),f.TableRow,v.TableCell,m.TableHeader,k.default.configure({placeholder:"输入 / 唤出快捷命令"})];this._editor=new e.Editor({element:C,extensions:T,content:(this._pendingContent??this.content)||"<p></p>",editable:!this.readonly}),this._pendingContent=null,this._editor.on("selectionUpdate",()=>{this.requestUpdate(),this._updateBubbleMenuPosition(),this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar();const e=this._editor;if(e){const{selection:t}=e.state,{$from:i}=t;if("image"===i.node(i.depth).type.name){const t=e.view.coordsAtPos(i.start()),o=this.shadowRoot?.querySelector(".editor-wrapper")?.getBoundingClientRect();if(o){const e=t.left-o.left+(t.right-t.left)/2,i=t.top-o.top-40;this._showImageToolbar({x:e,y:i})}}else this._hideImageToolbar()}}),this._editor.on("transaction",()=>{this.requestUpdate(),this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar(),this._checkSlashCommand(),this._setupTableEdgeDetection()})}_setupTableEdgeDetection(){const e=this.shadowRoot?.querySelector(".editor-content");e&&!this._tableEdgeDetectionSetup&&(this._tableEdgeDetectionSetup=!0,e.addEventListener("mousemove",e=>{this._handleTableEdgeMouseMove(e)}),e.addEventListener("mouseleave",()=>{this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}}}),e.addEventListener("click",e=>{const t=e.target;if("IMG"===t.tagName){const e=this._editor?.view.posAtDOM(t,0);void 0!==e&&this._editor?.chain().focus().setNodeSelection(e).run()}}))}_handleTableEdgeMouseMove(e){if(!this._editor?.isActive("table"))return this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},void this.requestUpdate();const t=e.target.closest("table");if(!t)return this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},void this.requestUpdate();const i=t.getBoundingClientRect(),o=this.shadowRoot?.querySelector(".editor-wrapper");if(!o)return;const r=o.getBoundingClientRect(),l=e.clientX-r.left,s=e.clientY-r.top,n=10,a=i.height/t.rows.length;for(let o=0;o<t.rows.length;o++){const t=i.top+o*a,s=t+a;if(e.clientY>=t-n&&e.clientY<=t+n)return this._tableEdgeHover={type:"row",index:o,position:{x:l,y:t-r.top}},void this.requestUpdate();if(e.clientY>=s-n&&e.clientY<=s+n)return this._tableEdgeHover={type:"row",index:o+1,position:{x:l,y:s-r.top}},void this.requestUpdate()}const d=i.width/t.rows[0]?.cells.length||1;for(let o=0;o<(t.rows[0]?.cells.length||0);o++){const t=i.left+o*d,l=t+d;if(e.clientX>=t-n&&e.clientX<=t+n)return this._tableEdgeHover={type:"col",index:o,position:{x:t-r.left,y:s}},void this.requestUpdate();if(e.clientX>=l-n&&e.clientX<=l+n)return this._tableEdgeHover={type:"col",index:o+1,position:{x:l-r.left,y:s}},void this.requestUpdate()}this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},this.requestUpdate()}_checkSlashCommand(){if(!this._editor)return;const{selection:e}=this._editor.state,t=this._editor.state.doc.textBetween(Math.max(0,e.from-10),e.from," ");this._hasSlashCommand=t.endsWith("/")}firstUpdated(){this._initEditor()}updated(e){if(this._editor)return e.has("content")&&this._editor.commands.setContent(this.content||"<p></p>"),void(e.has("readonly")&&this._editor.setEditable(!this.readonly));e.has("content")&&(this._pendingContent=this.content);const t=this.shadowRoot?.querySelector(".editor-content");t&&!this._editor&&this._initEditor()}disconnectedCallback(){super.disconnectedCallback(),this._editor?.destroy(),this._editor=null}getContent(){return this._editor?.getHTML()??""}_applyFormat(e){if(this._hasSlashCommand&&this._editor){const{selection:e}=this._editor.state;this._editor.chain().focus().deleteRange({from:e.from-1,to:e.from}).run(),this._hasSlashCommand=!1}e()}_toggleBold(){this._applyFormat(()=>this._editor?.chain().focus().toggleBold().run())}_toggleItalic(){this._applyFormat(()=>this._editor?.chain().focus().toggleItalic().run())}_toggleUnderline(){this._applyFormat(()=>this._editor?.chain().focus().toggleUnderline().run())}_toggleStrike(){this._applyFormat(()=>this._editor?.chain().focus().toggleStrike().run())}_toggleCode(){this._applyFormat(()=>this._editor?.chain().focus().toggleCode().run())}_setHeading(e){this._applyFormat(()=>this._editor?.chain().focus().toggleHeading({level:e}).run())}_setParagraph(){this._applyFormat(()=>this._editor?.chain().focus().setParagraph().run())}_toggleBulletList(){this._applyFormat(()=>this._editor?.chain().focus().toggleBulletList().run())}_toggleOrderedList(){this._applyFormat(()=>this._editor?.chain().focus().toggleOrderedList().run())}_toggleBlockquote(){this._applyFormat(()=>this._editor?.chain().focus().toggleBlockquote().run())}_setTextAlign(e){this._applyFormat(()=>this._editor?.chain().focus().setTextAlign(e).run())}_setLink(){const e=window.prompt("请输入链接地址:");e&&this._applyFormat(()=>this._editor?.chain().focus().setLink({href:e}).run())}_unsetLink(){this._applyFormat(()=>this._editor?.chain().focus().unsetLink().run())}_insertTable(e,t){this._editor?.chain().focus().insertTable({rows:e??this._tableRows,cols:t??this._tableCols,withHeaderRow:!0}).run()}_handleImageUpload(e){const t=e.target,i=t.files?.[0];if(i){const e=new FileReader;e.onload=e=>{const t=e.target?.result;this._editor?.chain().focus().setImage({src:t}).run()},e.readAsDataURL(i)}t.value=""}_triggerImageUpload(){const e=this.shadowRoot?.querySelector(".image-input");e?.click()}_insertTableByClick(e,t){if(this._hasSlashCommand&&this._editor){const{selection:e}=this._editor.state;this._editor.chain().focus().deleteRange({from:e.from-1,to:e.from}).run(),this._hasSlashCommand=!1}this._tableRows=e,this._tableCols=t,this._insertTable(e,t)}_insertHorizontalRule(){this._editor?.chain().focus().setHorizontalRule().run()}_showTableCellToolbar(){if(!this._editor?.isActive("table"))return;const{state:e}=this._editor,{selection:t}=e,i=this._editor.view.coordsAtPos(t.from),o=this.shadowRoot?.querySelector(".editor-wrapper");if(!o)return;const r=o.getBoundingClientRect(),l=this._getTableCellRow(),s=this._getTableCellCol();(0===l||0===s)&&(this._tableCellToolbar={x:i.left-r.left,y:i.bottom-r.top+8,visible:!0,cellRow:l,cellCol:s})}_getTableCellRow(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let e=t.depth;e>0;e--){if("tableCell"===t.node(e).type.name)return t.index(e-1)}return 0}_getTableCellCol(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let e=t.depth;e>0;e--){if("tableCell"===t.node(e).type.name)return t.index(e)}return 0}_hideTableCellToolbar(){this._tableCellToolbar={...this._tableCellToolbar,visible:!1}}_addTableRowAbove(){this._editor?.chain().focus().addRowBefore().run(),this._hideTableCellToolbar()}_addTableRowBelow(){this._editor?.chain().focus().addRowAfter().run(),this._hideTableCellToolbar()}_addTableColumnLeft(){this._editor?.chain().focus().addColumnBefore().run(),this._hideTableCellToolbar()}_addTableColumnRight(){this._editor?.chain().focus().addColumnAfter().run(),this._hideTableCellToolbar()}_deleteTableRow(){this._editor?.chain().focus().deleteRow().run(),this._hideTableCellToolbar()}_deleteTableColumn(){this._editor?.chain().focus().deleteColumn().run(),this._hideTableCellToolbar()}_deleteTable(){this._editor?.chain().focus().deleteTable().run(),this._hideTableCellToolbar()}_showImageToolbar(e){this._imageToolbar={x:e.x,y:e.y,visible:!0},this._imageMoreMenuVisible=!1}_hideImageToolbar(){this._imageToolbar={...this._imageToolbar,visible:!1},this._imageMoreMenuVisible=!1}_toggleImageMoreMenu(){this._imageMoreMenuVisible=!this._imageMoreMenuVisible}_deleteImage(){this._editor?.chain().focus().deleteNode("image").run(),this._hideImageToolbar()}_insertImageAfter(){this._triggerImageUpload(),this._imageMoreMenuVisible=!1}_setImageAlignLeft(){const e=this._editor;if(e){const{selection:t}=e.state,i=t.from;e.chain().focus().setNodeSelection(i).run();const o=this.shadowRoot?.querySelector(".ProseMirror img.ProseMirror-selectednode");o&&(o.style.display="block",o.style.margin="0 auto 0 0")}this._imageMoreMenuVisible=!1}_setImageAlignCenter(){const e=this._editor;if(e){const{selection:t}=e.state,i=t.from;e.chain().focus().setNodeSelection(i).run();const o=this.shadowRoot?.querySelector(".ProseMirror img.ProseMirror-selectednode");o&&(o.style.display="block",o.style.margin="0 auto")}this._imageMoreMenuVisible=!1}_setImageAlignRight(){const e=this._editor;if(e){const{selection:t}=e.state,i=t.from;e.chain().focus().setNodeSelection(i).run();const o=this.shadowRoot?.querySelector(".ProseMirror img.ProseMirror-selectednode");o&&(o.style.display="block",o.style.margin="0 0 0 auto")}this._imageMoreMenuVisible=!1}_updateImageToolbarPosition(){requestAnimationFrame(()=>{const e=this._editor;if(!e)return;const{selection:t}=e.state,{$from:i}=t;if("image"===i.node(i.depth).type.name?i.node(i.depth):null){const t=e.view.coordsAtPos(i.start()),o=this.shadowRoot?.querySelector(".editor-wrapper")?.getBoundingClientRect();if(o){const e=t.left-o.left+(t.right-t.left)/2,i=t.top-o.top-40;this._showImageToolbar({x:e,y:i})}}else this._hideImageToolbar()})}_getTextLabel(){const e=this._editor;return e?e.isActive("heading",{level:1})?"标题 1":e.isActive("heading",{level:2})?"标题 2":e.isActive("heading",{level:3})?"标题 3":"正文":"正文"}_getAlignLabel(){const e=this._editor;return e?e.isActive({textAlign:"center"})?"居中":e.isActive({textAlign:"right"})?"右对齐":"左对齐":"对齐"}_updateBubbleMenuPosition(){requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(".bubble-menu"),t=this.shadowRoot?.querySelector(".ProseMirror"),i=this.shadowRoot?.querySelector(".editor-wrapper");if(!e||!t||!i)return;const o=this._editor,r=o?.isActive("table")??!1,{selection:l}=o?.state??{selection:null};if(r&&l&&!l.empty&&o){const{from:t,to:i}=l,r=o.state.doc.resolve(t),s=o.state.doc.resolve(i);let n=!1;for(let e=r.depth;e>=0;e--)if("table"===r.node(e).type.name){n=!0;break}const a=r.node(r.depth),d=s.node(s.depth);if("table"!==a.type.name&&"table"!==d.type.name||(n=!0),n)return e.style.opacity="0",void(e.style.visibility="hidden")}if(l&&!l.empty);else if(!l||l.empty&&!this._hasSlashCommand)return e.style.opacity="0",void(e.style.visibility="hidden");const s=i.getBoundingClientRect(),n=e.getBoundingClientRect(),{from:a}=l,d=this._editor?.view.coordsAtPos(a);if(!d)return;let c=d.left-s.left,b=d.top-s.top-40;c+n.width>s.width&&(c=s.width-n.width-8),c<0&&(c=8),b<0&&(b=d.bottom-s.top+8),e.style.left=`${c}px`,e.style.top=`${b}px`,e.style.opacity="1",e.style.visibility="visible"})}render(){const e=this._editor;return C.html`
1
+ "use strict";var e=require("@tiptap/core"),t=require("@tiptap/extension-blockquote"),i=require("@tiptap/extension-bold"),o=require("@tiptap/extension-bullet-list"),r=require("@tiptap/extension-code"),l=require("@tiptap/extension-document"),s=require("@tiptap/extension-heading"),n=require("@tiptap/extension-history"),a=require("@tiptap/extension-horizontal-rule"),d=require("@tiptap/extension-image"),c=require("@tiptap/extension-italic"),p=require("@tiptap/extension-link"),b=require("@tiptap/extension-list-item"),h=require("@tiptap/extension-ordered-list"),u=require("@tiptap/extension-paragraph"),g=require("@tiptap/extension-strike"),x=require("@tiptap/extension-table"),m=require("@tiptap/extension-table-cell"),v=require("@tiptap/extension-table-header"),y=require("@tiptap/extension-table-row"),f=require("@tiptap/extension-text"),_=require("@tiptap/extension-text-align"),w=require("@tiptap/extension-underline"),k=require("../node_modules/.pnpm/@tiptap_extension-placeholder@3.20.5_@tiptap_extensions@3.20.5_@tiptap_core@3.20.5_@tiptap_pm@3.20.5__@tiptap_pm@3.20.5_/node_modules/@tiptap/extension-placeholder/dist/index.cjs"),C=require("lit"),T=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/property.cjs"),M=require("../node_modules/.pnpm/@lit_reactive-element@2.1.2/node_modules/@lit/reactive-element/decorators/state.cjs"),$=require("../base/define.cjs"),B=Object.defineProperty,q=Object.getOwnPropertyDescriptor,E=(e,t,i,o)=>{for(var r,l=o>1?void 0:o?q(t,i):t,s=e.length-1;s>=0;s--)(r=e[s])&&(l=(o?r(t,i,l):r(l))||l);return o&&l&&B(t,i,l),l};exports.QxsBlocksuiteEditor=class extends C.LitElement{constructor(){super(...arguments),this.content="",this.readonly=!1,this.preview=!1,this.isEdit=!1,this.uploadImage=async e=>new Promise((t,i)=>{const o=new FileReader;o.onload=e=>t(e.target?.result),o.onerror=i,o.readAsDataURL(e)}),this._editor=null,this._pendingContent=null,this._tableRows=3,this._tableCols=3,this._hoverRow=0,this._hoverCol=0,this._tableDropdownOpen=!1,this._isLoading=!0,this._tableCellToolbar={x:0,y:0,visible:!1,cellRow:0,cellCol:0},this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},this._imageToolbar={x:0,y:0,visible:!1},this._imageMoreMenuVisible=!1,this._hasSlashCommand=!1,this._tableEdgeDetectionSetup=!1}_initEditor(){if(this._editor)return;const C=this.shadowRoot?.querySelector(".editor-content");if(!C)return void requestAnimationFrame(()=>this._initEditor());this._isLoading=!1;const T=[l,u,f,i,c,w,g,r,s.configure({levels:[1,2,3]}),o,h,b,t,a,n,d.configure({inline:!1,allowBase64:!0}),p.configure({openOnClick:!1,HTMLAttributes:{rel:"noopener noreferrer"}}),_.configure({types:["heading","paragraph"]}),x.Table.configure({resizable:!0}),y.TableRow,m.TableCell,v.TableHeader,k.default.configure({placeholder:"输入 / 唤出快捷命令"})];this._editor=new e.Editor({element:C,extensions:T,content:(this._pendingContent??this.content)||"<p></p>",editable:!this.readonly}),this._pendingContent=null,this._editor.on("selectionUpdate",()=>{this.requestUpdate(),this._updateBubbleMenuPosition(),this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar();const e=this._editor;if(e){const{selection:t}=e.state,{$from:i}=t;if("image"===i.node(i.depth).type.name){const t=e.view.coordsAtPos(i.start()),o=this.shadowRoot?.querySelector(".editor-wrapper")?.getBoundingClientRect();if(o){const e=t.left-o.left+(t.right-t.left)/2,i=t.top-o.top-40;this._showImageToolbar({x:e,y:i})}}else this._hideImageToolbar()}}),this._editor.on("transaction",()=>{this.requestUpdate(),this._editor?.isActive("table")?this._showTableCellToolbar():this._hideTableCellToolbar(),this._checkSlashCommand(),this._setupTableEdgeDetection()})}_setupTableEdgeDetection(){const e=this.shadowRoot?.querySelector(".editor-content");e&&!this._tableEdgeDetectionSetup&&(this._tableEdgeDetectionSetup=!0,e.addEventListener("mousemove",e=>{this._handleTableEdgeMouseMove(e)}),e.addEventListener("mouseleave",()=>{this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}}}),e.addEventListener("click",e=>{const t=e.target;if("IMG"===t.tagName){const e=this._editor?.view.posAtDOM(t,0);void 0!==e&&this._editor?.chain().focus().setNodeSelection(e).run()}}))}_handleTableEdgeMouseMove(e){if(!this._editor?.isActive("table"))return this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},void this.requestUpdate();const t=e.target.closest("table");if(!t)return this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},void this.requestUpdate();const i=t.getBoundingClientRect(),o=this.shadowRoot?.querySelector(".editor-wrapper");if(!o)return;const r=o.getBoundingClientRect(),l=e.clientX-r.left,s=e.clientY-r.top,n=10,a=i.height/t.rows.length;for(let o=0;o<t.rows.length;o++){const t=i.top+o*a,s=t+a;if(e.clientY>=t-n&&e.clientY<=t+n)return this._tableEdgeHover={type:"row",index:o,position:{x:l,y:t-r.top}},void this.requestUpdate();if(e.clientY>=s-n&&e.clientY<=s+n)return this._tableEdgeHover={type:"row",index:o+1,position:{x:l,y:s-r.top}},void this.requestUpdate()}const d=i.width/t.rows[0]?.cells.length||1;for(let o=0;o<(t.rows[0]?.cells.length||0);o++){const t=i.left+o*d,l=t+d;if(e.clientX>=t-n&&e.clientX<=t+n)return this._tableEdgeHover={type:"col",index:o,position:{x:t-r.left,y:s}},void this.requestUpdate();if(e.clientX>=l-n&&e.clientX<=l+n)return this._tableEdgeHover={type:"col",index:o+1,position:{x:l-r.left,y:s}},void this.requestUpdate()}this._tableEdgeHover={type:null,index:0,position:{x:0,y:0}},this.requestUpdate()}_checkSlashCommand(){if(!this._editor)return;const{selection:e}=this._editor.state,t=this._editor.state.doc.textBetween(Math.max(0,e.from-10),e.from," ");this._hasSlashCommand=t.endsWith("/")}firstUpdated(){this._initEditor()}updated(e){if(this._editor)return e.has("content")&&this._editor.commands.setContent(this.content||"<p></p>"),void(e.has("readonly")&&this._editor.setEditable(!this.readonly));e.has("content")&&(this._pendingContent=this.content);const t=this.shadowRoot?.querySelector(".editor-content");t&&!this._editor&&this._initEditor()}disconnectedCallback(){super.disconnectedCallback(),this._editor?.destroy(),this._editor=null}getContent(){return this._editor?.getHTML()??""}_applyFormat(e){if(this._hasSlashCommand&&this._editor){const{selection:e}=this._editor.state;this._editor.chain().focus().deleteRange({from:e.from-1,to:e.from}).run(),this._hasSlashCommand=!1}e()}_toggleBold(){this._applyFormat(()=>this._editor?.chain().focus().toggleBold().run())}_toggleItalic(){this._applyFormat(()=>this._editor?.chain().focus().toggleItalic().run())}_toggleUnderline(){this._applyFormat(()=>this._editor?.chain().focus().toggleUnderline().run())}_toggleStrike(){this._applyFormat(()=>this._editor?.chain().focus().toggleStrike().run())}_toggleCode(){this._applyFormat(()=>this._editor?.chain().focus().toggleCode().run())}_setHeading(e){this._applyFormat(()=>this._editor?.chain().focus().toggleHeading({level:e}).run())}_setParagraph(){this._applyFormat(()=>this._editor?.chain().focus().setParagraph().run())}_toggleBulletList(){this._applyFormat(()=>this._editor?.chain().focus().toggleBulletList().run())}_toggleOrderedList(){this._applyFormat(()=>this._editor?.chain().focus().toggleOrderedList().run())}_toggleBlockquote(){this._applyFormat(()=>this._editor?.chain().focus().toggleBlockquote().run())}_setTextAlign(e){this._applyFormat(()=>this._editor?.chain().focus().setTextAlign(e).run())}_setLink(){const e=window.prompt("请输入链接地址:");e&&this._applyFormat(()=>this._editor?.chain().focus().setLink({href:e}).run())}_unsetLink(){this._applyFormat(()=>this._editor?.chain().focus().unsetLink().run())}_insertTable(e,t){this._editor?.chain().focus().insertTable({rows:e??this._tableRows,cols:t??this._tableCols,withHeaderRow:!0}).run()}async _handleImageUpload(e){const t=e.target,i=t.files?.[0];if(i)try{const e=await this.uploadImage(i);this._editor?.chain().focus().setImage({src:e}).run()}catch(e){}t.value=""}_triggerImageUpload(){const e=this.shadowRoot?.querySelector(".image-input");e?.click()}_insertTableByClick(e,t){if(this._hasSlashCommand&&this._editor){const{selection:e}=this._editor.state;this._editor.chain().focus().deleteRange({from:e.from-1,to:e.from}).run(),this._hasSlashCommand=!1}this._tableRows=e,this._tableCols=t,this._insertTable(e,t)}_insertHorizontalRule(){this._editor?.chain().focus().setHorizontalRule().run()}_showTableCellToolbar(){if(!this._editor?.isActive("table"))return;const{state:e}=this._editor,{selection:t}=e,i=this._editor.view.coordsAtPos(t.from),o=this.shadowRoot?.querySelector(".editor-wrapper");if(!o)return;const r=o.getBoundingClientRect(),l=this._getTableCellRow(),s=this._getTableCellCol();(0===l||0===s)&&(this._tableCellToolbar={x:i.left-r.left,y:i.bottom-r.top+8,visible:!0,cellRow:l,cellCol:s})}_getTableCellRow(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let e=t.depth;e>0;e--){if("tableCell"===t.node(e).type.name)return t.index(e-1)}return 0}_getTableCellCol(){if(!this._editor)return 0;const{selection:e}=this._editor.state,t=this._editor.state.doc.resolve(e.from);for(let e=t.depth;e>0;e--){if("tableCell"===t.node(e).type.name)return t.index(e)}return 0}_hideTableCellToolbar(){this._tableCellToolbar={...this._tableCellToolbar,visible:!1}}_addTableRowAbove(){this._editor?.chain().focus().addRowBefore().run(),this._hideTableCellToolbar()}_addTableRowBelow(){this._editor?.chain().focus().addRowAfter().run(),this._hideTableCellToolbar()}_addTableColumnLeft(){this._editor?.chain().focus().addColumnBefore().run(),this._hideTableCellToolbar()}_addTableColumnRight(){this._editor?.chain().focus().addColumnAfter().run(),this._hideTableCellToolbar()}_deleteTableRow(){this._editor?.chain().focus().deleteRow().run(),this._hideTableCellToolbar()}_deleteTableColumn(){this._editor?.chain().focus().deleteColumn().run(),this._hideTableCellToolbar()}_deleteTable(){this._editor?.chain().focus().deleteTable().run(),this._hideTableCellToolbar()}_showImageToolbar(e){this._imageToolbar={x:e.x,y:e.y,visible:!0},this._imageMoreMenuVisible=!1}_hideImageToolbar(){this._imageToolbar={...this._imageToolbar,visible:!1},this._imageMoreMenuVisible=!1}_toggleImageMoreMenu(){this._imageMoreMenuVisible=!this._imageMoreMenuVisible}_deleteImage(){this._editor?.chain().focus().deleteNode("image").run(),this._hideImageToolbar()}_insertImageAfter(){this._triggerImageUpload(),this._imageMoreMenuVisible=!1}_setImageAlignLeft(){const e=this._editor;if(e){const{selection:t}=e.state,i=t.from;e.chain().focus().setNodeSelection(i).run();const o=this.shadowRoot?.querySelector(".ProseMirror img.ProseMirror-selectednode");o&&(o.style.display="block",o.style.margin="0 auto 0 0")}this._imageMoreMenuVisible=!1}_setImageAlignCenter(){const e=this._editor;if(e){const{selection:t}=e.state,i=t.from;e.chain().focus().setNodeSelection(i).run();const o=this.shadowRoot?.querySelector(".ProseMirror img.ProseMirror-selectednode");o&&(o.style.display="block",o.style.margin="0 auto")}this._imageMoreMenuVisible=!1}_setImageAlignRight(){const e=this._editor;if(e){const{selection:t}=e.state,i=t.from;e.chain().focus().setNodeSelection(i).run();const o=this.shadowRoot?.querySelector(".ProseMirror img.ProseMirror-selectednode");o&&(o.style.display="block",o.style.margin="0 0 0 auto")}this._imageMoreMenuVisible=!1}_updateImageToolbarPosition(){requestAnimationFrame(()=>{const e=this._editor;if(!e)return;const{selection:t}=e.state,{$from:i}=t;if("image"===i.node(i.depth).type.name?i.node(i.depth):null){const t=e.view.coordsAtPos(i.start()),o=this.shadowRoot?.querySelector(".editor-wrapper")?.getBoundingClientRect();if(o){const e=t.left-o.left+(t.right-t.left)/2,i=t.top-o.top-40;this._showImageToolbar({x:e,y:i})}}else this._hideImageToolbar()})}_getTextLabel(){const e=this._editor;return e?e.isActive("heading",{level:1})?"标题 1":e.isActive("heading",{level:2})?"标题 2":e.isActive("heading",{level:3})?"标题 3":"正文":"正文"}_getAlignLabel(){const e=this._editor;return e?e.isActive({textAlign:"center"})?"居中":e.isActive({textAlign:"right"})?"右对齐":"左对齐":"对齐"}_updateBubbleMenuPosition(){requestAnimationFrame(()=>{const e=this.shadowRoot?.querySelector(".bubble-menu"),t=this.shadowRoot?.querySelector(".ProseMirror"),i=this.shadowRoot?.querySelector(".editor-wrapper");if(!e||!t||!i)return;const o=this._editor,r=o?.isActive("table")??!1,{selection:l}=o?.state??{selection:null};if(r&&l&&!l.empty&&o){const{from:t,to:i}=l,r=o.state.doc.resolve(t),s=o.state.doc.resolve(i);let n=!1;for(let e=r.depth;e>=0;e--)if("table"===r.node(e).type.name){n=!0;break}const a=r.node(r.depth),d=s.node(s.depth);if("table"!==a.type.name&&"table"!==d.type.name||(n=!0),n)return e.style.opacity="0",void(e.style.visibility="hidden")}if(l&&!l.empty);else if(!l||l.empty&&!this._hasSlashCommand)return e.style.opacity="0",void(e.style.visibility="hidden");const s=i.getBoundingClientRect(),n=e.getBoundingClientRect(),{from:a}=l,d=this._editor?.view.coordsAtPos(a);if(!d)return;let c=d.left-s.left,p=d.top-s.top-40;c+n.width>s.width&&(c=s.width-n.width-8),c<0&&(c=8),p<0&&(p=d.bottom-s.top+8),e.style.left=`${c}px`,e.style.top=`${p}px`,e.style.opacity="1",e.style.visibility="visible"})}render(){const e=this._editor;return C.html`
2
2
  <div class="editor-wrapper ${this._isLoading?"loading":""} ${this.preview?"preview":""}">
3
3
  ${this._isLoading?C.html`
4
4
  <div class="loading-placeholder">
@@ -303,14 +303,14 @@
303
303
  .editor-wrapper {
304
304
  border: 1px solid #e3e3e3;
305
305
  border-radius: 12px;
306
- background: transparent;
306
+ background: #fff;
307
307
  overflow: visible;
308
308
  position: relative;
309
309
  }
310
310
 
311
311
  .editor-wrapper:focus-within {
312
- border-color: #1e96fc;
313
- box-shadow: 0 0 0 2px rgba(30, 150, 252, 0.1);
312
+ border-color: var(--qxs-color-primary, #3D61E3);
313
+ box-shadow: 0 0 0 2px rgba(61, 97, 227, 0.1);
314
314
  }
315
315
 
316
316
  .editor-wrapper.preview {
@@ -319,14 +319,20 @@
319
319
  background: transparent;
320
320
  }
321
321
 
322
+ .editor-wrapper.is-edit {
323
+ border: 1px solid #dcdfe6;
324
+ border-radius: 3px;
325
+ background: #fff;
326
+ }
327
+
322
328
  .editor-wrapper.preview .editor-content {
323
329
  padding: 8px 12px;
324
330
  min-height: unset;
325
331
  }
326
332
 
327
333
  .editor-content {
328
- padding: 16px 20px;
329
- min-height: 200px;
334
+ padding: 12px 16px;
335
+ min-height: 80px;
330
336
  cursor: text;
331
337
  }
332
338
 
@@ -372,7 +378,7 @@
372
378
  width: 24px;
373
379
  height: 24px;
374
380
  border: 2px solid #e3e3e3;
375
- border-top-color: #1e96fc;
381
+ border-top-color: var(--qxs-color-primary, #3D61E3);
376
382
  border-radius: 50%;
377
383
  animation: spin 0.8s linear infinite;
378
384
  }
@@ -506,13 +512,13 @@
506
512
  }
507
513
 
508
514
  .ProseMirror a {
509
- color: #1e96fc;
515
+ color: var(--qxs-color-primary, #3D61E3);
510
516
  text-decoration: underline;
511
517
  cursor: pointer;
512
518
  }
513
519
 
514
520
  .ProseMirror img.ProseMirror-selectednode {
515
- outline: 2px solid #1e96fc;
521
+ outline: 2px solid var(--qxs-color-primary, #3D61E3);
516
522
  }
517
523
 
518
524
  /* Table styles */
@@ -571,7 +577,7 @@
571
577
 
572
578
  .table-cell-toolbar-btn:hover {
573
579
  background: #ecf5ff;
574
- color: #1e96fc;
580
+ color: var(--qxs-color-primary, #3D61E3);
575
581
  }
576
582
 
577
583
  .table-cell-toolbar-btn.danger:hover {
@@ -599,8 +605,8 @@
599
605
 
600
606
  .table-edge-add:hover {
601
607
  background: #ecf5ff;
602
- border-color: #1e96fc;
603
- color: #1e96fc;
608
+ border-color: var(--qxs-color-primary, #3D61E3);
609
+ color: var(--qxs-color-primary, #3D61E3);
604
610
  }
605
611
 
606
612
  .table-edge-add.visible {
@@ -672,7 +678,7 @@
672
678
  }
673
679
 
674
680
  .bubble-btn.is-active {
675
- background: #1e96fc;
681
+ background: var(--qxs-color-primary, #3D61E3);
676
682
  color: #fff;
677
683
  }
678
684
 
@@ -774,7 +780,7 @@
774
780
  }
775
781
 
776
782
  .bubble-dropdown-item.is-active {
777
- background: #1e96fc;
783
+ background: var(--qxs-color-primary, #3D61E3);
778
784
  color: #fff;
779
785
  }
780
786
 
@@ -809,7 +815,7 @@
809
815
 
810
816
  .table-grid-preview .table-cell:hover {
811
817
  background: rgba(30, 150, 252, 0.3);
812
- border-color: #1e96fc;
818
+ border-color: var(--qxs-color-primary, #3D61E3);
813
819
  }
814
820
 
815
821
  .table-grid-preview .table-cell.selected {
@@ -855,7 +861,7 @@
855
861
 
856
862
  .image-toolbar-btn:hover {
857
863
  background: #f5f5f5;
858
- color: #1e96fc;
864
+ color: var(--qxs-color-primary, #3D61E3);
859
865
  }
860
866
 
861
867
  .image-toolbar-btn.danger:hover {
@@ -911,7 +917,7 @@
911
917
 
912
918
  .image-more-menu-item:hover {
913
919
  background: #f5f5f5;
914
- color: #1e96fc;
920
+ color: var(--qxs-color-primary, #3D61E3);
915
921
  }
916
922
 
917
923
  .image-more-menu-item svg {
@@ -924,8 +930,8 @@
924
930
 
925
931
  /* Selected Image */
926
932
  .ProseMirror img.selected {
927
- outline: 2px solid #1e96fc;
933
+ outline: 2px solid var(--qxs-color-primary, #3D61E3);
928
934
  outline-offset: 2px;
929
935
  }
930
- `,A([T.property({type:String,attribute:"content"})],exports.QxsBlocksuiteEditor.prototype,"content",2),A([T.property({type:Boolean,attribute:"readonly"})],exports.QxsBlocksuiteEditor.prototype,"readonly",2),A([T.property({type:Boolean,attribute:"preview"})],exports.QxsBlocksuiteEditor.prototype,"preview",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_pendingContent",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_hoverRow",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_hoverCol",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_tableDropdownOpen",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_isLoading",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_tableCellToolbar",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_tableEdgeHover",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_imageToolbar",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_imageMoreMenuVisible",2),A([M.state()],exports.QxsBlocksuiteEditor.prototype,"_hasSlashCommand",2),exports.QxsBlocksuiteEditor=A([$.safeCustomElement("qxs-blocksuite-editor")],exports.QxsBlocksuiteEditor);
936
+ `,E([T.property({type:String,attribute:"content"})],exports.QxsBlocksuiteEditor.prototype,"content",2),E([T.property({type:Boolean,attribute:"readonly"})],exports.QxsBlocksuiteEditor.prototype,"readonly",2),E([T.property({type:Boolean,attribute:"preview"})],exports.QxsBlocksuiteEditor.prototype,"preview",2),E([T.property({type:Boolean,attribute:"is-edit"})],exports.QxsBlocksuiteEditor.prototype,"isEdit",2),E([T.property({type:Object,attribute:"upload-image"})],exports.QxsBlocksuiteEditor.prototype,"uploadImage",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_pendingContent",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_hoverRow",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_hoverCol",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_tableDropdownOpen",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_isLoading",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_tableCellToolbar",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_tableEdgeHover",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_imageToolbar",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_imageMoreMenuVisible",2),E([M.state()],exports.QxsBlocksuiteEditor.prototype,"_hasSlashCommand",2),exports.QxsBlocksuiteEditor=E([$.safeCustomElement("qxs-blocksuite-editor")],exports.QxsBlocksuiteEditor);
931
937
  //# sourceMappingURL=blocksuite-editor.cjs.map