我有一些我想添加的预设颜色,这与我网站的主题一致.如何更改TinyMce中的默认字体调色板?
screenshot-with-shadow.png http://img407.imageshack.us/img407/4526/screenshotwithshadow.png
我正在构建一个自定义RTE,将用户输入转换为homebrewn标记,现在白痴,我使用iframe与designMode ="On",并使用styleWithCSS = false让它在firefox中工作,这样我就可以轻松转换的<b>(是的.b :()到我的标记,然后这些输出正确的代码,而不是我不得不从读<span style="...我现在的问题是,我似乎无法找到的东西,看起来还是就像styleWithCSS =假的IE,Chrome浏览器或Opera,欢迎任何建议.
如何调用tinymce插件函数?
tinymce.activeEditor.plugins.customplugin.customfunction(customvar);
Run Code Online (Sandbox Code Playgroud)
不工作!
我想删除在ckeditor中默认包装img标签的p标签。
我不想完全禁用p标签或将EnterMode更改为另一个标签。我只想停止将图片换成段落。
我想要完成此操作的客户端,而不是服务器端。
我有:
<p>Some text in a parapgraph.</p>
<p><img src="picture.jpg"></p>
<p>Another paragraph</p>
Run Code Online (Sandbox Code Playgroud)
我想要:
<p>Some text in a parapgraph.</p>
<img src="picture.jpg">
<p>Another paragraph</p>
Run Code Online (Sandbox Code Playgroud) 根据文档,我想使用此设置覆盖预定义格式:
formats: {
bold : {inline : 'b' },
italic : {inline : 'i' },
underline: { inline: 'u' }
},
Run Code Online (Sandbox Code Playgroud)
我在编辑器中插入"这是一个文本"并按下划线按钮.这是结果(这也会保存到数据库中):
<p>thi<span style="text-decoration: underline;">s is a t</span>ext</p>
Run Code Online (Sandbox Code Playgroud)
为什么我没有获得u-tag,但预定义的跨度带有下划线样式?我如何在这里获得可爱的u-tag?
编辑: 我知道u-tags已被弃用,但出于兼容性原因我需要它们!
编辑2:我的解决方案归功于公认的答案:
我能够使用legacyoutput插件中的一些代码.我使用了i nline_styles设置
inline_styles: false,
Run Code Online (Sandbox Code Playgroud)
另外我将以下代码插入我的插件onInit中
serializer = ed.serializer;
// Force parsing of the serializer rules
serializer._setup();
// Check that deprecated elements are allowed if not add them
tinymce.each('b,i,u'.split(','), function(name) {
var rule = serializer.rules[name];
if (!rule) serializer.addRules(name);
});
Run Code Online (Sandbox Code Playgroud) 我遇到的问题是,当我加载我的页面时,我立即收到错误: this.getDoc() is null
该函数getBody()的Editor.js被调用和文件似乎是不可用
getBody : function() {
return this.bodyElement || this.getDoc().body;
},
Run Code Online (Sandbox Code Playgroud)
在这种情况下,getBody()已由gecko代码块中的destroy()函数触发.
destroy : function(s) {
var t = this;
// One time is enough
if (t.destroyed)
return;
// We must unbind on Gecko since it would otherwise produce the pesky "attempt to run compile-and-go script on a cleared scope" message
if (isGecko) {
Event.unbind(t.getDoc());
Event.unbind(t.getWin());
Event.unbind(t.getBody()); // here is the relevant getBody() call
}
Run Code Online (Sandbox Code Playgroud)
破坏已由tinymce.js的addUnload函数触发
o.func.call(o.scope, 1);
Run Code Online (Sandbox Code Playgroud)
我该怎么做才能避免这个问题?
我想让用户使用tinymce制作富文本并将其保存在数据库中,但我也想保存纯文本版本。
tinymce提供这样的选项吗?
我试图将CSS类添加到Sitecore 8中的Rich Text编辑器中。我在web.config中包括了对CSS文件的引用,如下所示
<settings>
<setting name="WebStylesheet">
<patch:attribute name="value">/Stylesheets/Corporate/rte.css</patch:attribute>
</setting>
</settings>
Run Code Online (Sandbox Code Playgroud)
我的CSS类如下所示:
.utility.background-color-dark-blue:focus, .utility.background-color-dark-blue:hover {
background-color: #034b76;
color: #fff;
}
.utility.background-color-dark-grey {
background-color: #1a1b1f;
color: #fff;
}
Run Code Online (Sandbox Code Playgroud)
当我从RTE的下拉列表中选择CSS类时,它仅将“ background-color-dark-grey”类应用于该元素。我需要将CSS类应用为“ utility background-color-dark-grey”,以显示正确的样式。
有谁知道如何在sitecore中向RTE添加多个类?
让我们直接解决这个问题。
我的编辑器中充满了实体,自定义渲染器等,我正在尝试添加背景颜色功能。我正在寻找一种在自定义块内渲染所选块的方法。
应用流程应如下所示:
阅读一些示例后,我想到了以下解决方案:
按键:
type: 'ACTION_TOGGLE_BLOCK',
action: "background"
Run Code Online (Sandbox Code Playgroud)
块渲染器:
editorBlockRenderer = (block) => {
if (block.getType() === 'background') {
return {
component: BackgroundComponent,
editable: true,
props: {
onRemove: blockKey => this.editorRemoveBlock(blockKey),
},
}
}
}
Run Code Online (Sandbox Code Playgroud)
渲染图:
const blockRenderMap = Immutable.Map({
'background': {
element: 'section',
wrapper: <div className="cutomBackground"> {this.props.children} </div>
}
});
const extendedBlockRenderMap = DefaultDraftBlockRenderMap.merge(blockRenderMap);
Run Code Online (Sandbox Code Playgroud)
组件:
class CustomBlock extends React.Component {
render() {
return (
<div>
{ this.props.children }
</div>
)
}
}
class BackgroundComponent extends …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用react-draft-wysiwyg 在react 上实现所见即所得文本编辑器。
为了使用文本编辑器上传图像,我尝试将 uploadCallback 函数上的文件发布到 S3 并将上传项目的 url 返回到编辑器。
但我不知道如何处理挂在我的 S3 存储桶中的未使用图像(在提交之前删除)。有什么好的方法可以预防这种情况吗?我试图以 base64 格式发布图像,但这似乎只是浪费内存。