feat(文书编辑): 支持插入勾选框与占位符片段
This commit is contained in:
@@ -97,7 +97,14 @@ function handleCampusChange() {
|
||||
}
|
||||
}
|
||||
|
||||
function insertPlaceholder(text: string) {
|
||||
// 勾选框与占位符走同一个 EditorPaneHandle.insertText:光标停在表格单元格里,
|
||||
// 插入的内容就落在这个单元格,签署时由渲染管线转为可交互选项。
|
||||
const choiceSnippets = [
|
||||
{ label: '勾选框 □', text: '□', title: '在光标处插入一个勾选框' },
|
||||
{ label: '二选一 □是 □否', text: '□是 □否', title: '插入一对互斥选项,可自行改文字' },
|
||||
]
|
||||
|
||||
function insertContent(text: string) {
|
||||
paneRef.value?.insertText(text)
|
||||
}
|
||||
|
||||
@@ -227,12 +234,27 @@ function save() {
|
||||
:key="item"
|
||||
type="button"
|
||||
class="placeholder-chip"
|
||||
@click="insertPlaceholder(item)"
|
||||
@click="insertContent(item)"
|
||||
>
|
||||
{{ item }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="meta-field">
|
||||
<span>插入勾选框</span>
|
||||
<div class="placeholder-row">
|
||||
<button
|
||||
v-for="snippet in choiceSnippets"
|
||||
:key="snippet.label"
|
||||
type="button"
|
||||
class="placeholder-chip"
|
||||
:title="snippet.title"
|
||||
@click="insertContent(snippet.text)"
|
||||
>
|
||||
{{ snippet.label }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="editor-shell">
|
||||
@@ -255,7 +277,7 @@ function save() {
|
||||
/>
|
||||
<span v-if="importMessage" class="docx-message">{{ importMessage }}</span>
|
||||
<span v-else class="docx-hint">
|
||||
建议从 Word/WPS 中全选复制文书后直接粘贴到下方编辑区;需要患者勾选的条目请做成表格——表头第一行写「勾选」,旁边一列写「项目」,签署时该列会自动转为勾选框。
|
||||
建议从 Word/WPS 中全选复制文书后直接粘贴到下方编辑区;需要患者勾选的内容可点上方「插入勾选框」按钮插入(光标停在表格单元格里就插到该单元格),或用表头含「勾选」列的表格承载。
|
||||
</span>
|
||||
</div>
|
||||
<div class="editor-area">
|
||||
|
||||
Reference in New Issue
Block a user