1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-23 18:17:20 +00:00

Provide actionValue variable to actions fired by EditTextWidget (#6145)

* feat: provide actionValue variable to actions fired by EditTextWidget

* also extend CodeMirror engine to set actionValue variable when invoking actions
This commit is contained in:
Saq Imtiaz 2021-10-28 20:15:50 +02:00 committed by GitHub
parent d3522854b6
commit b5c81d2721
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -205,7 +205,7 @@ FramedEngine.prototype.handleInputEvent = function(event) {
this.widget.saveChanges(this.getText()); this.widget.saveChanges(this.getText());
this.fixHeight(); this.fixHeight();
if(this.widget.editInputActions) { if(this.widget.editInputActions) {
this.widget.invokeActionString(this.widget.editInputActions); this.widget.invokeActionString(this.widget.editInputActions,this,event,{actionValue: this.getText()});
} }
return true; return true;
}; };

View File

@ -133,7 +133,7 @@ SimpleEngine.prototype.handleInputEvent = function(event) {
this.widget.saveChanges(this.getText()); this.widget.saveChanges(this.getText());
this.fixHeight(); this.fixHeight();
if(this.widget.editInputActions) { if(this.widget.editInputActions) {
this.widget.invokeActionString(this.widget.editInputActions); this.widget.invokeActionString(this.widget.editInputActions,this,event,{actionValue: this.getText()});
} }
return true; return true;
}; };

View File

@ -33,7 +33,7 @@ The content of the `<$edit-text>` widget is ignored.
|minHeight |Minimum height for automatically resized `textarea` editors, specified in CSS length units such as "px", "em" or "%" | |minHeight |Minimum height for automatically resized `textarea` editors, specified in CSS length units such as "px", "em" or "%" |
|rows|Sets the rows attribute of a generated textarea | |rows|Sets the rows attribute of a generated textarea |
|cancelPopups |<<.from-version "5.1.23">> if set to "yes", cancels all popups when the input gets focus | |cancelPopups |<<.from-version "5.1.23">> if set to "yes", cancels all popups when the input gets focus |
|inputActions |<<.from-version 5.1.23>> Optional actions that are triggered every time an input event occurs within the input field or textarea | |inputActions |<<.from-version 5.1.23>> Optional actions that are triggered every time an input event occurs within the input field or textarea.<br><<.from-version "5.2.1">> The variable `actionValue` is available to the `inputActions` and contains the value of the input field. |
|refreshTitle |<<.from-version 5.1.23>> An optional tiddler title that makes the input field update whenever the specified tiddler changes | |refreshTitle |<<.from-version 5.1.23>> An optional tiddler title that makes the input field update whenever the specified tiddler changes |
|disabled|<<.from-version "5.1.23">> Optional, disables the text input if set to "yes". Defaults to "no"| |disabled|<<.from-version "5.1.23">> Optional, disables the text input if set to "yes". Defaults to "no"|
|fileDrop|<<.from-version "5.2.0">> Optional. When set to "yes" allows dropping or pasting images into the editor to import them. Defaults to "no"| |fileDrop|<<.from-version "5.2.0">> Optional. When set to "yes" allows dropping or pasting images into the editor to import them. Defaults to "no"|

View File

@ -122,7 +122,7 @@ function CodeMirrorEngine(options) {
this.cm.on("change",function() { this.cm.on("change",function() {
self.widget.saveChanges(self.getText()); self.widget.saveChanges(self.getText());
if(self.widget.editInputActions) { if(self.widget.editInputActions) {
self.widget.invokeActionString(self.widget.editInputActions); self.widget.invokeActionString(self.widget.editInputActions,this,event,{actionValue: this.getText()});
} }
}); });