修改textinput和textarea的回调函数
This commit is contained in:
parent
f06c82085e
commit
0e372e9068
2 changed files with 4 additions and 2 deletions
|
@ -178,6 +178,7 @@ export default class PluginSample extends Plugin {
|
||||||
title: "Readonly text",
|
title: "Readonly text",
|
||||||
description: "Input description",
|
description: "Input description",
|
||||||
action: {
|
action: {
|
||||||
|
// Called when focus is lost and content changes
|
||||||
callback: () => {
|
callback: () => {
|
||||||
// Return data and save it in real time
|
// Return data and save it in real time
|
||||||
let value = this.settingUtils.takeAndSave("Input")
|
let value = this.settingUtils.takeAndSave("Input")
|
||||||
|
@ -191,6 +192,7 @@ export default class PluginSample extends Plugin {
|
||||||
type: "textarea",
|
type: "textarea",
|
||||||
title: "Readonly text",
|
title: "Readonly text",
|
||||||
description: "Input description",
|
description: "Input description",
|
||||||
|
// Called when focus is lost and content changes
|
||||||
action: {
|
action: {
|
||||||
callback: () => {
|
callback: () => {
|
||||||
// Read data in real time
|
// Read data in real time
|
||||||
|
|
|
@ -212,7 +212,7 @@ export class SettingUtils {
|
||||||
let textInputElement: HTMLInputElement = document.createElement('input');
|
let textInputElement: HTMLInputElement = document.createElement('input');
|
||||||
textInputElement.className = 'b3-text-field fn__flex-center fn__size200';
|
textInputElement.className = 'b3-text-field fn__flex-center fn__size200';
|
||||||
textInputElement.value = item.value;
|
textInputElement.value = item.value;
|
||||||
textInputElement.onkeyup = item.action?.callback ?? (() => { });
|
textInputElement.onchange = item.action?.callback ?? (() => { });
|
||||||
itemElement = textInputElement;
|
itemElement = textInputElement;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -220,7 +220,7 @@ export class SettingUtils {
|
||||||
let textareaElement: HTMLTextAreaElement = document.createElement('textarea');
|
let textareaElement: HTMLTextAreaElement = document.createElement('textarea');
|
||||||
textareaElement.className = "b3-text-field fn__block";
|
textareaElement.className = "b3-text-field fn__block";
|
||||||
textareaElement.value = item.value;
|
textareaElement.value = item.value;
|
||||||
textareaElement.onkeyup = item.action?.callback ?? (() => { });
|
textareaElement.onchange = item.action?.callback ?? (() => { });
|
||||||
itemElement = textareaElement;
|
itemElement = textareaElement;
|
||||||
break;
|
break;
|
||||||
case 'number':
|
case 'number':
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue