|
@@ -63,6 +63,14 @@
|
|
@change="addImage"
|
|
@change="addImage"
|
|
/>
|
|
/>
|
|
</div>
|
|
</div>
|
|
|
|
+ <div class="edit-menu-item">
|
|
|
|
+ <img
|
|
|
|
+ class="intLink"
|
|
|
|
+ title="特殊字符"
|
|
|
|
+ src="../../img/menu_spechar.png"
|
|
|
|
+ @mousedown="addSpechar"
|
|
|
|
+ />
|
|
|
|
+ </div>
|
|
<div v-if="$parent.enableAudio" class="edit-menu-item">
|
|
<div v-if="$parent.enableAudio" class="edit-menu-item">
|
|
<img
|
|
<img
|
|
class="intLink"
|
|
class="intLink"
|
|
@@ -99,6 +107,11 @@
|
|
ref="FormulaDialog"
|
|
ref="FormulaDialog"
|
|
@confirm="formulaConfirm"
|
|
@confirm="formulaConfirm"
|
|
></formula-dialog>
|
|
></formula-dialog>
|
|
|
|
+ <!-- SpecharDialog -->
|
|
|
|
+ <spechar-dialog
|
|
|
|
+ ref="SpecharDialog"
|
|
|
|
+ @confirm="specharConfirm"
|
|
|
|
+ ></spechar-dialog>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
</template>
|
|
|
|
|
|
@@ -108,10 +121,11 @@ import { audioHandle } from "./audio";
|
|
import { imageHandle } from "./image";
|
|
import { imageHandle } from "./image";
|
|
import { answerPointHandle } from "./answerPoint";
|
|
import { answerPointHandle } from "./answerPoint";
|
|
import FormulaDialog from "./FormulaDialog";
|
|
import FormulaDialog from "./FormulaDialog";
|
|
|
|
+import SpecharDialog from "./SpecharDialog";
|
|
|
|
|
|
export default {
|
|
export default {
|
|
name: "VMenu",
|
|
name: "VMenu",
|
|
- components: { FormulaDialog },
|
|
|
|
|
|
+ components: { FormulaDialog, SpecharDialog },
|
|
data() {
|
|
data() {
|
|
return {
|
|
return {
|
|
curEditFocusRange: null,
|
|
curEditFocusRange: null,
|
|
@@ -174,6 +188,28 @@ export default {
|
|
const selection = window.getSelection();
|
|
const selection = window.getSelection();
|
|
return selection.focusNode && this.checkDomInEditor(selection.focusNode);
|
|
return selection.focusNode && this.checkDomInEditor(selection.focusNode);
|
|
},
|
|
},
|
|
|
|
+ // spechar
|
|
|
|
+ addSpechar(event) {
|
|
|
|
+ event.preventDefault();
|
|
|
|
+ if (!this.checkEditorFocus()) {
|
|
|
|
+ window.getSelection().removeAllRanges();
|
|
|
|
+ this.editorFocus();
|
|
|
|
+ }
|
|
|
|
+ this.curEditFocusRange = window.getSelection().getRangeAt(0);
|
|
|
|
+ this.$refs.SpecharDialog.open();
|
|
|
|
+ },
|
|
|
|
+ specharConfirm(result) {
|
|
|
|
+ console.log(result);
|
|
|
|
+ if (!this.curEditFocusRange) {
|
|
|
|
+ const selection = window.getSelection();
|
|
|
|
+ this.curEditFocusRange = selection.getRangeAt(0);
|
|
|
|
+ }
|
|
|
|
+ this.curEditFocusRange.deleteContents();
|
|
|
|
+ this.curEditFocusRange.insertNode(document.createTextNode(result));
|
|
|
|
+ this.curEditFocusRange.collapse();
|
|
|
|
+ this.$parent.emitJSON();
|
|
|
|
+ },
|
|
|
|
+ // formula
|
|
/**
|
|
/**
|
|
* @param {Event} event
|
|
* @param {Event} event
|
|
*/
|
|
*/
|