|
|
@@ -72,6 +72,28 @@ function onInsertion() {
|
|
|
const text = purnText(getSelectedText() || props.data.content)
|
|
|
emits("insert", text)
|
|
|
}
|
|
|
+
|
|
|
+function section(content: string, number: number) {
|
|
|
+ let tag: string = "</span><br/>";
|
|
|
+ let section: string = "<span style='padding-left: 2em;'>";
|
|
|
+
|
|
|
+ let result: string = ""
|
|
|
+ let sentenceArr: string[] | null = content.match(/。/g);
|
|
|
+ if (sentenceArr && sentenceArr.length > number) {
|
|
|
+ let length = sentenceArr.length;
|
|
|
+ for (let i = 0; i < length; i++) {
|
|
|
+ if (i > 0 && i % number == 0) {
|
|
|
+ result += (section + tag);
|
|
|
+ section= "<span style='padding-left: 2em;'>";
|
|
|
+ }
|
|
|
+ let index = content.indexOf("。");
|
|
|
+ section += content.slice(0, index+1);
|
|
|
+ content = content.slice(index+1);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ return content;
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<template>
|
|
|
@@ -92,7 +114,7 @@ function onInsertion() {
|
|
|
<h4 class="section-title" v-html="data.section"></h4>
|
|
|
<div class="content-wrap" :class="{'used': used}">
|
|
|
<exclamation-circle-filled v-if="used" />
|
|
|
- <span class="content" v-html="data.content"></span>
|
|
|
+ <span class="content" v-html="section(data.content, 3)"></span>
|
|
|
</div>
|
|
|
<div class="btn-group">
|
|
|
<a-radio-group>
|