This commit is contained in:
gohabereg 2018-07-20 23:03:37 +03:00
parent f45521df65
commit 8e80021f75
3 changed files with 3801 additions and 9 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -34,6 +34,7 @@ export default class Block {
this.settings = settings;
this.api = apiMethods;
this.holder = this.compose();
this.inputIndex = 0;
/**
* @type {IBlockTune[]}
@ -106,6 +107,26 @@ export default class Block {
return this.save();
}
get inputs() {
const collection = this.holder.querySelectorAll('[contenteditable], input, textarea');
return _.array(collection);
}
get nextInput() {
const inputs = this.inputs;
this.inputIndex = Math.min(inputs.length - 1, this.inputIndex + 1);
return inputs[this.inputIndex];
}
get previousInput() {
this.inputIndex = Math.max(0, this.inputIndex - 1);
return this.inputs[this.inputIndex];
}
/**
* is block mergeable
* We plugin have merge function then we call it mergable