[英]SlateJS: slate-core Editor not updating value for simulated onKeyDown events
我正在嘗試從slate-core
模擬Editor
上的onKeyDown
事件——而不是slate-react
來測試我正在開發的一些插件。 但是, Editor
不會更新其Value
。
我已經廣泛瀏覽了 SlateJS 0.47.x
文檔,並從我可以告訴Editor
組件應該立即響應onKeyDown
事件。
^ 請注意,盡管我試圖模擬許多onKeyDown
事件——在文件core-editor-is-not-responding-to-on-key-down-events.js
—— Editor
的值永遠不會更新; 它仍然是一個空白文件。
我擔心這種行為上的差異,因為似乎我需要重寫插入文本的功能,因為當我認為所述功能已經存在時,它會被輸入。
任何幫助將不勝感激!
所以事實證明這是 Slate-Core 中的一個錯誤,正如@devinm 所提到的。 沒有 Slate-React,它不會對onKeyDown
做出正確的反應。
我不知道如何將它捆綁起來供其他人使用,而且這個問題會影響許多 Slate 版本,所以我認為最好的辦法是解釋需要做什么。 請注意,您的環境需要支持 ES6 導入。
slate-react-dom-plugin
的新文件夾中slate-react-dom-plugin/index.js
文件旁邊的路徑中 - utils
和constants
(同樣來自 slate-react)import DOMPlugin from './slate-react-dom-plugin'
new Editor({
value: value
plugins: [DOMPlugin({ plugins: [...ANY_OTHER_PLUGINS] })], // Wrap any plugins you use with the DOMPlugin
});
onKeyDown
事件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.