问题标签 [wysihtml5]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
1631 浏览

jquery - bootstrap-wysihtml5-rails 自定义按钮

在我的项目中,我们使用bootstrap-wysihtml编辑器进行富文本编辑。我使用以下代码初始化编辑器,

我需要向编辑器添加一个自定义按钮,其工作方式类似于insertLink,但允许用户仅输入链接的文本,并且该链接将由应用程序为用户插入。

非常感谢任何帮助。

0 投票
0 回答
114 浏览

ruby-on-rails - 将格式另存为 html

我正在使用wysihtml5bootsrap-wysihtml5-rails作为文本编辑器。这将是一个双管齐下的问题。我在表单中有粗体/斜体/下划线等,但它不保存为 html。它看起来像这样:

什么时候应该是这样的:

标题

我应该添加什么来将表单保存为 html?

第二个问题:图片上传需要一个链接,然后用图片标签包装它们。有什么方法可以代替我上传图像(通过回形针)?

这是我的表格:

评论.js.coffee:

0 投票
1 回答
513 浏览

javascript - inject into iframe from wysihtml5 text area

I've turned a simple text box into one with editing features using the wysihtml5 editor. The project necessitates that the text box inject its html into an iframe. Previous to installing the editor, things were working great. Now, the jQuery for the iframe injection no longer works, since the editor has converted the textarea to an iframe. Any ideas on how I might convert the following jQuery to work with the editor?

I know that something needs to change in the $('textarea').focus call, I just don't know what. I'm new to the javascript/jQuery world and have tried a few possibilities, but so far haven't been able to figure this one out.

Many thanks for any insight.

0 投票
1 回答
955 浏览

jquery - wysihtml5 和淘汰赛给出空的 iframe

使用Nicholas Jackson 的 bindingHandler实现wysihtml5和淘汰赛时。这种作品,css仍然有点乱,但没有什么是我无法修复的。

文本区域的 Html:

我遇到的问题是 iframe 已呈现,但我无法再在该字段中输入,没有 textarea,里面什么都没有:

残疾人区

这个 iframe 的 HTML由插件渲染(使用 chrome 开发者工具)

正在呈现的脚本是: 在此处输入图像描述

0 投票
1 回答
1275 浏览

javascript - wysihtml5 覆盖链接对话行为

我希望能够使用 wysihtml5 添加任意文本作为链接href。例如:我想生成这个<a href="[~55~]">link</a>

我已经想出了如何做到这一点 - 这是我正在做的一个简化示例:

我现在遇到的问题是,在创建链接后,当在编辑器中选择此链接时,对话框将链接显示为“http://current_url/[~55~]”。我希望它只显示“[~55~]”。

我试图将一个新事件绑定到编辑器中的链接,但我不知道如何做到这一点(因为它们在 iframe 中)。

如何让 wysihtml5 链接对话框显示链接地址而不显示当前 url?

0 投票
1 回答
368 浏览

ruby-on-rails - 如何在视图中包含来自 wysihtml5 的 html?

我使用 wysihtml5 gem 准备了文本内容,我想在 div 中显示。问题是如何“渲染”这个文本内容,以保证“安全”。我应该使用

或者

或者

或者...

0 投票
0 回答
196 浏览

android - 为什么 wysihtml5 插件不能在安卓浏览器上运行?

我正在使用此处找到的 wysihtml5 插件。它适用于除 Android 以外的所有平台。我无法让它在 Android chrome 或默认的 Android 浏览器上运行。我猜这可能与 iFrame 的使用有关?有人对此有解决方案或更好的插件可以在 Android 和其他平台上运行吗?通过在 Android 设备上转到前面提到的链接,可以看到该问题。

谢谢

0 投票
0 回答
264 浏览

javascript - xing / wysihtml5 取消转义 < 和 >

我正在尝试使用 xing/wysihtml5 在我的后端编辑博客条目。一些条目包含代码示例,包括 PHP、HTML 和 JavaScript。在数据库中,pre/code 中的所有 < 和 > 都写为 < 和> 但是,一旦我将记录加载到 wysihtml5 中,< 和> 替换为 < 和 >

例子:

如果 < 和> 它被替换我在编辑器中得到一个空行。我没有找到任何提示,它被替换了。

编辑

如果我替换 < 与 &lt; 在数据库中,它被替换为 < 在编辑器中,我可以使用它,但这会削弱前端渲染:

好吧,我可以在加载到编辑器之前和写回数据库之前进行搜索和替换,但这将是废话。

0 投票
1 回答
859 浏览

regex - Regular expression to find all DOM event listeners

I am actually trying to make the result of a wysihtml5 editor secure.
Basically, users cannot enter script/forms/etc tags.

I cannot remove all tags as some of them are used to display the content as wished.
(eg : <h1> to display a title)

The problem is that users are still able to add DOM event listeners binded to some unwanted code.
(eg : <h1 onclick="alert('Houston, got a problem');"></h1>)

I would like to remove all event listeners inside a div (for all descendants inside that div).
The solution I actually tried to use is to check the code as a string to find and replace unwanted content, which worked for the unwanted tags.

What I actually need is a regex matching all event listeners inside all tags.
Something like "select all [on*] between < and >".
Examples :
<h1 onclick=""></h1> => Should match
<h1 onnewevent=""></h1> => Should match
<h1>onclick=""</h1> => Should NOT match

Thanks in advance for your help ;)

0 投票
1 回答
1041 浏览

wysihtml5 - 属性在 HTML 代码中被删除

我使用 wysihtml5。插入图像时

结果是

图像规则

如何使属性一般不被删除?