This commit is contained in:
@@ -165,7 +165,7 @@ export default {
|
|||||||
return (
|
return (
|
||||||
source.slice(0, start) +
|
source.slice(0, start) +
|
||||||
newSubStr +
|
newSubStr +
|
||||||
this.slice(start + Math.abs(delCount))
|
source.slice(start + Math.abs(delCount))
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -66,6 +66,7 @@
|
|||||||
<v-textarea
|
<v-textarea
|
||||||
ref="editArea"
|
ref="editArea"
|
||||||
@input="handleInput"
|
@input="handleInput"
|
||||||
|
@dblclick="handleDoubleClick"
|
||||||
v-model="localVal"
|
v-model="localVal"
|
||||||
auto-grow
|
auto-grow
|
||||||
></v-textarea>
|
></v-textarea>
|
||||||
@@ -119,7 +120,7 @@ export default {
|
|||||||
this.selection.end
|
this.selection.end
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return selectedText;
|
return selectedText; //.trim();
|
||||||
},
|
},
|
||||||
replaceSelectedText(newString) {
|
replaceSelectedText(newString) {
|
||||||
// @param {String} source string
|
// @param {String} source string
|
||||||
@@ -129,9 +130,9 @@ export default {
|
|||||||
// @return {string} A new string with the spliced substring.
|
// @return {string} A new string with the spliced substring.
|
||||||
//stringSplice: function(source, start, delCount, newSubStr) {
|
//stringSplice: function(source, start, delCount, newSubStr) {
|
||||||
|
|
||||||
//says replace but in some cases it's just an insert if there is no selection:
|
//says replace but in some cases it's just an insert if there is no selection:
|
||||||
|
|
||||||
//has a selection so replace it is:
|
//has a selection so replace it is:
|
||||||
|
|
||||||
this.localVal = window.$gz.util.stringSplice(
|
this.localVal = window.$gz.util.stringSplice(
|
||||||
this.localVal,
|
this.localVal,
|
||||||
@@ -142,14 +143,27 @@ export default {
|
|||||||
},
|
},
|
||||||
clickBold() {
|
clickBold() {
|
||||||
this.updateSelectedRange();
|
this.updateSelectedRange();
|
||||||
|
this.replaceSelectedText("**" + this.getSelectedText() + "**");
|
||||||
console.log("BOLD CLICK, selection:", this.getSelectedText());
|
//console.log("BOLD CLICK, selection:", this.getSelectedText());
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleDoubleClick(i) {
|
||||||
|
//the purpose of this is only to change the selection if it's got an extra space to the right
|
||||||
|
//becuase double clicking on a word with another word after it causes the space to be included
|
||||||
|
this.updateSelectedRange();
|
||||||
|
let temp = this.getSelectedText();
|
||||||
|
let tempTrimmed = temp.trimEnd();
|
||||||
|
let diff = temp.length - tempTrimmed.length;
|
||||||
|
if (diff != 0) {
|
||||||
|
//there were some spaces so update the selection range
|
||||||
|
//force selection to be shorter by diff
|
||||||
|
}
|
||||||
|
},
|
||||||
handleInput(val) {
|
handleInput(val) {
|
||||||
this.$emit("input", val);
|
this.$emit("input", val);
|
||||||
this.localVal = val;
|
this.localVal = val;
|
||||||
},
|
},
|
||||||
|
|
||||||
switchViewIcon() {
|
switchViewIcon() {
|
||||||
//return the icon that indicates what it will change to if you click it
|
//return the icon that indicates what it will change to if you click it
|
||||||
//mirror of switchview below
|
//mirror of switchview below
|
||||||
|
|||||||
Reference in New Issue
Block a user