admin管理员组文章数量:1122832
`_getPluginListItemsDefinitons() { const editor = this.editor; const locale = editor.locale;
this._dropdown = createDropdown(locale);
this._commandItems = [];
const commandNames = ['bold','italic','underline','horizontalLine','bulletedList','numberedList','insertTable','codeBlock','paragraph','table','subscript','superscript','widgetBox'];
commandNames.forEach((commandName) => {
const command = editormands.get(commandName);
if (command) {
const buttonModel = {
type: 'button',
model: {
label: commandName.charAt(0).toUpperCase() + commandName.slice(1),
withText: true,
icon: icons[commandName] || icons.cog,
commandName: commandName,
},
};
this._commandItems.push(buttonModel);
}
});
this._commandItems.sort((a, b) => {
return a.model.label.localeCompare(b.model.label);
});
this._addItemsToDropdown(this._commandItems);
this._createCustomToClass();
this._dropdown.isOpen = true;
if(this._dropdown.isOpen === true){
this._dropdown.render();
this._dropdown.element.focus();
this.focusTracker = new FocusTracker();
this.focusTracker.isFocused();
console.log("focus:", this.focusTracker);
this.focusables = new ViewCollection();
this.keystrokes = new KeystrokeHandler();
this.focusCycler = new FocusCycler({
focusables: this._commandItems,
focusables: this._dropdown.element,
focusables: this._dropdown.panelView,
focusTracker: this.focusTracker,
focusTracker: this._dropdown.panelView,
keystrokeHandler: this.keystrokes,
actions: {
focusPrevious: ['arrowup'],
focusNext: ['arrowdown']
}
});
}
this.listenTo(this._dropdown, 'execute', (evt, data) => {
const commandName = evt.sourcemandName;
if (commandName) {
this.customExecution(commandName);
if (!this._dropdown.isOpen) {
editor.editing.view.focus();
}
}
this._dropdown.isOpen = false;
this.hideDropdown();
});
}
The focus should change from the editor to dropdown panel after dropdown opened. it's not like user clicking the toolbar button and showing the dropdown. i am showing the dropdown after enter (.) special character.`
版权声明:本文标题:plugins - How to place focus after opening dropdowns in slash command. have tried so many things - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736282731a1926737.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论