jsf - 使用退格键从 p:textEditor 中删除文本
问题描述
我想实现一种用户可以用来做笔记的便利贴功能。我通过在底部带有“保存”和“取消”按钮的对话框中打开 p:textEditor 来实现这一点。这大部分工作正常,唯一的问题是我无法使用退格键删除 textEditor 中的文本。使用 del 键删除工作正常。
这是我的代码:
打开包含 textEditor 的对话框的命令按钮:
<p:commandButton value="openPostit" widgetVar="openPostit"
onsuccess="PF('frmPostit').show();"
/>
对话框:
<h:form id="frmPostit">
<p:dialog id="dlgPostit" widgetVar="dlPostit"
dynamic="false" modal="false"
fitViewport="false" resizable="true"
closable="true"
onHide="$('#frmPostit\\:quit').click();">
<p:hotkey bind="esc" handler="PF('dlgPostit').hide();" />
<p:outputPanel>
<p:textEditor id="textPostit" widgetVar="textPostit"
value="#{backingbean.text}"
style="vertical-align: top; height: 450px">
</p:textEditor>
<div style="position: absolute; bottom: 10px" >
<p:commandButton value="Save"
actionListener="#{backingbean.saveText()}"
accesskey="s"
process="@form"
icon="fa fa-check-square-o"
oncomplete="PF('dlgPostit').hide();}"
/>
<p:commandButton value="Cancel" id="quit"
icon="fa fa-close"
process="@this" resetValues="true"
immediate="true"
accesskey="a"
oncomplete="PF('dlgPostit').hide();" />
</div>
</p:outputPanel>
</p:dialog>
</h:form>
知道为什么退格键不会删除 textEditor 中的文本吗?
编辑:我发现可能有趣的附加信息:我可以使用退格键(但不是文本)删除换行符
解决方案
推荐阅读
- html - 有没有办法将 html 部分链接到 html 文件?
- java - 将 HashMap 保存到文件
- c - 带有字符串的循环并输出到C中的唯一配置?
- java - 如何使用 selenium-webdriver 和 Java 定位元素
- batch-file - 每 39 个字符后插入一个竖线分隔符
- android - 有没有办法可以在不将旧图像删除到 Firebase 存储的情况下上传图像?
- java - glfwSwapBuffers 很慢
- java - 从java转换后如何修复typescript类文件错误?
- javascript - 使用 lodash 或其他 lib 引用其他属性的 Javascript 递归转换对象
- javascript - 克隆后更改原始对象