我的页面上列出了一些字段,每个字段都有一个按钮,用于创建要转换为tinyMCE的文本区域,并且内容应使用来自ajax请求的字符串进行更新。像这样:
$("table td.bio-td").delegate(".btn", "click", function() {
...
var id = this.id;
$('#cont').html('<textarea id="mceeditor_'+id'">xyz</textarea>');
tinymce.EditorManager.execCommand('mceAddControl',true, 'mceeditor_'+id);
tinymce.activeEditor.setContent(ajax_str);
...
});
Run Code Online (Sandbox Code Playgroud)
除了一件事之外,代码工作正常:setContent() 行。我在 javascript 控制台中收到错误,activeEditor 为空。不知何故,tinyMCE 在 DOM 中找不到编辑器?那之前是怎么转成tinymce对象的呢?
我有一个 ID 为“文章”的文本区域。
这是我的js中的内容:
tinyMCE.init({
theme : "advanced",
mode : "textareas",
plugins : "fullpage",
theme_advanced_buttons3_add : "fullpage"
});
Run Code Online (Sandbox Code Playgroud)
并获取编辑器的内容:
var content = tinyMCE.get('article').getContent();
alert(content);
Run Code Online (Sandbox Code Playgroud)
但它似乎不起作用,我哪里出错了?
我正在尝试按照本教程让 tinymce 与 django 和 zinnia 一起工作。它不起作用,所以我试图进行“测试”,但在运行django-admin.py syncdb. 我该如何解决?
$django-admin.py syncdb
Traceback (most recent call last):
File "/usr/local/bin/django-admin.py", line 5, in <module>
pkg_resources.run_script('Django==1.5.1', 'django-admin.py')
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 505, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1245, in run_script
execfile(script_filename, namespace, namespace)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.1-py2.7.egg/EGG-INFO/scripts/django-admin.py", line 5, in <module>
management.execute_from_command_line()
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.1-py2.7.egg/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.1-py2.7.egg/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.1-py2.7.egg/django/core/management/__init__.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/usr/local/lib/python2.7/dist-packages/Django-1.5.1-py2.7.egg/django/core/management/__init__.py", line 109, in …Run Code Online (Sandbox Code Playgroud) 我尝试获取tinymce的内容,如下所示:
var hallo = tinyMCE.activeEditor.getContent();
alert(hallo);
Run Code Online (Sandbox Code Playgroud)
但每次我收到这条消息时:
Uncaught TypeError: Cannot read property 'getContent' of null
Run Code Online (Sandbox Code Playgroud)
我正在使用 tinymce 4。
谢谢
如何将快捷方式Ctrl+添加Enter到tinyMCE (v4) 以使其发布与编辑器一起使用的表单?我试过这个,但似乎不起作用:
<script><!--
$('#txtField1').tinymce({
script_url:"js/tinymce/tinymce.min.js",
content_css:"css/editor.xxm",
//etc. all of my other config goes here
setup: function(e){
e.shortcuts.add("ctrl+enter","submit",function(){document.form[0].submit();});}
});
//--></script>
Run Code Online (Sandbox Code Playgroud) 我是 angular 2 的新手,并试图将 tinymce 集成到 angular 2 中,但我无法在我的项目中使用 tinymce。到目前为止,我所做的是在我的项目中使用 bower 安装了 tinyMCe。所有 js 文件都成功添加到我的项目中。然后我在布局页面中添加了所有引用,如下所示:
<script src="~/lib/tinymce/tinymce.js"></script>
<script src="~/lib/tinymce/themes/modern/theme.js"></script>
<script src="~/lib/tinymce/plugins/link/plugin.js"></script>
<script src="~/lib/tinymce/plugins/paste/plugin.js"></script>
<script src="~/lib/tinymce/plugins/table/plugin.js"></script>
Run Code Online (Sandbox Code Playgroud)
在此之后,我编写了将使用 tineMce 的组件,如下所示:
import { Component, OnInit } from "@angular/core";
import { Routes, RouterModule } from "@angular/router";
import { NgForm } from "@angular/forms";
import Page = require("../../interfaces/iPage");
import PageService = require("../../services/page.service");
@Component({
//no need for selector as it will be loaded via routing
templateUrl: "/page/addEdit"
})
export class AddEditPageComponent implements OnInit {
model = this.newModel(); …Run Code Online (Sandbox Code Playgroud) 我以前从未遇到过这种情况,这就是为什么我来看看是否有人可以解释为什么或导致这种情况的原因。
基本上我使用以下 html javascript 在 Tinymce 编辑器中调用:
<script type="text/javascript">
jQuery(document).ready(function() {
tinymce.init({
selector: "#content",
theme: "modern",
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste imagetools Customlayouts Customshortcodes, autoresize responsivefilemanager"
],
toolbar: "Customlayouts Customshortcodes | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist | link responsivefilemanager image media | code fullscreen",
image_advtab: true ,
relative_urls: false,
external_filemanager_path:"http://<?php echo $_SERVER['HTTP_HOST']; ?>/Libs/filemanager/",
filemanager_title:"Responsive Filemanager" ,
external_plugins: { …Run Code Online (Sandbox Code Playgroud) 一位客户要求我制作一个插件来插入电话链接,我知道这可以通过链接插件来完成,但他希望有一个专门设计的插件来实现。我已经有了带有弹出窗口的插件,您可以在其中插入所需的数据,这是代码,我要添加的功能与链接插件相同,因此当用户单击链接的文本时,内容可以是在我的插件的窗口管理器中进行了编辑。
这是我到目前为止的代码:
tinymce.PluginManager.add('phonelink', function(editor, url) {
// Add a button that opens a window
tinymce.DOM.loadCSS(url + '/css/phonelink.css');
editor.addButton('phonelink', {
text: false,
icon: 'phonelink',
onclick: function() {
// Open window
editor.windowManager.open({
title: 'Enlace teléfono',
body: [
{type: 'textbox', name: 'phone', label: 'Teléfono'},
{type: 'textbox', name: 'showtext', label: 'Texto a mostrar'},
{type: 'textbox', name: 'title', label: 'Título'}
],
onsubmit: function(e) {
// Insert content when the window form is submitted
editor.insertContent('<a title="' + e.data.title + '" href="tel:+34' + e.data.phone + '">' + …Run Code Online (Sandbox Code Playgroud) 我尝试使用angular 6安装tinyMCE。我正在关注https://www.tiny.cloud/docs/integrations/angular2/上的文档。
一切正常,但我必须具有apiKey才能使用tinyMCE云。
我收到错误消息:“此域未在TinyMCE Cloud中注册。开始免费试用以发现我们的高级云服务和专业支持。”
我想使用不带apiKey的自托管版本。
因此,如文档https://www.tiny.cloud/docs/integrations/angular2/#loadingtinymceby自己所解释的那样,我们可以托管tinymce.min.js以禁用apiKey。
如何使用angular 6正确添加tinymce.min.js?
我面临这个问题,每当我输入 TinyMCE 时,我的光标都会自动向左移动,最终我会从右向左书写文本。它只发生在我部署的应用程序中,但如果我在我的机器上本地运行代码,同样可以正常工作。这可能发生的任何可能原因?
注意:这几天前工作正常