code:

用于显示源码。主要包含一个弹框、设置显示内容以及内容的更新。

 function showDialog() {
var win = editor.windowManager.open({
title: "Source code",
body: {
type: 'textbox',
name: 'code',
multiline: true,
minWidth: editor.getParam("code_dialog_width", 600),
minHeight: editor.getParam("code_dialog_height", Math.min(tinymce.DOM.getViewPort().h - 200, 500)),
spellcheck: false,
style: 'direction: ltr; text-align: left'
},
onSubmit: function(e) {
// We get a lovely "Wrong document" error in IE 11 if we
// don't move the focus to the editor before creating an undo
// transation since it tries to make a bookmark for the current selection
editor.focus(); editor.undoManager.transact(function() { //uodo管理
editor.setContent(e.data.code);
}); editor.selection.setCursorLocation(); //设置游标位置
editor.nodeChanged(); // Dispatches out a onNodeChange event to all observers. This method should be called when you need to update the UI states or element path etc.
}
}); // Gecko has a major performance issue with textarea
// contents so we need to set it when all reflows are done
win.find('#code').value(editor.getContent({source_view: true}));//在窗口外设置窗口内的字段内容。其实里面的参数可写可不写,默认是html格式,见L32486
}

代码比较简短,主要的函数调用,都是‘系统’函数的调用。

关于uodo的transact:

就是说,把dom改变的操作,放到callback中去执行以下,然后,uodo管理器会记录这个改变,并压入堆中。

涉及的核心函数:

editor.getContent  (L32482, 核心的操作是L32497的body.innerHTML)、editor.setContent、editor.undoManager.transact、

tinymce原装插件源码分析(三)-code的更多相关文章

  1. tinymce原装插件源码分析(一)-hr

    tinymce简介 tinymce是一款能方便无限扩展的网页富文本编辑器. tinymce原装插件已经十分丰富,对于文本编辑(blog等文章)是绰绰有余,但是应对一些复杂的应用,比如在上面开发html ...

  2. tinymce原装插件源码分析(四)-fullscreen

    fullscreen 作为一款文本编辑器,全屏功能是非常有必要的.在插件中主要是修改一些css style和触发resize事件. style问题(反例): 见github源码:https://git ...

  3. tinymce原装插件源码分析(二)-link

    link 功能描述如下: 单纯放置光标: 1.如果光标放到了<a>上,读取a标签的内容,并弹框显示,确定的时候,更新当前a标签. 2.否则,就创建弹框,确定的时候,按照参数添加a标签. s ...

  4. tinymce原装插件源码分析(五)-searchreplace

    searchreplace 功能:查找和替换 代码注释见: https://www.xunhanliu.top/static/js/tinymce/plugins/searchreplace/plug ...

  5. tinymce原装插件源码分析(七)-使能css、script

    在tinymce中使用css个script tinymce的编辑器中css和script默认是不起作用的.(编辑器主要面向写文章使用,考虑到xss攻击,默认是不启用的) 需要修改tinymce.js中 ...

  6. tinymce原装插件源码分析(六)-preview

    priview 此插件文件结构比较简单,按钮注册.editor.windowManager.open.窗口出现之前的渲染数据的准备.页面代码的准备. 注意: 1.preview的默认宽高设置: 2.c ...

  7. 使用react全家桶制作博客后台管理系统 网站PWA升级 移动端常见问题处理 循序渐进学.Net Core Web Api开发系列【4】:前端访问WebApi [Abp 源码分析]四、模块配置 [Abp 源码分析]三、依赖注入

    使用react全家桶制作博客后台管理系统   前面的话 笔者在做一个完整的博客上线项目,包括前台.后台.后端接口和服务器配置.本文将详细介绍使用react全家桶制作的博客后台管理系统 概述 该项目是基 ...

  8. tomcat源码分析(三)一次http请求的旅行-从Socket说起

    p { margin-bottom: 0.25cm; line-height: 120% } tomcat源码分析(三)一次http请求的旅行 在http请求旅行之前,我们先来准备下我们所需要的工具. ...

  9. Spring5深度源码分析(三)之AnnotationConfigApplicationContext启动原理分析

    代码地址:https://github.com/showkawa/spring-annotation/tree/master/src/main/java/com/brian AnnotationCon ...

随机推荐

  1. RabbitMQ学习笔记(1)----RabbitMQ简介与安装

    ·1. 什么是RabbitMQ? RabbitMQ是流行的开源消息队列系统,用erlang语言开发.RabbitMQ是AMQP(高级消息队列协议)的标准实现. 而AMQP协议则是指:即Advanced ...

  2. 路飞学城Python-Day29(第四模块-并发编程)

    01-进程与程序的概念 并发:多进程和多线程 进程的概念:进程就是正在执行的过程,一个应用程序不是进程,只有应用程序启动以后才能说是进程,进程是一个抽象的概念,起源于操作系统 02-操作系统介绍 应用 ...

  3. docker images镜像无法删除

    删除所有容器: docker rm $(docker ps -aq) 删除镜像: docker rmi $(docker images -q) 如果有镜像无法删除,有可能更改了名字,用docker r ...

  4. HDU 3068 最长回文( Manacher模板题 )

    链接:传送门 思路:Manacher模板题,寻找串中的最长回文子串 /***************************************************************** ...

  5. 线性回归(regression)

    简介 回归分析只涉及到两个变量的,称一元回归分析.一元回归的主要任务是从两个相关变量中的一个变量去估计另一个变量,被估计的变量,称因变量,可设为Y:估计出的变量,称自变量,设为X. 回归分析就是要找出 ...

  6. tp框架报错 Namespace declaration statement has to be the very first statement in the script

    Namespace declaration statement has to be the very first statement in the script tp框架报这个错误,错误行数就是nam ...

  7. Ubuntu 常用快捷键

    本系列文章由 @YhL_Leo 出品,转载请注明出处. 文章链接: http://blog.csdn.net/yhl_leo/article/details/50285313 1 桌面 快捷键 作用 ...

  8. HDU 2643

    (第二类斯特林数*N的阶乘 )的和. #include <iostream> #include <cstdio> #include <algorithm> #def ...

  9. [环境搭建] VS-Visual Studio-IIS Express 支持局域网訪问

    原创作品,转载请注明出处:http://blog.csdn.net/qiujuer/article/details/40350385 使用Visual Studio开发Web网页的时候有这种情况:想要 ...

  10. LeetCode OJ 之 Number of Digit One (数字1的个数)

    题目: Given an integer n, count the total number of digit 1 appearing in all non-negative integers les ...