|
@@ -47,6 +47,8 @@
|
|
|
<el-button type="primary">校对拼音</el-button>
|
|
|
</el-form-item>
|
|
|
</el-form>
|
|
|
+ <!-- @fillTonePinyin="fillTonePinyin" -->
|
|
|
+ <CorrectPinyin :visible.sync="visible" :select-content="selectContent" />
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -54,9 +56,14 @@
|
|
|
import SettingMixin from '@/views/book/courseware/create/components/common/SettingMixin';
|
|
|
import { viewMethodList, pinyinPositionList, snGenerationMethodList } from '@/views/book/courseware/data/common';
|
|
|
import { getDescribeProperty } from '@/views/book/courseware/data/describe';
|
|
|
+import tinymce from 'tinymce/tinymce';
|
|
|
+import CorrectPinyin from '../common/CorrectPinyin.vue';
|
|
|
|
|
|
export default {
|
|
|
name: 'DescribeSetting',
|
|
|
+ components: {
|
|
|
+ CorrectPinyin,
|
|
|
+ },
|
|
|
mixins: [SettingMixin],
|
|
|
data() {
|
|
|
return {
|
|
@@ -65,9 +72,45 @@ export default {
|
|
|
snGenerationMethodList,
|
|
|
labelPosition: 'left',
|
|
|
property: getDescribeProperty(),
|
|
|
+ selectContent: '',
|
|
|
+ visible: false,
|
|
|
+ content: '',
|
|
|
};
|
|
|
},
|
|
|
- methods: {},
|
|
|
+ methods: {
|
|
|
+ // 校对拼音
|
|
|
+ correctPinyin() {
|
|
|
+ let editor = tinymce.editors[this.param.richId];
|
|
|
+ let content = editor.selection.getContent();
|
|
|
+ if (content) {
|
|
|
+ this.visible = true;
|
|
|
+ this.selectContent = content;
|
|
|
+ }
|
|
|
+ },
|
|
|
+ // 回填校对后的拼音
|
|
|
+ // fillTonePinyin(tonePinyin) {
|
|
|
+ // let richId = this.param.richId;
|
|
|
+ // let editor = tinymce.editors[richId];
|
|
|
+ // editor.selection.setContent(`${this.selectContent}(${tonePinyin})`);
|
|
|
+ // this.searchText(editor, `${this.selectContent}(${tonePinyin})`);
|
|
|
+ // debugger;
|
|
|
+ // let pinyinText = document.getElementById(`${richId}_pinyin_text`);
|
|
|
+ // const targetElements = pinyinText.querySelectorAll('.text');
|
|
|
+ // let viewText = '';
|
|
|
+ // targetElements.forEach((element) => {
|
|
|
+ // viewText += element.innerText;
|
|
|
+ // });
|
|
|
+ // console.log(viewText);
|
|
|
+ // },
|
|
|
+ // searchText(editor, textToFind) {
|
|
|
+ // const content = editor
|
|
|
+ // .getContent()
|
|
|
+ // .replace(/<[^>]+>/g, '')
|
|
|
+ // .replace(/\n/g, '');
|
|
|
+ // let index = content.indexOf(textToFind);
|
|
|
+ // console.log(index);
|
|
|
+ // },
|
|
|
+ },
|
|
|
};
|
|
|
</script>
|
|
|
|