简体   繁体   English

TinyMCE:格式的自定义字符?

[英]TinyMCE: Custom characters for format?

I want to change the behaviour for the "BOLD" - Format. 我想更改“ BOLD”格式的行为。 Instead of wrapping 而不是包装

<b>text</b>

around it, it should instead wrap 它周围应该包裹

*text*

around it. 周围。 I found examples to wrap other html-Tags than the default, but not how to wrap simple characters. 我发现了一些示例,用于包装除默认值以外的其他html-Tag,但是没有包装简单字符的方法。

One of those examples: bold: {inline: 'span', 'classes': 'bold'}, 这些示例之一: bold: {inline: 'span', 'classes': 'bold'},

To my knowledge, this isn't really possible without changing the library, making an undocumented library call or building some JS to hook into TinyMCE's output. 据我所知,如果不更改库,进行未记录的库调用或构建一些JS以连接到TinyMCE的输出中,这实际上是不可能的。 Neither of these are options you should really consider; 这些都不是您应该真正考虑的选择。 they could break as soon as you try and update the library. 您尝试更新库时,它们可能会损坏。 And being unable to update the library means you won't be able to opt into bugfixes and the like. 无法更新库意味着您将无法选择错误修正等。

The API for custom formats is documented here: http://www.tinymce.com/wiki.php/configuration:formats 自定义格式的API记录在这里: http : //www.tinymce.com/wiki.php/configuration :formats

Is your intention to allow users to submit markdown formatted text to a server? 您是否打算允许用户向服务器提交降价格式的文本? If so, I wonder if you might have to perform reparsing. 如果是这样,我想知道您是否必须执行重新解析。 I know of one project that offers this: https://github.com/hgilani/html2markdown . 我知道有一个提供此功能的项目: https : //github.com/hgilani/html2markdown Not sure if it suits your needs, though. 不过,不确定是否适合您的需求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM