FineUI 官方论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

本论坛已关闭(禁止注册、发帖和回复)
请移步 三石和他的朋友们

FineUI首页 WebForms - MVC & Core - JavaScript 常见问题 - QQ群 - 十周年征文活动

FineUI(开源版) 下载源代码 - 下载空项目 - 获取ExtJS - 文档 在线示例 - 版本更新 - 捐赠作者 - 教程

升级到 ASP.NET Core 3.1,快、快、快! 全新ASP.NET Core,比WebForms还简单! 欢迎加入【三石和他的朋友们】(基础版下载)

搜索
查看: 10419|回复: 8
打印 上一主题 下一主题

【已解决】页面多个ueditor无法正常赋值

[复制链接]
跳转到指定楼层
楼主
发表于 2013-10-10 11:00:10 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
页面上放多个ueditor时候,无法同时赋值,只能赋给第一个声明editor的值

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
沙发
发表于 2013-10-10 11:36:30 | 只看该作者
板凳
 楼主| 发表于 2013-10-10 13:06:06 | 只看该作者
本帖最后由 世界没有真情 于 2013-10-10 13:13 编辑

没什么不一样啊
  1. <script type="text/javascript">
  2.         var editortxtNavConnect;
  3.         var editortxtIndexConnect;
  4.         var editortxtIndexIntro;
  5.         var editortxtNavIntro;
  6.         function onReady() {
  7.             editor2();
  8.             editor1();

  9.             editor3();
  10.             editor4();
  11.         }
  12.         // 提交数据之前同步到表单隐藏字段
  13.         X.util.beforeAjaxPostBackScript = function () {
  14.             editortxtNavConnect.sync();
  15.             editortxtIndexConnect.sync();
  16.             editortxtIndexIntro.sync();
  17.             editortxtNavIntro.sync();
  18.         };

  19.         function updateeditor(content1, content2, content3, content4) {

  20.         }

  21.         function editor1() {
  22.             editortxtNavConnect = new UE.ui.Editor({
  23.                 initialFrameWidth: '100%',
  24.                 initialFrameHeight: 80,
  25.                 minFrameHeight: 80,
  26.                 autoFloatEnabled: false,
  27.                 initialContent: '',
  28.                 toolbars: [
  29.             ['fullscreen', 'source', '|', 'undo', 'redo', '|',
  30.                 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',
  31.                 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', 'insertimage', 'imagefloat']]
  32.             });
  33.             editortxtNavConnect.render("txtNavConnect");
  34.             window.setTimeout(function () {
  35.                 editortxtNavConnect.setContent('asdf');
  36.             }, 100);
  37.            
  38.         }
  39.         function editor2() {
  40.             editortxtIndexConnect = new UE.ui.Editor({
  41.                 initialFrameWidth: '100%',
  42.                 initialFrameHeight: 80,
  43.                 minFrameHeight: 80,
  44.                 autoFloatEnabled: false,
  45.                 initialContent: '',
  46.                 toolbars: [
  47.             ['fullscreen', 'source', '|', 'undo', 'redo', '|',
  48.                 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',
  49.                 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', 'insertimage', 'imagefloat']]
  50.             });
  51.             editortxtIndexConnect.render("txtIndexConnect");
  52.            
  53.             window.setTimeout(function () {
  54.                 editortxtIndexConnect.setContent('55');
  55.             }, 100);
  56.         }
  57.         function editor3() {
  58.             editortxtIndexIntro = new UE.ui.Editor({
  59.                 initialFrameWidth: '100%',
  60.                 initialFrameHeight: 80,
  61.                 minFrameHeight: 80,
  62.                 autoFloatEnabled: false,
  63.                 initialContent: '',
  64.                 toolbars: [
  65.             ['fullscreen', 'source', '|', 'undo', 'redo', '|',
  66.                 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',
  67.                 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', 'insertimage', 'imagefloat']]
  68.             });
  69.             editortxtIndexIntro.render("txtIndexIntro");
  70.             window.setTimeout(function () {
  71.                 editortxtIndexIntro.setContent('55');
  72.             }, 100);
  73.         }
  74.         function editor4() {
  75.             editortxtNavIntro = new UE.ui.Editor({
  76.                 initialFrameWidth: '100%',
  77.                 initialFrameHeight: 80,
  78.                 minFrameHeight: 80,
  79.                 autoFloatEnabled: false,
  80.                 initialContent: '',
  81.                 toolbars: [
  82.             ['fullscreen', 'source', '|', 'undo', 'redo', '|',
  83.                 'bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript',
  84.                 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', 'insertimage', 'imagefloat']]
  85.             });
  86.             editortxtNavIntro.render("txtNavIntro");
  87.             
  88.             window.setTimeout(function () {
  89.                 editortxtNavIntro.setContent('546');
  90.             }, 100);
  91.         }
  92.         
  93.     </script>
复制代码
地板
 楼主| 发表于 2013-10-10 13:11:27 | 只看该作者
sanshi 发表于 2013-10-10 11:36
对比下官方示例:http://fineui.com/demo/#/demo/aspnet/ueditor_two.aspx

关键是我想同时赋值啊,只能赋值第一个初始化的editor啊,你给的那例子我看过,那个不是同时赋值的啊,点击一个按钮赋值一个而已
5#
发表于 2013-10-10 14:00:23 | 只看该作者
世界没有真情 发表于 2013-10-10 13:11
关键是我想同时赋值啊,只能赋值第一个初始化的editor啊,你给的那例子我看过,那个不是同时赋值的啊,点 ...

用空项目 http://fineui.com/bbs/forum.php?mod=viewthread&tid=2123 创建重现问题的示例,需要调试
6#
 楼主| 发表于 2013-10-10 14:32:44 | 只看该作者
sanshi 发表于 2013-10-10 14:00
用空项目 http://fineui.com/bbs/forum.php?mod=viewthread&tid=2123 创建重现问题的示例,需要调试 ...

ueditor 太大上传不了,你要把uditor放进去,麻烦三石兄了

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
7#
发表于 2013-10-10 15:46:55 | 只看该作者
世界没有真情 发表于 2013-10-10 14:32
ueditor 太大上传不了,你要把uditor放进去,麻烦三石兄了

刚测试了你提交的工程。还在UEditor的用法不对,参考UEditor的事件:http://ueditor.baidu.com/doc/#UE.Editor:ready

你的代码:
  1. window.setTimeout(function () {
  2.                 editortxtIndexConnect.setContent('55');
  3.             }, 100);
复制代码
虽然加上了延迟,但是UEditor的初始化比较慢,还是会在UEditor初始化完成之前执行。

正确的做法是使用UEditor提供的 ready 事件:
  1. editortxtIndexConnect.addListener('ready', function (editor) {
  2.                 editortxtIndexConnect.setContent('OKOKOK');
  3.             });
复制代码
8#
 楼主| 发表于 2013-10-10 19:44:34 | 只看该作者
sanshi 发表于 2013-10-10 15:46
刚测试了你提交的工程。还在UEditor的用法不对,参考UEditor的事件:http://ueditor.baidu.com/doc/#UE.E ...

多谢三石兄
9#
发表于 2013-10-11 08:22:50 | 只看该作者

请问UE编辑的富文本,您是如何展示的?(我是用一个隐藏了工具栏的UE展示,新手,请多指教。)
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|FineUI 官方论坛 ( 皖ICP备2021006167号-1 )

GMT+8, 2024-6-18 02:43 , Processed in 0.048059 second(s), 19 queries , Gzip On.

Powered by Discuz! X3.4

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表