- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的页面在很多地方使用了 tinyMCE 编辑器。大多数是在页面加载时加载的。对于所需的不同类型的编辑器,目前有两个单独的 inits:
// Register script that will initialize all the compact tinyMCE editors (textareas) on the page.
tinyMCE.init({
mode: 'textareas',
editor_deselector: /(mceNoEditor|tinymce_simple)/,
theme: 'advanced',
cleanup_callback: 'myCustomCleanup',
save_callback: 'myCustomSaveContent',
plugins: '-tabfocus,-safari,-pagebreak,-style,-layer,-table,-save,-advhr,-advimage,-advlink,-emotions,-iespell,-inlinepopups,-insertdatetime,-preview,-media,-searchreplace,-print,-contextmenu-,paste,-directionality,-fullscreen,-noneditable,-visualchars,-nonbreaking,-xhtmlxtras,-template',
//theme_advanced_buttons1: 'save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,fontselect,fontsizeselect',
//theme_advanced_buttons2: 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,|,undo,redo,|,forecolor,backcolor',
//theme_advanced_buttons3: 'tablecontrols,|,link,unlink,image,code,|,fullscreen',
theme_advanced_buttons1: 'bold,italic,underline,|,fontselect,fontsizeselect,forecolor,backcolor',
theme_advanced_buttons2: '',
theme_advanced_buttons3: '',
theme_advanced_toolbar_location: 'top',
theme_advanced_toolbar_align: 'left',
content_css: 'css/content.css',
template_external_list_url: 'lists/template_list.js',
external_link_list_url: 'lists/link_list.js',
external_image_list_url: 'lists/image_list.js',
media_external_list_url: 'lists/media_list.js',
template_replace_values: { username: 'Some User', staffid: '991234' }
});
tinyMCE.init({
mode: 'specific_textareas',
editor_selector: 'tinymce_simple',
theme: 'advanced',
cleanup_callback: 'myCustomCleanup',
save_callback: 'myCustomSaveContent',
plugins: '-tabfocus,-safari,-pagebreak,-style,-layer,-table,-save,-advhr,-advimage,-advlink,-emotions,-iespell,-inlinepopups,-insertdatetime,-preview,-media,-searchreplace,-print,-contextmenu,-paste,-directionality,-fullscreen,-noneditable,-visualchars,-nonbreaking,-xhtmlxtras,-template',
theme_advanced_buttons1: 'bold,italic,underline,|,fontselect,fontsizeselect,forecolor,backcolor',
theme_advanced_buttons2: '',
theme_advanced_buttons3: '',
theme_advanced_toolbar_location: 'top',
theme_advanced_toolbar_align: 'left',
content_css: 'css/content.css',
template_external_list_url: 'lists/template_list.js',
external_link_list_url: 'lists/link_list.js',
external_image_list_url: 'lists/image_list.js',
media_external_list_url: 'lists/media_list.js',
template_replace_values: { username: 'Some User', staffid: '991234' }
});
页面加载时默认加载的编辑器效果很好。那里没有问题。
我想通过 javascript 动态添加一个文本框。
<textarea cols='1' rows='1' id='EditNote' class='tinymce_simple' style='width: 100%;' />
根据我所做的研究,我需要手动将编辑器添加到 tinyMCE
tinyMCE.execCommand('mceAddControl', false, 'EditNote');
这也很好,编辑器显示正确。
当文本区域从页面中删除时,我还手动删除了编辑器。
if (tinyMCE.getInstanceById('EditNote')) {
tinyMCE.execCommand('mceFocus', false, 'EditNote');
tinyMCE.execCommand('mceRemoveControl', false, 'EditNote');
tinyMCE.triggerSave();
}
当我在创建并手动添加文本后尝试将文本加载到该编辑器时,我的问题就来了。
例如:
var editor = tinyMCE.get('EditNote');
editor.setContent('SomeText');
当我这样做时,编辑器是空的。如果您很快看到,文本就在编辑器中,然后消失了。关于如何解决这个问题有什么建议吗??
最佳答案
假设您尝试在调用execCommand 后立即在“EditNote”编辑器上设置内容,我怀疑问题是时间问题。换句话说,在您调用 setContent 时,TinyMCE 实例尚未完成加载,因此不会呈现它。
如果您要立即设置内容,为什么不直接将其添加到您的动态 textarea 创建中。这样 TinyMCE 就会在加载时拾取它。
或者,您可以使用 JavaScript 超时。例如
var t=setTimeout(function () {
var editor = tinyMCE.get('EditNote');
editor.setContent('SomeText');
},100);
关于c# - TinyMCE 在动态添加受影响的文本区域后使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5277345/
在使用 GDI 进行图形处理的传统 Windows 程序中,您必须担心只绘制需要重绘的窗口区域;这是“更新矩形”,可以通过 PAINTSTRUCT.rcPaint 或通过调用 GetUpdateRec
我对 TFS 中的所有内容感到困惑。有人可以解释一下所有这些是如何组合在一起的吗? 团队项目合集 团队项目 团队 地区 迭代 来自 this page,我认为一个(团队)项目集合可以包含多个(团队)项
这对我来说根本没有意义。创建新的 API 网关时,您可以指定它是区域优化的还是边缘优化的。但话又说回来,当您为 API Gateway 创建自定义域名时,您可以在两者之间进行选择。 最糟糕的是,您可以
我有一个工作表,其中包含我想循环遍历的许多不同区域。我将进行一些计算,并认为它比在列中逐个单元格地更快/更有效。 我尝试了一些不同的东西,但不知道如何跳到下一个区域。我已经发表了一些评论,最有希望的是
最近迁移到 TFS 2010 后,我想知道对于区域而言,最佳或最广泛接受的定义或配置是什么? 我能在网上找到的唯一有用的文章是 this one并且是我认为是正确的。然而,这让我开始思考是否以下任何一
我在“北欧”有一个存储帐户,现在我想使用生命周期管理将冷 blob 移动到存档层。 但是我每次尝试都会遇到以下失败:无法为存储帐户“myStorageAccount”添加生命周期管理规则。错误:管理策
我正在开发一个项目,您在扫描仪中输入州的缩写,然后程序会告诉您该州位于美国的哪个地区。我认为我的大部分代码都是正确的,但我有以前从未使用过 switch。 我已经将我的工作改进为一个错误,即我的第一个
我正在尝试学习 AngularJS,我想我有一个架构问题。 如果我想开始开发一个应用程序,比方说,比如 youtube,我如何在“区域”(比如 Marionette)中组织页面?我的意思是:顶部导航栏
我正在制作一个动态内存分配器,当我释放其中的一部分时,我需要检查我传递给函数的指针实际上是否在该区域内。我有一个指向 malloc 区域开头的指针 typedef unsigned char byte
有时我想看看 到底在哪里页面上图片上的标签。 在 Javascript 中有没有办法改变颜色或隐藏与区域标签对应的图像部分? 最佳答案 也许您正在寻找类似 mapper.js 的内容.它允许您在鼠标
我有一个使用 D3 js 创建的时间序列图表。我想为特定时间间隔添加高亮区域,以显示在该特定时间发生的特定事件(会有不同类型的事件,因此每个高亮标记将根据其类型具有不同的颜色)。我希望这个突出显示区域
我正在尝试创建网站的密码保护区。我想通过检查 MySql 表中的用户名和密码来允许访问,然后启动一个 session 并允许在 session 处于事件状态时访问多个页面。如果有人尝试直接访问这些页面
在 ScrollView 中我添加了几个按钮。正如您在图片中看到的,2 个按钮完全可见,第三个按钮半可见。当我向右滚动看到第三个时;1-如果滚动条很短,则它会滚动回到第一个位置。2- 如果滚动足够则显
我正在开发我的第一个 spritekit 应用程序,并且有一个关于如何处理我想到的事情的快速问题。我正在制作一个我想要的棋盘游戏原型(prototype),并希望在 iOS map 中进行一些集思广益
在我的 C# 程序中,我收到这样的日期和时间:DateTime.Now 我得到:19/09/2010 20:10:30 因为我的地区是:希伯来语(以色列) 但是如果我将我的程序安装在区域为 Engli
有时我在 Visual Studio 的源文件中运行(在我的例子中是 2010),我看到很多区域,我必须点击 + 号才能一个一个地打开它们! 是否有任何快捷方式或菜单选项可以使这对我来说更容易,并且对
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题? 更新问题,以便 editing this post 可以用事实和引用来回答它. 关闭 7 年前。 Improve
我正在寻找二维数据中的峰值区域(如果您愿意,灰度图像或二维景观,通过霍夫变换创建)。 峰值区域是指局部最大峰值,但不是单个点而是周围的一部分strong>contributing region 随之而
我希望能够将任何字符或字符串转换为形状或区域,以便我可以按照我喜欢的任何大小、样式、效果等来绘制该字符。 更具体地说,我将使用视差绘制它,以便它仅在特定角度清晰定义(这就是为什么我不能使用 html
我非常喜欢数学(或者你们大多数人会说的“数学”!),但我还没有达到知道这个问题答案的程度。我有一个主圆,它可以在显示器上的任何 x 和 y 处有一个中心点。其他圆圈将随意在显示器周围移动,但在任何给定
我是一名优秀的程序员,十分优秀!