This commit is contained in:
2020-04-17 20:07:26 +00:00
parent 4c06f274ab
commit 8110051dde
2 changed files with 21 additions and 7 deletions

View File

@@ -165,7 +165,7 @@ export default {
return (
source.slice(0, start) +
newSubStr +
this.slice(start + Math.abs(delCount))
source.slice(start + Math.abs(delCount))
);
},

View File

@@ -66,6 +66,7 @@
<v-textarea
ref="editArea"
@input="handleInput"
@dblclick="handleDoubleClick"
v-model="localVal"
auto-grow
></v-textarea>
@@ -119,7 +120,7 @@ export default {
this.selection.end
);
}
return selectedText;
return selectedText; //.trim();
},
replaceSelectedText(newString) {
// @param {String} source string
@@ -128,10 +129,10 @@ export default {
// @param {string} newSubStr The String that is spliced in.
// @return {string} A new string with the spliced substring.
//stringSplice: function(source, start, delCount, newSubStr) {
//says replace but in some cases it's just an insert if there is no selection:
//has a selection so replace it is:
//says replace but in some cases it's just an insert if there is no selection:
//has a selection so replace it is:
this.localVal = window.$gz.util.stringSplice(
this.localVal,
@@ -142,14 +143,27 @@ export default {
},
clickBold() {
this.updateSelectedRange();
console.log("BOLD CLICK, selection:", this.getSelectedText());
this.replaceSelectedText("**" + 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) {
this.$emit("input", val);
this.localVal = val;
},
switchViewIcon() {
//return the icon that indicates what it will change to if you click it
//mirror of switchview below