"use strict"; import {MyBiz} from './biz/MyBiz.js' import {MyUtils} from './common/MyUtils.js' import {MyEventListener} from "./event/MyEventListener.js"; window.onload = function () { //init window.myEdit = { /** * 优先初始化 工具 */ utils: new MyUtils(), /** * 其次初始化 事件监听 */ eventListener: new MyEventListener("fixStyleInnerSpan"), ctx: { /** * 文档的根节点 */ MyRoot: document.getElementById("noteshare"), /** * 文档的结构树 */ MyDocMap: new Map(), getMapItem: function (orderNo) { return this.MyDocMap.get(orderNo); }, /** * 最新修改的元素. 当前只支持撤销一次 */ latestOpDoc: null, /** * 行增加记录。 行号 */ rowNo: 0, incrementNumThenReturn: function () { return this.rowNo++; }, /** * 是否开始输入中文 */ inCompositionEvent: false, showTestText: function () { //显示用户的输入内容 let userInput = document.getElementById("testInput"); if (userInput) { let obj = {} for (let [k, v] of this.MyDocMap.entries()) { if (v["data-hidden"] && v["data-hidden"] === true) { continue } obj[k] = v } // console.log("userInput : ", userInput) userInput.innerText = JSON.stringify(obj) } } }, } /** * 业务处理 */ window.myEdit.biz = new MyBiz(); //窗口撤销事件 window.addEventListener('keydown', window.myEdit.eventListener.WindowsCtrZHandle, true); //监听鼠标抬起事件 document.getElementById("noteshare").addEventListener("mouseup", window.myEdit.eventListener.MouseUp, true); }