【问题标题】:Customise Edit Button for ContentTools自定义 ContentTools 的编辑按钮
【发布时间】:2016-04-11 06:51:18
【问题描述】:

我很难理解如何更改ContentTools(所见即所得编辑器)中编辑(点火)按钮的外观和/或位置。

我发现我可以使用editor.start();editor.stop(); 来触发页面的编辑,我想将这些功能映射到我自己的按钮,但我无法摆脱默认按钮。

他们网站上的文档和教程并不能帮助我理解这一点。

谢谢!

【问题讨论】:

  • 不乏可用的编辑器。如果您需要的功能没有文档记录或不可用,请查找另一个
  • 我需要一个非常简单、免费的轻量级所见即所得编辑器,它还允许上传图片。我使用过 CKEditor,但我不太喜欢它,因为我使用 Laravel 作为框架,并且要上传图像,您需要一个文件管理器,而仅仅能够编辑 2 个文本区域并上传一个就太多了图片。

标签: javascript php jquery content-management-system wysiwyg


【解决方案1】:

我推荐有 2 种方法,最简单的选择是像这样 (reference SASS) 隐藏点火按钮(所谓的):

.ct-ignition {
    display: none;
}

如果您希望完全从 DOM 中删除该按钮,那么您可以像这样从 UI 中卸载该按钮 (reference CoffeeScript):

// Once the Editor has been initialized
ContentTools.EditorApp.get()._ignition.unmount();

我的建议是使用 CSS 来隐藏点火并触发针对它的事件以通过您的自定义按钮手动调用功能,如下所示:

var editor = ContentTools.EditorApp.get();

// Starting the editor manually
editor._ignition.trigger('start');

// Stoping the editor manually (save)
editor._iginition.trigger('stop', true);

// Stoping the editor manually (cancel)
editor._iginition.trigger('stop', false);

也可以查看项目 github 问题列表中提出的这些问题:

【讨论】:

  • 谢谢!这帮助很大!
  • 我无法使以下工作; var editor = ContentTools.EditorApp.get(); // 手动启动编辑器 //editor._ignition.trigger('start');但我可以让它工作; var editor = ContentTools.EditorApp.get(); editor.start() API 有变化吗?
猜你喜欢
  • 2011-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-03-20
  • 2011-06-11
  • 1970-01-01
相关资源
最近更新 更多