@hufe921/canvas-editor 0.9.9 → 0.9.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/canvas-editor.es.js +1034 -711
- package/dist/canvas-editor.es.js.map +1 -1
- package/dist/canvas-editor.umd.js +18 -18
- package/dist/canvas-editor.umd.js.map +1 -1
- package/dist/src/editor/core/contextmenu/ContextMenu.d.ts +2 -0
- package/dist/src/editor/core/draw/Draw.d.ts +6 -1
- package/dist/src/editor/core/event/CanvasEvent.d.ts +18 -14
- package/dist/src/editor/core/event/GlobalEvent.d.ts +8 -4
- package/dist/src/editor/core/event/handlers/click.d.ts +8 -0
- package/dist/src/editor/core/event/handlers/composition.d.ts +8 -0
- package/dist/src/editor/core/event/handlers/copy.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/cut.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/drag.d.ts +6 -0
- package/dist/src/editor/core/event/handlers/drop.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/input.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/keydown.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mousedown.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mouseleave.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mousemove.d.ts +2 -0
- package/dist/src/editor/core/event/handlers/mouseup.d.ts +2 -0
- package/dist/src/editor/core/observer/ScrollObserver.d.ts +2 -0
- package/dist/src/editor/core/observer/SelectionObserver.d.ts +2 -0
- package/dist/src/editor/core/position/Position.d.ts +1 -0
- package/dist/src/editor/core/range/RangeManager.d.ts +1 -0
- package/dist/src/editor/core/shortcut/Shortcut.d.ts +2 -0
- package/dist/src/editor/dataset/constant/Editor.d.ts +1 -0
- package/dist/src/editor/dataset/constant/Element.d.ts +1 -1
- package/dist/src/editor/index.d.ts +1 -0
- package/package.json +1 -1
package/dist/canvas-editor.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(()=>{(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode('.select-control-popup{max-width:160px;min-width:69px;max-height:225px;position:absolute;z-index:1;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;box-shadow:0 2px 12px #0000001a;box-sizing:border-box;margin:5px 0;overflow-y:auto}.select-control-popup ul{list-style:none;padding:3px 0;margin:0;box-sizing:border-box}.select-control-popup ul li{font-size:13px;padding:0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#666;height:36px;line-height:36px;box-sizing:border-box;cursor:pointer}.select-control-popup ul li:hover{background-color:#eef2fd}.select-control-popup ul li.active{color:var(--COLOR-HOVER, #5175f4);font-weight:700}.date-container{display:none;width:300px;overflow:hidden;left:0;right:0;position:absolute;z-index:1;color:#606266;background:#ffffff;border-radius:4px;padding:10px;user-select:none;border:1px solid #e4e7ed;box-shadow:0 2px 12px #0000001a}.date-container.active{display:block}.date-wrap{display:none}.date-wrap.active{display:block}.date-title{display:flex;justify-content:center;align-items:center;text-align:center;color:#606266;font-size:16px}.date-title>span{display:inline-block}.date-title>span:not(.date-title__now){font-family:cursive;cursor:pointer}.date-title>span:not(.date-title__now):hover{color:#5175f4}.date-title .date-title__pre-year,.date-title .date-title__pre-month{width:15%}.date-title .date-title__now{width:40%}.date-title .date-title__next-year,.date-title .date-title__next-month{width:15%}.date-week{width:100%;display:flex;justify-content:center;margin-top:15px;padding-bottom:5px;border-bottom:1px solid #e4e7ed}.date-week>span{list-style:none;width:14.28571%;text-align:center;color:#606266;font-size:14px}.date-day{width:100%;display:flex;flex-wrap:wrap;align-items:center;margin-top:5px}.date-day>div{width:14.28571%;height:40px;text-align:center;color:#606266;font-size:14px;cursor:pointer;line-height:40px;border-radius:4px}.date-day>div:hover{color:#5175f4;opacity:.8}.date-day>div.active{color:#5175f4;font-weight:700}.date-day>div.disable{color:#c0c4cc}.date-day>div.select{color:#fff;background-color:#5175f4}.time-wrap{display:none;padding:10px;height:286px}.time-wrap ::-webkit-scrollbar{width:0}.time-wrap.active{display:flex}.time-wrap li{list-style:none}.time-wrap>li{width:33.3%;height:100%;text-align:center}.time-wrap>li>span{transform:translateY(-5px);display:inline-block}.time-wrap>li>ol{height:calc(100% - 20px);overflow-y:auto;border:1px solid #e2e2e2;position:relative}.time-wrap>li:first-child>ol{border-right:0}.time-wrap>li:last-child>ol{border-left:0}.time-wrap>li>ol>li{line-height:30px;cursor:pointer;transition:all .3s}.time-wrap>li>ol>li:hover{background-color:#eaeaea}.time-wrap>li>ol>li.active{color:#fff;background:#5175F4}.date-menu{width:100%;height:28px;display:flex;justify-content:flex-end;align-items:center;padding-top:10px;position:relative;border-top:1px solid #e4e7ed}.date-menu button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;appearance:none;text-align:center;box-sizing:border-box;outline:none;transition:.1s;font-weight:500;user-select:none;padding:7px 15px;font-size:12px;border-radius:3px;margin:0 0 0 10px}.date-menu button:hover{color:#5175f4;border-color:#5175f4}.date-menu button.date-menu__time{border:1px solid transparent;position:absolute;left:0;margin-left:0}.date-menu button.date-menu__time:hover{color:#5175f4}.block-item{position:absolute;z-index:0;overflow:hidden;border-radius:8px;background-color:#fff;border:1px solid rgb(235 236 240)}.inputarea{width:0;height:12px;min-width:0;min-height:0;margin:0;padding:0;left:0;right:0;letter-spacing:0;font-size:12px;position:absolute;outline:none;resize:none;border:none;overflow:hidden;color:transparent;user-select:none;background-color:transparent}.cursor{width:1px;height:20px;left:0;right:0;position:absolute;outline:none;background-color:#000;pointer-events:none}.cursor--animation{animation-duration:1s;animation-iteration-count:infinite;animation-name:cursorAnimation}@keyframes cursorAnimation{0%{opacity:1}13%{opacity:0}50%{opacity:0}63%{opacity:1}to{opacity:1}}.resizer-selection{position:absolute;border:1px solid}.resizer-selection>div{position:absolute;width:10px;height:10px;box-shadow:0 1px 4px #0000004d;border-radius:5px;border:2px solid #ffffff;box-sizing:border-box}.resizer-selection .handle-0{cursor:nw-resize}.resizer-selection .handle-1{cursor:n-resize}.resizer-selection .handle-2{cursor:ne-resize}.resizer-selection .handle-3{cursor:e-resize}.resizer-selection .handle-4{cursor:se-resize}.resizer-selection .handle-5{cursor:s-resize}.resizer-selection .handle-6{cursor:sw-resize}.resizer-selection .handle-7{cursor:w-resize}.resizer-image{position:absolute;opacity:.5}.image-previewer{position:fixed;left:0;top:0;z-index:1000;width:100%;height:100%;overflow:hidden;background:#f2f4f7;display:flex;align-items:center;justify-content:center;animation:previewerAnimation .3s}@keyframes previewerAnimation{0%{opacity:.1}to{opacity:1}}.image-previewer .image-close{width:24px;height:24px;display:inline-block;position:absolute;right:50px;top:30px;z-index:99;cursor:pointer;background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIzLjk3IDdsMS40MTUgMS40MTQtNy43NzkgNy43NzggNy43NzkgNy43NzktMS40MTQgMS40MTQtNy43NzktNy43NzktNy43NzggNy43NzlMNyAyMy45N2w3Ljc3OC03Ljc3OUw3IDguNDE0IDguNDE0IDdsNy43NzggNy43NzhMMjMuOTcxIDd6IiBmaWxsPSIjM0Q0NzU3IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=) no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.image-previewer .image-close:hover{background-color:#e2e6ed}.image-previewer .image-container{position:relative}.image-previewer .image-container img{cursor:move;position:relative}.image-previewer .image-menu{height:50px;position:absolute;bottom:50px;z-index:99;display:flex;align-items:center;justify-content:center}.image-previewer .image-menu i{width:32px;height:32px;margin:0 8px;cursor:pointer;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.image-previewer .image-menu i:hover{background-color:#e2e6ed}.image-previewer .image-menu i.zoom-in{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE0IDE0di00aDJ2NGg0djJoLTR2NGgtMnYtNGgtNHYtMmg0em04Ljc0OSAxMC4xNjNBMTEuOTUyIDExLjk1MiAwIDAxMTUgMjdDOC4zNzMgMjcgMyAyMS42MjcgMyAxNVM4LjM3MyAzIDE1IDNzMTIgNS4zNzMgMTIgMTJjMCAyLjk1NC0xLjA2NyA1LjY1OC0yLjgzNyA3Ljc0OWw0LjkwOCA0LjkwOC0xLjQxNCAxLjQxNC00LjkwOC00LjkwOHpNMTUgMjVjNS41MjMgMCAxMC00LjQ3NyAxMC0xMFMyMC41MjMgNSAxNSA1IDUgOS40NzcgNSAxNXM0LjQ3NyAxMCAxMCAxMHoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.image-previewer .image-menu i.zoom-out{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIyLjc0OSAyNC4xNjNBMTEuOTUyIDExLjk1MiAwIDAxMTUgMjdDOC4zNzMgMjcgMyAyMS42MjcgMyAxNVM4LjM3MyAzIDE1IDNzMTIgNS4zNzMgMTIgMTJjMCAyLjk1NC0xLjA2NyA1LjY1OC0yLjgzNyA3Ljc0OWw0LjkwOCA0LjkwOC0xLjQxNCAxLjQxNC00LjkwOC00LjkwOHpNMTUgMjVjNS41MjMgMCAxMC00LjQ3NyAxMC0xMFMyMC41MjMgNSAxNSA1IDUgOS40NzcgNSAxNXM0LjQ3NyAxMCAxMCAxMHptLTUtMTFoMTB2MkgxMHYtMnoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.image-previewer .image-menu i.rotate{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTYgNGM2LjYyNyAwIDEyIDUuMzczIDEyIDEyYTExLjk3IDExLjk3IDAgMDEtNCA4Ljk0NFYyM2gtLjg2QTkuOTY4IDkuOTY4IDAgMDAyNiAxNmMwLTUuNTIzLTQuNDc3LTEwLTEwLTEwUzYgMTAuNDc3IDYgMTZjMCA1LjE4NSAzLjk0NyA5LjQ0OSA5IDkuOTV2Mi4wMDlDOC44NCAyNy40NTEgNCAyMi4yOTEgNCAxNiA0IDkuMzczIDkuMzczIDQgMTYgNHoiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik0xOS44NzkgMjcuMzI4bDEuNzY3LTYuNzE3IDQuOTUgNC45NXoiLz48L2c+PC9zdmc+)}.image-previewer .image-menu i.original-size{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQgNGgyNHYyNEg0VjR6bTIgMnYyMGgyMFY2SDZ6bTQgNWgydjEwaC0yVjExem01IDJoMnYyaC0ydi0yem0wIDRoMnYyaC0ydi0yem01LTZoMnYxMGgtMlYxMXoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.image-previewer .image-menu i.image-download{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQuNSAxNXYzLjVoMTVWMTVIMjF2NUgzdi01aDEuNXptOC4yMzItMTEuMjI2djkuMTk2bDQuMDUtNC4wNSAxLjA2IDEuMDYtNS44MzQgNS44MzQtNS44MzMtNS44MzMgMS4wNi0xLjA2IDMuOTk4IDMuOTk2VjMuNzc0aDEuNXoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.table-tool__row{position:absolute;width:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed}.table-tool__row .table-tool__row__item{width:100%;position:relative}.table-tool__row .table-tool__row__item:after{content:"";position:absolute;bottom:0;left:2px;width:8px;height:1px;background-color:#c0c6cf}.table-tool__row .table-tool__row__item:last-child:after{display:none}.table-tool__col{position:absolute;height:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed;display:flex}.table-tool__col .table-tool__col__item{height:100%;position:relative}.table-tool__col .table-tool__col__item:after{content:"";position:absolute;top:2px;left:-1px;width:1px;height:8px;z-index:1;background-color:#c0c6cf}.table-tool__col .table-tool__col__item:first-child:after{display:none}.table-tool__row .table-tool__row__item.active,.table-tool__col .table-tool__col__item.active{background-color:#c4d7fa}.table-tool__col .table-tool__anchor{right:-5px;width:10px;height:12px;z-index:9;position:absolute;cursor:col-resize}.table-tool__row .table-tool__anchor{bottom:-5px;left:0;width:12px;height:10px;z-index:9;position:absolute;cursor:row-resize}.table-anchor__line{z-index:9;position:absolute;border:1px dotted #000000}.contextmenu-container{z-index:9;position:fixed;display:none;padding:4px;overflow-x:hidden;overflow-y:auto;background:#fff;box-shadow:0 2px 12px #38383833;border:1px solid #e2e6ed;border-radius:2px}.contextmenu-content{display:flex;flex-direction:column}.contextmenu-content .contextmenu-sub-item:after{position:absolute;content:"";width:16px;height:16px;right:12px;background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMCAwaDE2djE2SDB6Ii8+PGcgZmlsbD0iIzc2N0M4NSI+PHBhdGggZD0iTTcgMTIuMjQzbC0uNzA3LS43MDcgNC4yNDMtNC4yNDMuNzA3LjcwN3oiLz48cGF0aCBkPSJNNi4yOTMgNC40NjRMNyAzLjc1NyAxMS4yNDMgOGwtLjcwNy43MDd6Ii8+PC9nPjwvZz48L3N2Zz4=)}.contextmenu-content .contextmenu-item{min-width:140px;padding:0 32px 0 16px;height:30px;display:flex;align-items:center;white-space:nowrap;box-sizing:border-box;cursor:pointer}.contextmenu-content .contextmenu-item.hover{background:rgba(25,55,88,.04)}.contextmenu-content .contextmenu-item span{max-width:300px;font-size:12px;color:#3d4757;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.contextmenu-content .contextmenu-item span.shortcut{color:#767c85;height:30px;flex:1;text-align:right;line-height:30px;margin-left:20px}.contextmenu-content .contextmenu-item i{width:16px;height:16px;vertical-align:middle;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;flex-shrink:0;margin-right:8px}.contextmenu-divider{background-color:#e2e6ed;margin:4px 16px;height:1px}.contextmenu-print{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjM0Q0NzU3IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0xMiA0aC0xVjJINXYySDRWMmExIDEgMCAwMTEtMWg2YTEgMSAwIDAxMSAxdjJ6bTAgNXY0YTEgMSAwIDAxLTEgMUg1YTEgMSAwIDAxLTEtMVY5aDF2NGg2VjloMXoiLz48cGF0aCBkPSJNMTIgMTJ2LTFoMlY1SDJ2NmgydjFIMmExIDEgMCAwMS0xLTFWNWExIDEgMCAwMTEtMWgxMmExIDEgMCAwMTEgMXY2YTEgMSAwIDAxLTEgMWgtMnoiLz48cGF0aCBkPSJNMyA4aDEwdjFIM3ptOC0yaDJ2MWgtMnoiLz48L2c+PC9zdmc+)}.contextmenu-image{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSLlm77lsYJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTYgMTYiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxzdHlsZT4uc3Qwe2ZpbGw6IzNkNDc1N308L3N0eWxlPjxnIGlkPSJfeDMwXzAt5YWs5YWxX3gyRl8wMuW3peWFt+agj194MkZf5o+S5YWl5Zu+54mHLTE2cHgtIj48ZyBpZD0iR3JvdXAtMTkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGlkPSJDb21iaW5lZC1TaGFwZSIgY2xhc3M9InN0MCIgZD0iTTEgMGgxMmMuNiAwIDEgLjQgMSAxdjExYzAgLjYtLjQgMS0xIDFIMWMtLjYgMC0xLS40LTEtMVYxYzAtLjYuNC0xIDEtMXptMCAxdjExaDEyVjFIMXoiLz48Y2lyY2xlIGlkPSLmpK3lnIblvaIiIGNsYXNzPSJzdDAiIGN4PSIxMCIgY3k9IjQiIHI9IjEiLz48cGF0aCBpZD0iUGF0aCIgY2xhc3M9InN0MCIgZD0iTTguNSAxMS4ybC00LTQuMUwxIDEwLjdWOS4yYzEuNy0xLjYgMi43LTIuNSAzLTIuOC40LS41LjctLjQgMSAwTDguNSAxMCAxMSA3LjNjLjQtLjUuNi0uNSAxLS4xbDIgMi44djEuNWwtMi41LTMuNC0zIDMuMXoiLz48L2c+PC9nPjwvc3ZnPg==)}.contextmenu-image-change{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyIDQpIiBmaWxsPSIjM0Q0NzU3Ij48Y2lyY2xlIGZpbGwtcnVsZT0ibm9uemVybyIgY3g9IjMiIGN5PSIxIiByPSIxIi8+PHBhdGggZD0iTTcuNDczIDguMjIzTDMuNDcgNC4xMDcgMCA3LjY2N3YtMS41QzEuNzE1IDQuNiAyLjcwNyAzLjY2NCAyLjk3NSAzLjM1OGMuNDAyLS40NTcuNjUxLS4zOSAxLjA0MiAwTDcuNDczIDcgOS45NiA0LjM0OWMuNDE0LS40NjIuNjItLjQ2MiAxLjAxMS0uMDcxTDEzIDcuMDZ2MS41bC0yLjUxLTMuNDEtMy4wMTcgMy4wNzJ6Ii8+PC9nPjxwYXRoIGQ9Ik02IDEuNUgxLjV2MTJoMTN2LTRWMTNhLjUuNSAwIDAxLS41LjVIMmEuNS41IDAgMDEtLjUtLjVWMmEuNS41IDAgMDEuNS0uNWg0em04LjUgOFY2bC0uNS41aDFsLS41LS41djMuNXpNNiAxLjVoNEw5LjUgMXYxbC41LS41SDZ6IiBzdHJva2U9IiMzRDQ3NTciLz48cGF0aCBkPSJNMTMuMDg1IDEuMzE2bC0zLjgxNCA0YTEgMSAwIDAwMS40NTggMS4zNjhsMy44MTUtNGExIDEgMCAxMC0xLjQ1OS0xLjM2OHoiIGZpbGw9IiMzRDQ3NTciIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvZz48L3N2Zz4=)}.contextmenu-insert-row-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiMzRDQ3NTciIGQ9Ik04LjUgNS41aDZ2NGgtNnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNNCA3djFoMlY3em0tMyAuNUw0IDV2NXpNMSAxaDEydjFIMXptMCAxMmgxMnYxSDF6Ii8+PC9nPjwvc3ZnPg==)}.contextmenu-insert-top-row{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNOCA1SDd2M2gxem0tLjUtM0wxMCA1SDV6Ii8+PHJlY3Qgc3Ryb2tlPSIjM0Q0NzU3IiB4PSIxLjUiIHk9IjEwLjUiIHdpZHRoPSIxMiIgaGVpZ2h0PSIzIiByeD0iMSIvPjwvZz48L3N2Zz4=)}.contextmenu-insert-bottom-row{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNNyAxMWgxVjhIN3ptLjUgM0w1IDExaDV6Ii8+PHJlY3Qgc3Ryb2tlPSIjM0Q0NzU3IiB4PSIxLjUiIHk9IjIuNSIgd2lkdGg9IjEyIiBoZWlnaHQ9IjMiIHJ4PSIxIi8+PC9nPjwvc3ZnPg==)}.contextmenu-insert-left-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMTEgN3YxaDNWN3ptLTMgLjVMMTEgNXY1eiIvPjxyZWN0IHN0cm9rZT0iIzNENDc1NyIgdHJhbnNmb3JtPSJyb3RhdGUoOTAgNCA3LjUpIiB4PSItMiIgeT0iNiIgd2lkdGg9IjEyIiBoZWlnaHQ9IjMiIHJ4PSIxIi8+PC9nPjwvc3ZnPg==)}.contextmenu-insert-right-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNNSA4VjdIMnYxem0zLS41TDUgMTBWNXoiLz48cmVjdCBzdHJva2U9IiMzRDQ3NTciIHRyYW5zZm9ybT0icm90YXRlKDkwIDEyIDcuNSkiIHg9IjYiIHk9IjYiIHdpZHRoPSIxMiIgaGVpZ2h0PSIzIiByeD0iMSIvPjwvZz48L3N2Zz4=)}.contextmenu-delete-row-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiM5MjlBQTgiIGQ9Ik04LjUgNi41aDZ2MmgtNnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMiAxMmgxMXYxSDJ6TTIgMmgxMXYxSDJ6bS42MyAzTDcgOS4zNWwtLjYzNS42NUwyIDUuNjN6Ii8+PHBhdGggZmlsbD0iIzNENDc1NyIgZD0iTTIgOS4zNjNMNi4zNTUgNSA3IDUuNzA3IDIuNjk1IDEweiIvPjwvZz48L3N2Zz4=)}.contextmenu-delete-row{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiM5MjlBQTgiIGQ9Ik04LjUgNS41aDZ2NGgtNnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMSAxM2gxMnYxSDF6TTEgMWgxMnYxSDF6bTAgNGgxdjFIMXptMSAxaDF2MUgyem0xIDFoMXYxSDN6bTEtMWgxdjFINHptMS0xaDF2MUg1ek00IDhoMXYxSDR6TTIgOGgxdjFIMnptMyAxaDF2MUg1ek0xIDloMXYxSDF6Ii8+PC9nPjwvc3ZnPg==)}.contextmenu-delete-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiM5MjlBQTgiIGQ9Ik01LjUgNy41di02aDR2NnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMTMgMTVWM2gxdjEyek0xIDE1VjNoMXYxMnptNCAwdi0xaDF2MXptMS0xdi0xaDF2MXptMS0xdi0xaDF2MXptLTEtMXYtMWgxdjF6bS0xLTF2LTFoMXYxem0zIDF2LTFoMXYxem0wIDJ2LTFoMXYxem0xLTN2LTFoMXYxem0wIDR2LTFoMXYxeiIvPjwvZz48L3N2Zz4=)}.contextmenu-delete-table{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTQgMTNoLTF2LTNIMnYzSDF2LTNhMSAxIDAgMDExLTFoMTFhMSAxIDAgMDExIDF2M3oiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik01LjYyNSAyTDEwIDYuMzc1IDkuMzc1IDcgNSAyLjYyNXoiLz48cGF0aCBkPSJNNSA2LjM3NUw5LjM3NSAybC42MjUuNjI1TDUuNjI1IDd6Ii8+PC9nPjwvc3ZnPg==)}.contextmenu-merge-cell{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNiAxdjFIMnYxMWg0djFIMmExIDEgMCAwMS0xLTFWMmExIDEgMCAwMTEtMWg0em0zIDBoNGExIDEgMCAwMTEgMXYxMWExIDEgMCAwMS0xIDFIOXYtMWg0VjJIOVYxeiIvPjxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYgMWgxdjRINnptMiAwaDF2NEg4eiIvPjxwYXRoIGQ9Ik04IDcuNUwxMCA2djN6bS0xIDBMNSA2djN6Ii8+PHBhdGggZD0iTTkgN2gzdjFIOXpNMyA3aDN2MUgzeiIvPjxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTggMTBoMXY0SDh6bS0yIDBoMXY0SDZ6Ii8+PC9nPjwvc3ZnPg==)}.contextmenu-merge-cancel-cell{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNiAxdjFIMnYxMWg0djFIMmExIDEgMCAwMS0xLTFWMmExIDEgMCAwMTEtMWg0em0zIDBoNGExIDEgMCAwMTEgMXYxMWExIDEgMCAwMS0xIDFIOXYtMWg0VjJIOVYxeiIvPjxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYgMWgxdjRINnptMiAwaDF2NEg4eiIvPjxwYXRoIGQ9Ik0zIDcuNUw1IDZ2M3ptOSAwTDEwIDZ2M3oiLz48cGF0aCBkPSJNNCA3aDN2MUg0em00IDBoM3YxSDh6Ii8+PHBhdGggZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOCAxMGgxdjRIOHptLTIgMGgxdjRINnoiLz48L2c+PC9zdmc+)}.hyperlink-popup{min-width:100px;font-size:12px;line-height:20px;background:#fff;box-shadow:0 2px 12px #626b8433;border-radius:2px;color:#3d4757;padding:16px;white-space:nowrap;position:absolute;z-index:1;text-align:center;display:none}.hyperlink-popup a{cursor:pointer;text-decoration:none;border-bottom-width:1px;border-bottom-style:solid;padding-bottom:2px;color:#00f}')),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();})();
|
|
1
|
+
(()=>{(function(){"use strict";try{if(typeof document!="undefined"){var e=document.createElement("style");e.appendChild(document.createTextNode('.ce-select-control-popup{max-width:160px;min-width:69px;max-height:225px;position:absolute;z-index:1;border:1px solid #e4e7ed;border-radius:4px;background-color:#fff;box-shadow:0 2px 12px #0000001a;box-sizing:border-box;margin:5px 0;overflow-y:auto}.ce-select-control-popup ul{list-style:none;padding:3px 0;margin:0;box-sizing:border-box}.ce-select-control-popup ul li{font-size:13px;padding:0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:#666;height:36px;line-height:36px;box-sizing:border-box;cursor:pointer}.ce-select-control-popup ul li:hover{background-color:#eef2fd}.ce-select-control-popup ul li.active{color:var(--COLOR-HOVER, #5175f4);font-weight:700}.ce-date-container{display:none;width:300px;overflow:hidden;left:0;right:0;position:absolute;z-index:1;color:#606266;background:#ffffff;border-radius:4px;padding:10px;user-select:none;border:1px solid #e4e7ed;box-shadow:0 2px 12px #0000001a}.ce-date-container.active{display:block}.ce-date-wrap{display:none}.ce-date-wrap.active{display:block}.ce-date-title{display:flex;justify-content:center;align-items:center;text-align:center;color:#606266;font-size:16px}.ce-date-title>span{display:inline-block}.ce-date-title>span:not(.ce-date-title__now){font-family:cursive;cursor:pointer}.ce-date-title>span:not(.ce-date-title__now):hover{color:#5175f4}.ce-date-title .ce-date-title__pre-year,.ce-date-title .ce-date-title__pre-month{width:15%}.ce-date-title .ce-date-title__now{width:40%}.ce-date-title .ce-date-title__next-year,.ce-date-title .ce-date-title__next-month{width:15%}.ce-date-week{width:100%;display:flex;justify-content:center;margin-top:15px;padding-bottom:5px;border-bottom:1px solid #e4e7ed}.ce-date-week>span{list-style:none;width:14.28571%;text-align:center;color:#606266;font-size:14px}.ce-date-day{width:100%;display:flex;flex-wrap:wrap;align-items:center;margin-top:5px}.ce-date-day>div{width:14.28571%;height:40px;text-align:center;color:#606266;font-size:14px;cursor:pointer;line-height:40px;border-radius:4px}.ce-date-day>div:hover{color:#5175f4;opacity:.8}.ce-date-day>div.active{color:#5175f4;font-weight:700}.ce-date-day>div.disable{color:#c0c4cc}.ce-date-day>div.select{color:#fff;background-color:#5175f4}.ce-time-wrap{display:none;padding:10px;height:286px}.ce-time-wrap ::-webkit-scrollbar{width:0}.ce-time-wrap.active{display:flex}.ce-time-wrap li{list-style:none}.ce-time-wrap>li{width:33.3%;height:100%;text-align:center}.ce-time-wrap>li>span{transform:translateY(-5px);display:inline-block}.ce-time-wrap>li>ol{height:calc(100% - 20px);overflow-y:auto;border:1px solid #e2e2e2;position:relative}.ce-time-wrap>li:first-child>ol{border-right:0}.ce-time-wrap>li:last-child>ol{border-left:0}.ce-time-wrap>li>ol>li{line-height:30px;cursor:pointer;transition:all .3s}.ce-time-wrap>li>ol>li:hover{background-color:#eaeaea}.ce-time-wrap>li>ol>li.active{color:#fff;background:#5175F4}.ce-date-menu{width:100%;height:28px;display:flex;justify-content:flex-end;align-items:center;padding-top:10px;position:relative;border-top:1px solid #e4e7ed}.ce-date-menu button{display:inline-block;line-height:1;white-space:nowrap;cursor:pointer;background:#fff;border:1px solid #dcdfe6;color:#606266;appearance:none;text-align:center;box-sizing:border-box;outline:none;transition:.1s;font-weight:500;user-select:none;padding:7px 15px;font-size:12px;border-radius:3px;margin:0 0 0 10px}.ce-date-menu button:hover{color:#5175f4;border-color:#5175f4}.ce-date-menu button.ce-date-menu__time{border:1px solid transparent;position:absolute;left:0;margin-left:0}.ce-date-menu button.ce-date-menu__time:hover{color:#5175f4}.ce-block-item{position:absolute;z-index:0;overflow:hidden;border-radius:8px;background-color:#fff;border:1px solid rgb(235 236 240)}.ce-table-tool__row{position:absolute;width:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed}.ce-table-tool__row .ce-table-tool__row__item{width:100%;position:relative}.ce-table-tool__row .ce-table-tool__row__item:after{content:"";position:absolute;bottom:0;left:2px;width:8px;height:1px;background-color:#c0c6cf}.ce-table-tool__row .ce-table-tool__row__item:last-child:after{display:none}.ce-table-tool__col{position:absolute;height:12px;border-radius:6.5px;overflow:hidden;background-color:#e2e6ed;display:flex}.ce-table-tool__col .ce-table-tool__col__item{height:100%;position:relative}.ce-table-tool__col .ce-table-tool__col__item:after{content:"";position:absolute;top:2px;left:-1px;width:1px;height:8px;z-index:1;background-color:#c0c6cf}.ce-table-tool__col .ce-table-tool__col__item:first-child:after{display:none}.ce-table-tool__row .ce-table-tool__row__item.active,.ce-table-tool__col .ce-table-tool__col__item.active{background-color:#c4d7fa}.ce-table-tool__col .ce-table-tool__anchor{right:-5px;width:10px;height:12px;z-index:9;position:absolute;cursor:col-resize}.ce-table-tool__row .ce-table-tool__anchor{bottom:-5px;left:0;width:12px;height:10px;z-index:9;position:absolute;cursor:row-resize}.ce-table-anchor__line{z-index:9;position:absolute;border:1px dotted #000000}.ce-resizer-selection{position:absolute;border:1px solid}.ce-resizer-selection>div{position:absolute;width:10px;height:10px;box-shadow:0 1px 4px #0000004d;border-radius:5px;border:2px solid #ffffff;box-sizing:border-box}.ce-resizer-selection .handle-0{cursor:nw-resize}.ce-resizer-selection .handle-1{cursor:n-resize}.ce-resizer-selection .handle-2{cursor:ne-resize}.ce-resizer-selection .handle-3{cursor:e-resize}.ce-resizer-selection .handle-4{cursor:se-resize}.ce-resizer-selection .handle-5{cursor:s-resize}.ce-resizer-selection .handle-6{cursor:sw-resize}.ce-resizer-selection .handle-7{cursor:w-resize}.ce-resizer-image{position:absolute;opacity:.5}.ce-image-previewer{position:fixed;left:0;top:0;z-index:1000;width:100%;height:100%;overflow:hidden;background:#f2f4f7;display:flex;align-items:center;justify-content:center;animation:previewerAnimation .3s}@keyframes previewerAnimation{0%{opacity:.1}to{opacity:1}}.ce-image-previewer .image-close{width:24px;height:24px;display:inline-block;position:absolute;right:50px;top:30px;z-index:99;cursor:pointer;background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIzLjk3IDdsMS40MTUgMS40MTQtNy43NzkgNy43NzggNy43NzkgNy43NzktMS40MTQgMS40MTQtNy43NzktNy43NzktNy43NzggNy43NzlMNyAyMy45N2w3Ljc3OC03Ljc3OUw3IDguNDE0IDguNDE0IDdsNy43NzggNy43NzhMMjMuOTcxIDd6IiBmaWxsPSIjM0Q0NzU3IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiLz48L3N2Zz4=) no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.ce-image-previewer .image-close:hover{background-color:#e2e6ed}.ce-image-previewer .ce-image-container{position:relative}.ce-image-previewer .ce-image-container img{cursor:move;position:relative}.ce-image-previewer .ce-image-menu{height:50px;position:absolute;bottom:50px;z-index:99;display:flex;align-items:center;justify-content:center}.ce-image-previewer .ce-image-menu i{width:32px;height:32px;margin:0 8px;cursor:pointer;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;transition:all .3s;border-radius:50%}.ce-image-previewer .ce-image-menu i:hover{background-color:#e2e6ed}.ce-image-previewer .ce-image-menu i.zoom-in{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE0IDE0di00aDJ2NGg0djJoLTR2NGgtMnYtNGgtNHYtMmg0em04Ljc0OSAxMC4xNjNBMTEuOTUyIDExLjk1MiAwIDAxMTUgMjdDOC4zNzMgMjcgMyAyMS42MjcgMyAxNVM4LjM3MyAzIDE1IDNzMTIgNS4zNzMgMTIgMTJjMCAyLjk1NC0xLjA2NyA1LjY1OC0yLjgzNyA3Ljc0OWw0LjkwOCA0LjkwOC0xLjQxNCAxLjQxNC00LjkwOC00LjkwOHpNMTUgMjVjNS41MjMgMCAxMC00LjQ3NyAxMC0xMFMyMC41MjMgNSAxNSA1IDUgOS40NzcgNSAxNXM0LjQ3NyAxMCAxMCAxMHoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.ce-image-previewer .ce-image-menu i.zoom-out{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTIyLjc0OSAyNC4xNjNBMTEuOTUyIDExLjk1MiAwIDAxMTUgMjdDOC4zNzMgMjcgMyAyMS42MjcgMyAxNVM4LjM3MyAzIDE1IDNzMTIgNS4zNzMgMTIgMTJjMCAyLjk1NC0xLjA2NyA1LjY1OC0yLjgzNyA3Ljc0OWw0LjkwOCA0LjkwOC0xLjQxNCAxLjQxNC00LjkwOC00LjkwOHpNMTUgMjVjNS41MjMgMCAxMC00LjQ3NyAxMC0xMFMyMC41MjMgNSAxNSA1IDUgOS40NzcgNSAxNXM0LjQ3NyAxMCAxMCAxMHptLTUtMTFoMTB2MkgxMHYtMnoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.ce-image-previewer .ce-image-menu i.rotate{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTYgNGM2LjYyNyAwIDEyIDUuMzczIDEyIDEyYTExLjk3IDExLjk3IDAgMDEtNCA4Ljk0NFYyM2gtLjg2QTkuOTY4IDkuOTY4IDAgMDAyNiAxNmMwLTUuNTIzLTQuNDc3LTEwLTEwLTEwUzYgMTAuNDc3IDYgMTZjMCA1LjE4NSAzLjk0NyA5LjQ0OSA5IDkuOTV2Mi4wMDlDOC44NCAyNy40NTEgNCAyMi4yOTEgNCAxNiA0IDkuMzczIDkuMzczIDQgMTYgNHoiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik0xOS44NzkgMjcuMzI4bDEuNzY3LTYuNzE3IDQuOTUgNC45NXoiLz48L2c+PC9zdmc+)}.ce-image-previewer .ce-image-menu i.original-size{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQgNGgyNHYyNEg0VjR6bTIgMnYyMGgyMFY2SDZ6bTQgNWgydjEwaC0yVjExem01IDJoMnYyaC0ydi0yem0wIDRoMnYyaC0ydi0yem01LTZoMnYxMGgtMlYxMXoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.ce-image-previewer .ce-image-menu i.image-download{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTQuNSAxNXYzLjVoMTVWMTVIMjF2NUgzdi01aDEuNXptOC4yMzItMTEuMjI2djkuMTk2bDQuMDUtNC4wNSAxLjA2IDEuMDYtNS44MzQgNS44MzQtNS44MzMtNS44MzMgMS4wNi0xLjA2IDMuOTk4IDMuOTk2VjMuNzc0aDEuNXoiIGZpbGw9IiMzRDQ3NTciLz48L3N2Zz4=)}.ce-contextmenu-container{z-index:9;position:fixed;display:none;padding:4px;overflow-x:hidden;overflow-y:auto;background:#fff;box-shadow:0 2px 12px #38383833;border:1px solid #e2e6ed;border-radius:2px}.ce-contextmenu-content{display:flex;flex-direction:column}.ce-contextmenu-content .ce-contextmenu-sub-item:after{position:absolute;content:"";width:16px;height:16px;right:12px;background:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMCAwaDE2djE2SDB6Ii8+PGcgZmlsbD0iIzc2N0M4NSI+PHBhdGggZD0iTTcgMTIuMjQzbC0uNzA3LS43MDcgNC4yNDMtNC4yNDMuNzA3LjcwN3oiLz48cGF0aCBkPSJNNi4yOTMgNC40NjRMNyAzLjc1NyAxMS4yNDMgOGwtLjcwNy43MDd6Ii8+PC9nPjwvZz48L3N2Zz4=)}.ce-contextmenu-content .ce-contextmenu-item{min-width:140px;padding:0 32px 0 16px;height:30px;display:flex;align-items:center;white-space:nowrap;box-sizing:border-box;cursor:pointer}.ce-contextmenu-content .ce-contextmenu-item.hover{background:rgba(25,55,88,.04)}.ce-contextmenu-content .ce-contextmenu-item span{max-width:300px;font-size:12px;color:#3d4757;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.ce-contextmenu-content .ce-contextmenu-item span.ce-shortcut{color:#767c85;height:30px;flex:1;text-align:right;line-height:30px;margin-left:20px}.ce-contextmenu-content .ce-contextmenu-item i{width:16px;height:16px;vertical-align:middle;display:inline-block;background-repeat:no-repeat;background-size:100% 100%;flex-shrink:0;margin-right:8px}.ce-contextmenu-divider{background-color:#e2e6ed;margin:4px 16px;height:1px}.ce-contextmenu-print{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHZpZXdCb3g9IjAgMCAxNiAxNiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48ZyBmaWxsPSIjM0Q0NzU3IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPjxwYXRoIGQ9Ik0xMiA0aC0xVjJINXYySDRWMmExIDEgMCAwMTEtMWg2YTEgMSAwIDAxMSAxdjJ6bTAgNXY0YTEgMSAwIDAxLTEgMUg1YTEgMSAwIDAxLTEtMVY5aDF2NGg2VjloMXoiLz48cGF0aCBkPSJNMTIgMTJ2LTFoMlY1SDJ2NmgydjFIMmExIDEgMCAwMS0xLTFWNWExIDEgMCAwMTEtMWgxMmExIDEgMCAwMTEgMXY2YTEgMSAwIDAxLTEgMWgtMnoiLz48cGF0aCBkPSJNMyA4aDEwdjFIM3ptOC0yaDJ2MWgtMnoiLz48L2c+PC9zdmc+)}.ce-contextmenu-image{background-image:url(data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGlkPSLlm77lsYJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTYgMTYiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxzdHlsZT4uc3Qwe2ZpbGw6IzNkNDc1N308L3N0eWxlPjxnIGlkPSJfeDMwXzAt5YWs5YWxX3gyRl8wMuW3peWFt+agj194MkZf5o+S5YWl5Zu+54mHLTE2cHgtIj48ZyBpZD0iR3JvdXAtMTkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDEgMSkiPjxwYXRoIGlkPSJDb21iaW5lZC1TaGFwZSIgY2xhc3M9InN0MCIgZD0iTTEgMGgxMmMuNiAwIDEgLjQgMSAxdjExYzAgLjYtLjQgMS0xIDFIMWMtLjYgMC0xLS40LTEtMVYxYzAtLjYuNC0xIDEtMXptMCAxdjExaDEyVjFIMXoiLz48Y2lyY2xlIGlkPSLmpK3lnIblvaIiIGNsYXNzPSJzdDAiIGN4PSIxMCIgY3k9IjQiIHI9IjEiLz48cGF0aCBpZD0iUGF0aCIgY2xhc3M9InN0MCIgZD0iTTguNSAxMS4ybC00LTQuMUwxIDEwLjdWOS4yYzEuNy0xLjYgMi43LTIuNSAzLTIuOC40LS41LjctLjQgMSAwTDguNSAxMCAxMSA3LjNjLjQtLjUuNi0uNSAxLS4xbDIgMi44djEuNWwtMi41LTMuNC0zIDMuMXoiLz48L2c+PC9nPjwvc3ZnPg==)}.ce-contextmenu-image-change{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48ZyB0cmFuc2Zvcm09InRyYW5zbGF0ZSgyIDQpIiBmaWxsPSIjM0Q0NzU3Ij48Y2lyY2xlIGZpbGwtcnVsZT0ibm9uemVybyIgY3g9IjMiIGN5PSIxIiByPSIxIi8+PHBhdGggZD0iTTcuNDczIDguMjIzTDMuNDcgNC4xMDcgMCA3LjY2N3YtMS41QzEuNzE1IDQuNiAyLjcwNyAzLjY2NCAyLjk3NSAzLjM1OGMuNDAyLS40NTcuNjUxLS4zOSAxLjA0MiAwTDcuNDczIDcgOS45NiA0LjM0OWMuNDE0LS40NjIuNjItLjQ2MiAxLjAxMS0uMDcxTDEzIDcuMDZ2MS41bC0yLjUxLTMuNDEtMy4wMTcgMy4wNzJ6Ii8+PC9nPjxwYXRoIGQ9Ik02IDEuNUgxLjV2MTJoMTN2LTRWMTNhLjUuNSAwIDAxLS41LjVIMmEuNS41IDAgMDEtLjUtLjVWMmEuNS41IDAgMDEuNS0uNWg0em04LjUgOFY2bC0uNS41aDFsLS41LS41djMuNXpNNiAxLjVoNEw5LjUgMXYxbC41LS41SDZ6IiBzdHJva2U9IiMzRDQ3NTciLz48cGF0aCBkPSJNMTMuMDg1IDEuMzE2bC0zLjgxNCA0YTEgMSAwIDAwMS40NTggMS4zNjhsMy44MTUtNGExIDEgMCAxMC0xLjQ1OS0xLjM2OHoiIGZpbGw9IiMzRDQ3NTciIGZpbGwtcnVsZT0ibm9uemVybyIvPjwvZz48L3N2Zz4=)}.ce-contextmenu-insert-row-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiMzRDQ3NTciIGQ9Ik04LjUgNS41aDZ2NGgtNnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNNCA3djFoMlY3em0tMyAuNUw0IDV2NXpNMSAxaDEydjFIMXptMCAxMmgxMnYxSDF6Ii8+PC9nPjwvc3ZnPg==)}.ce-contextmenu-insert-top-row{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNOCA1SDd2M2gxem0tLjUtM0wxMCA1SDV6Ii8+PHJlY3Qgc3Ryb2tlPSIjM0Q0NzU3IiB4PSIxLjUiIHk9IjEwLjUiIHdpZHRoPSIxMiIgaGVpZ2h0PSIzIiByeD0iMSIvPjwvZz48L3N2Zz4=)}.ce-contextmenu-insert-bottom-row{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNNyAxMWgxVjhIN3ptLjUgM0w1IDExaDV6Ii8+PHJlY3Qgc3Ryb2tlPSIjM0Q0NzU3IiB4PSIxLjUiIHk9IjIuNSIgd2lkdGg9IjEyIiBoZWlnaHQ9IjMiIHJ4PSIxIi8+PC9nPjwvc3ZnPg==)}.ce-contextmenu-insert-left-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMTEgN3YxaDNWN3ptLTMgLjVMMTEgNXY1eiIvPjxyZWN0IHN0cm9rZT0iIzNENDc1NyIgdHJhbnNmb3JtPSJyb3RhdGUoOTAgNCA3LjUpIiB4PSItMiIgeT0iNiIgd2lkdGg9IjEyIiBoZWlnaHQ9IjMiIHJ4PSIxIi8+PC9nPjwvc3ZnPg==)}.ce-contextmenu-insert-right-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNNSA4VjdIMnYxem0zLS41TDUgMTBWNXoiLz48cmVjdCBzdHJva2U9IiMzRDQ3NTciIHRyYW5zZm9ybT0icm90YXRlKDkwIDEyIDcuNSkiIHg9IjYiIHk9IjYiIHdpZHRoPSIxMiIgaGVpZ2h0PSIzIiByeD0iMSIvPjwvZz48L3N2Zz4=)}.ce-contextmenu-delete-row-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiM5MjlBQTgiIGQ9Ik04LjUgNi41aDZ2MmgtNnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMiAxMmgxMXYxSDJ6TTIgMmgxMXYxSDJ6bS42MyAzTDcgOS4zNWwtLjYzNS42NUwyIDUuNjN6Ii8+PHBhdGggZmlsbD0iIzNENDc1NyIgZD0iTTIgOS4zNjNMNi4zNTUgNSA3IDUuNzA3IDIuNjk1IDEweiIvPjwvZz48L3N2Zz4=)}.ce-contextmenu-delete-row{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiM5MjlBQTgiIGQ9Ik04LjUgNS41aDZ2NGgtNnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMSAxM2gxMnYxSDF6TTEgMWgxMnYxSDF6bTAgNGgxdjFIMXptMSAxaDF2MUgyem0xIDFoMXYxSDN6bTEtMWgxdjFINHptMS0xaDF2MUg1ek00IDhoMXYxSDR6TTIgOGgxdjFIMnptMyAxaDF2MUg1ek0xIDloMXYxSDF6Ii8+PC9nPjwvc3ZnPg==)}.ce-contextmenu-delete-col{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0ibm9uZSIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBzdHJva2U9IiM5MjlBQTgiIGQ9Ik01LjUgNy41di02aDR2NnoiLz48cGF0aCBmaWxsPSIjM0Q0NzU3IiBkPSJNMTMgMTVWM2gxdjEyek0xIDE1VjNoMXYxMnptNCAwdi0xaDF2MXptMS0xdi0xaDF2MXptMS0xdi0xaDF2MXptLTEtMXYtMWgxdjF6bS0xLTF2LTFoMXYxem0zIDF2LTFoMXYxem0wIDJ2LTFoMXYxem0xLTN2LTFoMXYxem0wIDR2LTFoMXYxeiIvPjwvZz48L3N2Zz4=)}.ce-contextmenu-delete-table{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNMTQgMTNoLTF2LTNIMnYzSDF2LTNhMSAxIDAgMDExLTFoMTFhMSAxIDAgMDExIDF2M3oiIGZpbGwtcnVsZT0ibm9uemVybyIvPjxwYXRoIGQ9Ik01LjYyNSAyTDEwIDYuMzc1IDkuMzc1IDcgNSAyLjYyNXoiLz48cGF0aCBkPSJNNSA2LjM3NUw5LjM3NSAybC42MjUuNjI1TDUuNjI1IDd6Ii8+PC9nPjwvc3ZnPg==)}.ce-contextmenu-merge-cell{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNiAxdjFIMnYxMWg0djFIMmExIDEgMCAwMS0xLTFWMmExIDEgMCAwMTEtMWg0em0zIDBoNGExIDEgMCAwMTEgMXYxMWExIDEgMCAwMS0xIDFIOXYtMWg0VjJIOVYxeiIvPjxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYgMWgxdjRINnptMiAwaDF2NEg4eiIvPjxwYXRoIGQ9Ik04IDcuNUwxMCA2djN6bS0xIDBMNSA2djN6Ii8+PHBhdGggZD0iTTkgN2gzdjFIOXpNMyA3aDN2MUgzeiIvPjxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTggMTBoMXY0SDh6bS0yIDBoMXY0SDZ6Ii8+PC9nPjwvc3ZnPg==)}.ce-contextmenu-merge-cancel-cell{background-image:url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTYiIGhlaWdodD0iMTYiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iIzNENDc1NyIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJNNiAxdjFIMnYxMWg0djFIMmExIDEgMCAwMS0xLTFWMmExIDEgMCAwMTEtMWg0em0zIDBoNGExIDEgMCAwMTEgMXYxMWExIDEgMCAwMS0xIDFIOXYtMWg0VjJIOVYxeiIvPjxwYXRoIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYgMWgxdjRINnptMiAwaDF2NEg4eiIvPjxwYXRoIGQ9Ik0zIDcuNUw1IDZ2M3ptOSAwTDEwIDZ2M3oiLz48cGF0aCBkPSJNNCA3aDN2MUg0em00IDBoM3YxSDh6Ii8+PHBhdGggZmlsbC1ydWxlPSJub256ZXJvIiBkPSJNOCAxMGgxdjRIOHptLTIgMGgxdjRINnoiLz48L2c+PC9zdmc+)}.ce-hyperlink-popup{min-width:100px;font-size:12px;line-height:20px;background:#fff;box-shadow:0 2px 12px #626b8433;border-radius:2px;color:#3d4757;padding:16px;white-space:nowrap;position:absolute;z-index:1;text-align:center;display:none}.ce-hyperlink-popup a{cursor:pointer;text-decoration:none;border-bottom-width:1px;border-bottom-style:solid;padding-bottom:2px;color:#00f}.ce-inputarea{width:0;height:12px;min-width:0;min-height:0;margin:0;padding:0;left:0;right:0;letter-spacing:0;font-size:12px;position:absolute;outline:none;resize:none;border:none;overflow:hidden;color:transparent;user-select:none;background-color:transparent}.ce-cursor{width:1px;height:20px;left:0;right:0;position:absolute;outline:none;background-color:#000;pointer-events:none}.ce-cursor.ce-cursor--animation{animation-duration:1s;animation-iteration-count:infinite;animation-name:cursorAnimation}@keyframes cursorAnimation{0%{opacity:1}13%{opacity:0}50%{opacity:0}63%{opacity:1}to{opacity:1}}')),document.head.appendChild(e)}}catch(i){console.error("vite-plugin-css-injected-by-js",i)}})();})();
|
|
2
2
|
var __defProp = Object.defineProperty;
|
|
3
3
|
var __defProps = Object.defineProperties;
|
|
4
4
|
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
@@ -23,7 +23,7 @@ var __publicField = (obj, key, value) => {
|
|
|
23
23
|
return value;
|
|
24
24
|
};
|
|
25
25
|
var index = "";
|
|
26
|
-
const version = "0.9.
|
|
26
|
+
const version = "0.9.11";
|
|
27
27
|
const ZERO = "\u200B";
|
|
28
28
|
const WRAP = "\n";
|
|
29
29
|
var RowFlex;
|
|
@@ -92,7 +92,7 @@ function downloadFile(href, fileName) {
|
|
|
92
92
|
a.download = fileName;
|
|
93
93
|
a.click();
|
|
94
94
|
}
|
|
95
|
-
function threeClick(dom, fn) {
|
|
95
|
+
function threeClick$1(dom, fn) {
|
|
96
96
|
nClickEvent(3, dom, fn);
|
|
97
97
|
}
|
|
98
98
|
function nClickEvent(n, dom, fn) {
|
|
@@ -110,6 +110,8 @@ function nClickEvent(n, dom, fn) {
|
|
|
110
110
|
dom.addEventListener("click", handler);
|
|
111
111
|
}
|
|
112
112
|
const CURSOR_AGENT_HEIGHT = 12;
|
|
113
|
+
const EDITOR_COMPONENT = "editor-component";
|
|
114
|
+
const EDITOR_PREFIX = "ce";
|
|
113
115
|
var ElementType;
|
|
114
116
|
(function(ElementType2) {
|
|
115
117
|
ElementType2["TEXT"] = "text";
|
|
@@ -3719,7 +3721,7 @@ class CursorAgent {
|
|
|
3719
3721
|
this.canvasEvent = canvasEvent;
|
|
3720
3722
|
const agentCursorDom = document.createElement("textarea");
|
|
3721
3723
|
agentCursorDom.autocomplete = "off";
|
|
3722
|
-
agentCursorDom.classList.add(
|
|
3724
|
+
agentCursorDom.classList.add(`${EDITOR_PREFIX}-inputarea`);
|
|
3723
3725
|
agentCursorDom.innerText = "";
|
|
3724
3726
|
this.container.append(agentCursorDom);
|
|
3725
3727
|
this.agentCursorDom = agentCursorDom;
|
|
@@ -3811,7 +3813,7 @@ class Cursor {
|
|
|
3811
3813
|
this.position = draw.getPosition();
|
|
3812
3814
|
this.options = draw.getOptions();
|
|
3813
3815
|
this.cursorDom = document.createElement("div");
|
|
3814
|
-
this.cursorDom.classList.add(
|
|
3816
|
+
this.cursorDom.classList.add(`${EDITOR_PREFIX}-cursor`);
|
|
3815
3817
|
this.container.append(this.cursorDom);
|
|
3816
3818
|
this.cursorAgent = new CursorAgent(draw, canvasEvent);
|
|
3817
3819
|
}
|
|
@@ -3848,12 +3850,12 @@ class Cursor {
|
|
|
3848
3850
|
this.cursorDom.style.display = isReadonly ? "none" : "block";
|
|
3849
3851
|
this.cursorDom.style.height = `${cursorHeight}px`;
|
|
3850
3852
|
setTimeout(() => {
|
|
3851
|
-
this.cursorDom.classList.add(
|
|
3853
|
+
this.cursorDom.classList.add(`${EDITOR_PREFIX}-cursor--animation`);
|
|
3852
3854
|
}, 200);
|
|
3853
3855
|
}
|
|
3854
3856
|
recoveryCursor() {
|
|
3855
3857
|
this.cursorDom.style.display = "none";
|
|
3856
|
-
this.cursorDom.classList.remove(
|
|
3858
|
+
this.cursorDom.classList.remove(`${EDITOR_PREFIX}-cursor--animation`);
|
|
3857
3859
|
}
|
|
3858
3860
|
}
|
|
3859
3861
|
var MouseEventButton;
|
|
@@ -3945,8 +3947,6 @@ var KeyMap;
|
|
|
3945
3947
|
KeyMap2["EIGHT"] = "8";
|
|
3946
3948
|
KeyMap2["NINE"] = "9";
|
|
3947
3949
|
})(KeyMap || (KeyMap = {}));
|
|
3948
|
-
const LETTER_REG = /[a-zA-Z]/;
|
|
3949
|
-
const NUMBER_LIKE_REG = /[0-9.]/;
|
|
3950
3950
|
class CheckboxControl {
|
|
3951
3951
|
constructor(element, control) {
|
|
3952
3952
|
__publicField(this, "element");
|
|
@@ -4044,442 +4044,550 @@ class CheckboxControl {
|
|
|
4044
4044
|
return endIndex;
|
|
4045
4045
|
}
|
|
4046
4046
|
}
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
__publicField(this, "control");
|
|
4066
|
-
this.isAllowDrag = false;
|
|
4067
|
-
this.isCompositing = false;
|
|
4068
|
-
this.mouseDownStartPosition = null;
|
|
4069
|
-
this.pageContainer = draw.getPageContainer();
|
|
4070
|
-
this.pageList = draw.getPageList();
|
|
4071
|
-
this.draw = draw;
|
|
4072
|
-
this.options = draw.getOptions();
|
|
4073
|
-
this.cursor = null;
|
|
4074
|
-
this.position = this.draw.getPosition();
|
|
4075
|
-
this.range = this.draw.getRange();
|
|
4076
|
-
this.historyManager = this.draw.getHistoryManager();
|
|
4077
|
-
this.previewer = this.draw.getPreviewer();
|
|
4078
|
-
this.tableTool = this.draw.getTableTool();
|
|
4079
|
-
this.hyperlinkParticle = this.draw.getHyperlinkParticle();
|
|
4080
|
-
this.dateParticle = this.draw.getDateParticle();
|
|
4081
|
-
this.listener = this.draw.getListener();
|
|
4082
|
-
this.control = this.draw.getControl();
|
|
4083
|
-
}
|
|
4084
|
-
register() {
|
|
4085
|
-
this.cursor = this.draw.getCursor();
|
|
4086
|
-
this.pageContainer.addEventListener("mousedown", this.mousedown.bind(this));
|
|
4087
|
-
this.pageContainer.addEventListener("mouseleave", this.mouseleave.bind(this));
|
|
4088
|
-
this.pageContainer.addEventListener("mousemove", this.mousemove.bind(this));
|
|
4089
|
-
this.pageContainer.addEventListener("dblclick", this.dblclick.bind(this));
|
|
4090
|
-
threeClick(this.pageContainer, this.threeClick.bind(this));
|
|
4091
|
-
}
|
|
4092
|
-
setIsAllowDrag(payload) {
|
|
4093
|
-
this.isAllowDrag = payload;
|
|
4094
|
-
if (!payload) {
|
|
4095
|
-
this.applyPainterStyle();
|
|
4047
|
+
function mousedown(evt, host) {
|
|
4048
|
+
if (evt.button === MouseEventButton.RIGHT)
|
|
4049
|
+
return;
|
|
4050
|
+
const draw = host.getDraw();
|
|
4051
|
+
const isReadonly = draw.isReadonly();
|
|
4052
|
+
const rangeManager = draw.getRange();
|
|
4053
|
+
const position = draw.getPosition();
|
|
4054
|
+
if (!host.isAllowDrag) {
|
|
4055
|
+
const range = rangeManager.getRange();
|
|
4056
|
+
if (!isReadonly && range.startIndex !== range.endIndex) {
|
|
4057
|
+
const isPointInRange = rangeManager.getIsPointInRange(evt.offsetX, evt.offsetY);
|
|
4058
|
+
if (isPointInRange) {
|
|
4059
|
+
host.isAllowDrag = true;
|
|
4060
|
+
host.cacheRange = deepClone(range);
|
|
4061
|
+
host.cacheElementList = draw.getElementList();
|
|
4062
|
+
host.cachePositionList = position.getPositionList();
|
|
4063
|
+
return;
|
|
4064
|
+
}
|
|
4096
4065
|
}
|
|
4097
4066
|
}
|
|
4098
|
-
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
this.draw.setPainterStyle(null);
|
|
4103
|
-
}
|
|
4104
|
-
applyPainterStyle() {
|
|
4105
|
-
const painterStyle = this.draw.getPainterStyle();
|
|
4106
|
-
if (!painterStyle)
|
|
4107
|
-
return;
|
|
4108
|
-
const selection = this.range.getSelection();
|
|
4109
|
-
if (!selection)
|
|
4110
|
-
return;
|
|
4111
|
-
const painterStyleKeys = Object.keys(painterStyle);
|
|
4112
|
-
selection.forEach((s) => {
|
|
4113
|
-
painterStyleKeys.forEach((pKey) => {
|
|
4114
|
-
const key = pKey;
|
|
4115
|
-
s[key] = painterStyle[key];
|
|
4116
|
-
});
|
|
4117
|
-
});
|
|
4118
|
-
this.draw.render({ isSetCursor: false });
|
|
4119
|
-
const painterOptions = this.draw.getPainterOptions();
|
|
4120
|
-
if (!painterOptions || !painterOptions.isDblclick) {
|
|
4121
|
-
this.clearPainterStyle();
|
|
4122
|
-
}
|
|
4067
|
+
const target = evt.target;
|
|
4068
|
+
const pageIndex = target.dataset.index;
|
|
4069
|
+
if (pageIndex) {
|
|
4070
|
+
draw.setPageNo(Number(pageIndex));
|
|
4123
4071
|
}
|
|
4124
|
-
|
|
4125
|
-
|
|
4126
|
-
|
|
4127
|
-
|
|
4128
|
-
|
|
4129
|
-
|
|
4130
|
-
|
|
4131
|
-
|
|
4132
|
-
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4072
|
+
host.isAllowSelection = true;
|
|
4073
|
+
const positionResult = position.adjustPositionContext({
|
|
4074
|
+
x: evt.offsetX,
|
|
4075
|
+
y: evt.offsetY
|
|
4076
|
+
});
|
|
4077
|
+
const { index: index2, isDirectHit, isCheckbox, isImage, isTable, tdValueIndex } = positionResult;
|
|
4078
|
+
host.mouseDownStartPosition = __spreadProps(__spreadValues({}, positionResult), {
|
|
4079
|
+
index: isTable ? tdValueIndex : index2
|
|
4080
|
+
});
|
|
4081
|
+
const elementList = draw.getElementList();
|
|
4082
|
+
const positionList = position.getPositionList();
|
|
4083
|
+
const curIndex = isTable ? tdValueIndex : index2;
|
|
4084
|
+
const curElement = elementList[curIndex];
|
|
4085
|
+
const isDirectHitImage = !!(isDirectHit && isImage);
|
|
4086
|
+
const isDirectHitCheckbox = !!(isDirectHit && isCheckbox);
|
|
4087
|
+
if (~index2) {
|
|
4088
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4089
|
+
position.setCursorPosition(positionList[curIndex]);
|
|
4090
|
+
const isSetCheckbox = isDirectHitCheckbox && !isReadonly;
|
|
4091
|
+
if (isSetCheckbox) {
|
|
4092
|
+
const { checkbox } = curElement;
|
|
4093
|
+
if (checkbox) {
|
|
4094
|
+
checkbox.value = !checkbox.value;
|
|
4095
|
+
} else {
|
|
4096
|
+
curElement.checkbox = {
|
|
4097
|
+
value: true
|
|
4098
|
+
};
|
|
4099
|
+
}
|
|
4100
|
+
const control = draw.getControl();
|
|
4101
|
+
const activeControl = control.getActiveControl();
|
|
4102
|
+
if (activeControl instanceof CheckboxControl) {
|
|
4103
|
+
activeControl.setSelect();
|
|
4146
4104
|
}
|
|
4147
|
-
if (start === end)
|
|
4148
|
-
return;
|
|
4149
|
-
this.range.setRange(start, end);
|
|
4150
4105
|
}
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
|
|
4106
|
+
draw.render({
|
|
4107
|
+
curIndex,
|
|
4108
|
+
isSubmitHistory: isSetCheckbox,
|
|
4109
|
+
isSetCursor: !isDirectHitImage && !isDirectHitCheckbox,
|
|
4154
4110
|
isComputeRowList: false
|
|
4155
4111
|
});
|
|
4156
4112
|
}
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4167
|
-
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4113
|
+
const previewer = draw.getPreviewer();
|
|
4114
|
+
previewer.clearResizer();
|
|
4115
|
+
if (isDirectHitImage && !isReadonly) {
|
|
4116
|
+
previewer.drawResizer(curElement, positionList[curIndex], curElement.type === ElementType.LATEX ? {
|
|
4117
|
+
mime: "svg",
|
|
4118
|
+
srcKey: "laTexSVG"
|
|
4119
|
+
} : {});
|
|
4120
|
+
}
|
|
4121
|
+
const tableTool = draw.getTableTool();
|
|
4122
|
+
tableTool.dispose();
|
|
4123
|
+
if (isTable && !isReadonly) {
|
|
4124
|
+
const originalElementList = draw.getOriginalElementList();
|
|
4125
|
+
const originalPositionList = position.getOriginalPositionList();
|
|
4126
|
+
tableTool.render(originalElementList[index2], originalPositionList[index2]);
|
|
4127
|
+
}
|
|
4128
|
+
const hyperlinkParticle = draw.getHyperlinkParticle();
|
|
4129
|
+
hyperlinkParticle.clearHyperlinkPopup();
|
|
4130
|
+
if (curElement.type === ElementType.HYPERLINK) {
|
|
4131
|
+
hyperlinkParticle.drawHyperlinkPopup(curElement, positionList[curIndex]);
|
|
4132
|
+
}
|
|
4133
|
+
const dateParticle = draw.getDateParticle();
|
|
4134
|
+
dateParticle.clearDatePicker();
|
|
4135
|
+
if (curElement.type === ElementType.DATE && !isReadonly) {
|
|
4136
|
+
dateParticle.renderDatePicker(curElement, positionList[curIndex]);
|
|
4137
|
+
}
|
|
4138
|
+
}
|
|
4139
|
+
function mouseup(evt, host) {
|
|
4140
|
+
if (host.isAllowDrop) {
|
|
4141
|
+
const draw = host.getDraw();
|
|
4142
|
+
const position = draw.getPosition();
|
|
4143
|
+
const rangeManager = draw.getRange();
|
|
4144
|
+
const cacheRange = host.cacheRange;
|
|
4145
|
+
const cacheElementList = host.cacheElementList;
|
|
4146
|
+
const cachePositionList = host.cachePositionList;
|
|
4147
|
+
const range = rangeManager.getRange();
|
|
4148
|
+
const elementList = draw.getElementList();
|
|
4149
|
+
const positionList = position.getPositionList();
|
|
4150
|
+
const startPosition = positionList[range.startIndex];
|
|
4151
|
+
const cacheStartElement = cacheElementList[cacheRange.startIndex];
|
|
4152
|
+
const startElement = elementList[range.startIndex];
|
|
4153
|
+
let curIndex = range.startIndex;
|
|
4154
|
+
if (cacheStartElement.tdId === startElement.tdId && range.startIndex > cacheRange.endIndex) {
|
|
4155
|
+
curIndex -= cacheRange.endIndex - cacheRange.startIndex;
|
|
4156
|
+
}
|
|
4157
|
+
const deleteElementList = cacheElementList.splice(cacheRange.startIndex + 1, cacheRange.endIndex - cacheRange.startIndex);
|
|
4158
|
+
let restArg = {};
|
|
4159
|
+
if (startElement.tableId) {
|
|
4160
|
+
const { tdId, trId, tableId } = startElement;
|
|
4161
|
+
restArg = { tdId, trId, tableId };
|
|
4185
4162
|
}
|
|
4186
|
-
const
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
tdId,
|
|
4195
|
-
trId,
|
|
4196
|
-
tableId
|
|
4197
|
-
});
|
|
4198
|
-
this.mouseDownStartPosition = __spreadProps(__spreadValues({}, positionResult), {
|
|
4199
|
-
index: isTable ? tdValueIndex : index2
|
|
4200
|
-
});
|
|
4201
|
-
const elementList = this.draw.getElementList();
|
|
4202
|
-
const positionList = this.position.getPositionList();
|
|
4203
|
-
const curIndex = isTable ? tdValueIndex : index2;
|
|
4204
|
-
const curElement = elementList[curIndex];
|
|
4205
|
-
const isDirectHitImage = !!(isDirectHit && isImage);
|
|
4206
|
-
const isDirectHitCheckbox = !!(isDirectHit && isCheckbox);
|
|
4207
|
-
if (~index2) {
|
|
4208
|
-
this.range.setRange(curIndex, curIndex);
|
|
4209
|
-
this.position.setCursorPosition(positionList[curIndex]);
|
|
4210
|
-
const isSetCheckbox = isDirectHitCheckbox && !isReadonly;
|
|
4211
|
-
if (isSetCheckbox) {
|
|
4212
|
-
const { checkbox } = curElement;
|
|
4213
|
-
if (checkbox) {
|
|
4214
|
-
checkbox.value = !checkbox.value;
|
|
4215
|
-
} else {
|
|
4216
|
-
curElement.checkbox = {
|
|
4217
|
-
value: true
|
|
4218
|
-
};
|
|
4219
|
-
}
|
|
4220
|
-
const activeControl = this.control.getActiveControl();
|
|
4221
|
-
if (activeControl instanceof CheckboxControl) {
|
|
4222
|
-
activeControl.setSelect();
|
|
4163
|
+
const replaceElementList = deleteElementList.map((el) => {
|
|
4164
|
+
const newElement = __spreadValues({
|
|
4165
|
+
value: el.value
|
|
4166
|
+
}, restArg);
|
|
4167
|
+
EDITOR_ELEMENT_STYLE_ATTR.forEach((attr) => {
|
|
4168
|
+
const value = el[attr];
|
|
4169
|
+
if (value !== void 0) {
|
|
4170
|
+
newElement[attr] = value;
|
|
4223
4171
|
}
|
|
4224
|
-
}
|
|
4225
|
-
this.draw.render({
|
|
4226
|
-
curIndex,
|
|
4227
|
-
isSubmitHistory: isSetCheckbox,
|
|
4228
|
-
isSetCursor: !isDirectHitImage && !isDirectHitCheckbox,
|
|
4229
|
-
isComputeRowList: false
|
|
4230
4172
|
});
|
|
4173
|
+
return newElement;
|
|
4174
|
+
});
|
|
4175
|
+
elementList.splice(curIndex + 1, 0, ...replaceElementList);
|
|
4176
|
+
const cacheStartPosition = cachePositionList[cacheRange.startIndex];
|
|
4177
|
+
const positionContext = position.getPositionContext();
|
|
4178
|
+
let positionContextIndex = positionContext.index;
|
|
4179
|
+
if (positionContextIndex) {
|
|
4180
|
+
if (startElement.tableId && !cacheStartElement.tableId) {
|
|
4181
|
+
if (cacheStartPosition.index < positionContextIndex) {
|
|
4182
|
+
positionContextIndex -= deleteElementList.length;
|
|
4183
|
+
}
|
|
4184
|
+
} else if (!startElement.tableId && cacheStartElement.tableId) {
|
|
4185
|
+
if (startPosition.index < positionContextIndex) {
|
|
4186
|
+
positionContextIndex += deleteElementList.length;
|
|
4187
|
+
}
|
|
4188
|
+
}
|
|
4189
|
+
position.setPositionContext(__spreadProps(__spreadValues({}, positionContext), {
|
|
4190
|
+
index: positionContextIndex
|
|
4191
|
+
}));
|
|
4231
4192
|
}
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4238
|
-
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
|
|
4251
|
-
|
|
4193
|
+
rangeManager.setRange(curIndex, curIndex + deleteElementList.length, range.tableId, range.startTdIndex, range.endTdIndex, range.startTrIndex, range.endTrIndex);
|
|
4194
|
+
draw.render({
|
|
4195
|
+
isSetCursor: false
|
|
4196
|
+
});
|
|
4197
|
+
host.isAllowDrag = false;
|
|
4198
|
+
host.isAllowDrop = false;
|
|
4199
|
+
} else if (host.isAllowDrag) {
|
|
4200
|
+
host.mousedown(evt);
|
|
4201
|
+
host.isAllowDrag = false;
|
|
4202
|
+
}
|
|
4203
|
+
}
|
|
4204
|
+
function mouseleave(evt, host) {
|
|
4205
|
+
const draw = host.getDraw();
|
|
4206
|
+
const pageContainer = draw.getPageContainer();
|
|
4207
|
+
const { x, y, width, height } = pageContainer.getBoundingClientRect();
|
|
4208
|
+
if (evt.x >= x && evt.x <= x + width && evt.y >= y && evt.y <= y + height)
|
|
4209
|
+
return;
|
|
4210
|
+
host.setIsAllowSelection(false);
|
|
4211
|
+
}
|
|
4212
|
+
function mousemove(evt, host) {
|
|
4213
|
+
const draw = host.getDraw();
|
|
4214
|
+
if (host.isAllowDrag) {
|
|
4215
|
+
const x = evt.offsetX;
|
|
4216
|
+
const y = evt.offsetY;
|
|
4217
|
+
const { startIndex: startIndex2, endIndex: endIndex2 } = host.cacheRange;
|
|
4218
|
+
const positionList = host.cachePositionList;
|
|
4219
|
+
for (let p = startIndex2 + 1; p <= endIndex2; p++) {
|
|
4220
|
+
const { coordinate: { leftTop, rightBottom } } = positionList[p];
|
|
4221
|
+
if (x >= leftTop[0] && x <= rightBottom[0] && y >= leftTop[1] && y <= rightBottom[1]) {
|
|
4222
|
+
return;
|
|
4223
|
+
}
|
|
4252
4224
|
}
|
|
4225
|
+
host.dragover(evt);
|
|
4226
|
+
host.isAllowDrop = true;
|
|
4227
|
+
return;
|
|
4253
4228
|
}
|
|
4254
|
-
|
|
4255
|
-
|
|
4256
|
-
|
|
4229
|
+
if (!host.isAllowSelection || !host.mouseDownStartPosition)
|
|
4230
|
+
return;
|
|
4231
|
+
const target = evt.target;
|
|
4232
|
+
const pageIndex = target.dataset.index;
|
|
4233
|
+
if (pageIndex) {
|
|
4234
|
+
draw.setPageNo(Number(pageIndex));
|
|
4235
|
+
}
|
|
4236
|
+
const position = draw.getPosition();
|
|
4237
|
+
const positionResult = position.getPositionByXY({
|
|
4238
|
+
x: evt.offsetX,
|
|
4239
|
+
y: evt.offsetY
|
|
4240
|
+
});
|
|
4241
|
+
const { index: index2, isTable, tdValueIndex, tdIndex, trIndex, tableId } = positionResult;
|
|
4242
|
+
const { index: startIndex, isTable: startIsTable, tdIndex: startTdIndex, trIndex: startTrIndex } = host.mouseDownStartPosition;
|
|
4243
|
+
const endIndex = isTable ? tdValueIndex : index2;
|
|
4244
|
+
const rangeManager = draw.getRange();
|
|
4245
|
+
if (isTable && startIsTable && (tdIndex !== startTdIndex || trIndex !== startTrIndex)) {
|
|
4246
|
+
rangeManager.setRange(endIndex, endIndex, tableId, startTdIndex, tdIndex, startTrIndex, trIndex);
|
|
4247
|
+
} else {
|
|
4248
|
+
let end = ~endIndex ? endIndex : 0;
|
|
4249
|
+
let start = startIndex;
|
|
4250
|
+
if (start > end) {
|
|
4251
|
+
[start, end] = [end, start];
|
|
4252
|
+
}
|
|
4253
|
+
if (start === end)
|
|
4257
4254
|
return;
|
|
4258
|
-
|
|
4255
|
+
rangeManager.setRange(start, end);
|
|
4259
4256
|
}
|
|
4260
|
-
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4257
|
+
draw.render({
|
|
4258
|
+
isSubmitHistory: false,
|
|
4259
|
+
isSetCursor: false,
|
|
4260
|
+
isComputeRowList: false
|
|
4261
|
+
});
|
|
4262
|
+
}
|
|
4263
|
+
function keydown(evt, host) {
|
|
4264
|
+
var _a;
|
|
4265
|
+
const draw = host.getDraw();
|
|
4266
|
+
const position = draw.getPosition();
|
|
4267
|
+
const cursorPosition = position.getCursorPosition();
|
|
4268
|
+
if (!cursorPosition)
|
|
4269
|
+
return;
|
|
4270
|
+
const isReadonly = draw.isReadonly();
|
|
4271
|
+
const historyManager = draw.getHistoryManager();
|
|
4272
|
+
const elementList = draw.getElementList();
|
|
4273
|
+
const positionList = position.getPositionList();
|
|
4274
|
+
const { index: index2 } = cursorPosition;
|
|
4275
|
+
const rangeManager = draw.getRange();
|
|
4276
|
+
const { startIndex, endIndex } = rangeManager.getRange();
|
|
4277
|
+
const isCollapsed = startIndex === endIndex;
|
|
4278
|
+
const control = draw.getControl();
|
|
4279
|
+
const isPartRangeInControlOutside = control.isPartRangeInControlOutside();
|
|
4280
|
+
const activeControl = control.getActiveControl();
|
|
4281
|
+
if (evt.key === KeyMap.Backspace) {
|
|
4282
|
+
if (isReadonly || isPartRangeInControlOutside)
|
|
4265
4283
|
return;
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
const activeControl = this.control.getActiveControl();
|
|
4273
|
-
if (evt.key === KeyMap.Backspace) {
|
|
4274
|
-
if (isReadonly || isPartRangeInControlOutside)
|
|
4284
|
+
let curIndex;
|
|
4285
|
+
if (activeControl) {
|
|
4286
|
+
curIndex = control.keydown(evt);
|
|
4287
|
+
} else {
|
|
4288
|
+
if (isCollapsed && elementList[index2].value === ZERO && index2 === 0) {
|
|
4289
|
+
evt.preventDefault();
|
|
4275
4290
|
return;
|
|
4276
|
-
let curIndex;
|
|
4277
|
-
if (activeControl) {
|
|
4278
|
-
curIndex = this.control.keydown(evt);
|
|
4279
|
-
} else {
|
|
4280
|
-
if (isCollapsed && elementList[index2].value === ZERO && index2 === 0) {
|
|
4281
|
-
evt.preventDefault();
|
|
4282
|
-
return;
|
|
4283
|
-
}
|
|
4284
|
-
if (!isCollapsed) {
|
|
4285
|
-
elementList.splice(startIndex + 1, endIndex - startIndex);
|
|
4286
|
-
} else {
|
|
4287
|
-
elementList.splice(index2, 1);
|
|
4288
|
-
}
|
|
4289
|
-
curIndex = isCollapsed ? index2 - 1 : startIndex;
|
|
4290
4291
|
}
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
} else if (evt.key === KeyMap.Delete) {
|
|
4294
|
-
if (isReadonly || isPartRangeInControlOutside)
|
|
4295
|
-
return;
|
|
4296
|
-
let curIndex;
|
|
4297
|
-
if (activeControl) {
|
|
4298
|
-
curIndex = this.control.keydown(evt);
|
|
4299
|
-
} else if (((_a = elementList[endIndex + 1]) == null ? void 0 : _a.type) === ElementType.CONTROL) {
|
|
4300
|
-
curIndex = this.control.removeControl(endIndex + 1);
|
|
4292
|
+
if (!isCollapsed) {
|
|
4293
|
+
elementList.splice(startIndex + 1, endIndex - startIndex);
|
|
4301
4294
|
} else {
|
|
4302
|
-
|
|
4303
|
-
elementList.splice(startIndex + 1, endIndex - startIndex);
|
|
4304
|
-
} else {
|
|
4305
|
-
elementList.splice(index2 + 1, 1);
|
|
4306
|
-
}
|
|
4307
|
-
curIndex = isCollapsed ? index2 : startIndex;
|
|
4295
|
+
elementList.splice(index2, 1);
|
|
4308
4296
|
}
|
|
4309
|
-
|
|
4310
|
-
|
|
4311
|
-
|
|
4312
|
-
|
|
4313
|
-
|
|
4314
|
-
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
|
|
4321
|
-
|
|
4322
|
-
|
|
4323
|
-
|
|
4324
|
-
if (activeControl) {
|
|
4325
|
-
curIndex = this.control.setValue([enterText]);
|
|
4297
|
+
curIndex = isCollapsed ? index2 - 1 : startIndex;
|
|
4298
|
+
}
|
|
4299
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4300
|
+
draw.render({ curIndex });
|
|
4301
|
+
} else if (evt.key === KeyMap.Delete) {
|
|
4302
|
+
if (isReadonly || isPartRangeInControlOutside)
|
|
4303
|
+
return;
|
|
4304
|
+
let curIndex;
|
|
4305
|
+
if (activeControl) {
|
|
4306
|
+
curIndex = control.keydown(evt);
|
|
4307
|
+
} else if (((_a = elementList[endIndex + 1]) == null ? void 0 : _a.type) === ElementType.CONTROL) {
|
|
4308
|
+
curIndex = control.removeControl(endIndex + 1);
|
|
4309
|
+
} else {
|
|
4310
|
+
if (!isCollapsed) {
|
|
4311
|
+
elementList.splice(startIndex + 1, endIndex - startIndex);
|
|
4326
4312
|
} else {
|
|
4327
|
-
|
|
4328
|
-
elementList.splice(index2 + 1, 0, enterText);
|
|
4329
|
-
} else {
|
|
4330
|
-
elementList.splice(startIndex + 1, endIndex - startIndex, enterText);
|
|
4331
|
-
}
|
|
4332
|
-
curIndex = index2 + 1;
|
|
4333
|
-
}
|
|
4334
|
-
this.range.setRange(curIndex, curIndex);
|
|
4335
|
-
this.draw.render({ curIndex });
|
|
4336
|
-
evt.preventDefault();
|
|
4337
|
-
} else if (evt.key === KeyMap.Left) {
|
|
4338
|
-
if (isReadonly)
|
|
4339
|
-
return;
|
|
4340
|
-
if (index2 > 0) {
|
|
4341
|
-
const curIndex = index2 - 1;
|
|
4342
|
-
this.range.setRange(curIndex, curIndex);
|
|
4343
|
-
this.draw.render({
|
|
4344
|
-
curIndex,
|
|
4345
|
-
isSubmitHistory: false,
|
|
4346
|
-
isComputeRowList: false
|
|
4347
|
-
});
|
|
4313
|
+
elementList.splice(index2 + 1, 1);
|
|
4348
4314
|
}
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4315
|
+
curIndex = isCollapsed ? index2 : startIndex;
|
|
4316
|
+
}
|
|
4317
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4318
|
+
draw.render({ curIndex });
|
|
4319
|
+
} else if (evt.key === KeyMap.Enter) {
|
|
4320
|
+
if (isReadonly || isPartRangeInControlOutside)
|
|
4321
|
+
return;
|
|
4322
|
+
const positionContext = position.getPositionContext();
|
|
4323
|
+
let restArg = {};
|
|
4324
|
+
if (positionContext.isTable) {
|
|
4325
|
+
const { tdId, trId, tableId } = positionContext;
|
|
4326
|
+
restArg = { tdId, trId, tableId };
|
|
4327
|
+
}
|
|
4328
|
+
const enterText = __spreadValues({
|
|
4329
|
+
value: ZERO
|
|
4330
|
+
}, restArg);
|
|
4331
|
+
let curIndex;
|
|
4332
|
+
if (activeControl) {
|
|
4333
|
+
curIndex = control.setValue([enterText]);
|
|
4334
|
+
} else {
|
|
4335
|
+
if (isCollapsed) {
|
|
4336
|
+
elementList.splice(index2 + 1, 0, enterText);
|
|
4337
|
+
} else {
|
|
4338
|
+
elementList.splice(startIndex + 1, endIndex - startIndex, enterText);
|
|
4360
4339
|
}
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4340
|
+
curIndex = index2 + 1;
|
|
4341
|
+
}
|
|
4342
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4343
|
+
draw.render({ curIndex });
|
|
4344
|
+
evt.preventDefault();
|
|
4345
|
+
} else if (evt.key === KeyMap.Left) {
|
|
4346
|
+
if (isReadonly)
|
|
4347
|
+
return;
|
|
4348
|
+
if (index2 > 0) {
|
|
4349
|
+
const curIndex = index2 - 1;
|
|
4350
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4351
|
+
draw.render({
|
|
4352
|
+
curIndex,
|
|
4353
|
+
isSubmitHistory: false,
|
|
4354
|
+
isComputeRowList: false
|
|
4355
|
+
});
|
|
4356
|
+
}
|
|
4357
|
+
} else if (evt.key === KeyMap.Right) {
|
|
4358
|
+
if (isReadonly)
|
|
4359
|
+
return;
|
|
4360
|
+
if (index2 < positionList.length - 1) {
|
|
4361
|
+
const curIndex = index2 + 1;
|
|
4362
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4363
|
+
draw.render({
|
|
4364
|
+
curIndex,
|
|
4365
|
+
isSubmitHistory: false,
|
|
4366
|
+
isComputeRowList: false
|
|
4367
|
+
});
|
|
4368
|
+
}
|
|
4369
|
+
} else if (evt.key === KeyMap.Up || evt.key === KeyMap.Down) {
|
|
4370
|
+
if (isReadonly)
|
|
4371
|
+
return;
|
|
4372
|
+
const { rowNo, index: index22, coordinate: { leftTop, rightTop } } = cursorPosition;
|
|
4373
|
+
if (evt.key === KeyMap.Up && rowNo !== 0 || evt.key === KeyMap.Down && rowNo !== draw.getRowCount()) {
|
|
4374
|
+
const probablePosition = evt.key === KeyMap.Up ? positionList.slice(0, index22).filter((p) => p.rowNo === rowNo - 1) : positionList.slice(index22, positionList.length - 1).filter((p) => p.rowNo === rowNo + 1);
|
|
4375
|
+
let maxIndex = 0;
|
|
4376
|
+
let maxDistance = 0;
|
|
4377
|
+
for (let p = 0; p < probablePosition.length; p++) {
|
|
4378
|
+
const position2 = probablePosition[p];
|
|
4379
|
+
if (position2.coordinate.leftTop[0] >= leftTop[0] && position2.coordinate.leftTop[0] <= rightTop[0]) {
|
|
4380
|
+
const curDistance = rightTop[0] - position2.coordinate.leftTop[0];
|
|
4381
|
+
if (curDistance > maxDistance) {
|
|
4382
|
+
maxIndex = position2.index;
|
|
4383
|
+
maxDistance = curDistance;
|
|
4383
4384
|
}
|
|
4384
|
-
|
|
4385
|
+
} else if (position2.coordinate.leftTop[0] <= leftTop[0] && position2.coordinate.rightTop[0] >= leftTop[0]) {
|
|
4386
|
+
const curDistance = position2.coordinate.rightTop[0] - leftTop[0];
|
|
4387
|
+
if (curDistance > maxDistance) {
|
|
4385
4388
|
maxIndex = position2.index;
|
|
4389
|
+
maxDistance = curDistance;
|
|
4386
4390
|
}
|
|
4387
4391
|
}
|
|
4388
|
-
|
|
4389
|
-
|
|
4390
|
-
|
|
4391
|
-
curIndex,
|
|
4392
|
-
isSubmitHistory: false,
|
|
4393
|
-
isComputeRowList: false
|
|
4394
|
-
});
|
|
4395
|
-
}
|
|
4396
|
-
} else if (evt.ctrlKey && evt.key === KeyMap.Z) {
|
|
4397
|
-
if (isReadonly)
|
|
4398
|
-
return;
|
|
4399
|
-
this.historyManager.undo();
|
|
4400
|
-
evt.preventDefault();
|
|
4401
|
-
} else if (evt.ctrlKey && evt.key === KeyMap.Y) {
|
|
4402
|
-
if (isReadonly)
|
|
4403
|
-
return;
|
|
4404
|
-
this.historyManager.redo();
|
|
4405
|
-
evt.preventDefault();
|
|
4406
|
-
} else if (evt.ctrlKey && evt.key === KeyMap.C) {
|
|
4407
|
-
this.copy();
|
|
4408
|
-
evt.preventDefault();
|
|
4409
|
-
} else if (evt.ctrlKey && evt.key === KeyMap.X) {
|
|
4410
|
-
this.cut();
|
|
4411
|
-
evt.preventDefault();
|
|
4412
|
-
} else if (evt.ctrlKey && evt.key === KeyMap.A) {
|
|
4413
|
-
this.selectAll();
|
|
4414
|
-
evt.preventDefault();
|
|
4415
|
-
} else if (evt.ctrlKey && evt.key === KeyMap.S) {
|
|
4416
|
-
if (isReadonly)
|
|
4417
|
-
return;
|
|
4418
|
-
if (this.listener.saved) {
|
|
4419
|
-
this.listener.saved(this.draw.getValue());
|
|
4392
|
+
if (p === probablePosition.length - 1 && maxIndex === 0) {
|
|
4393
|
+
maxIndex = position2.index;
|
|
4394
|
+
}
|
|
4420
4395
|
}
|
|
4421
|
-
|
|
4422
|
-
|
|
4423
|
-
|
|
4424
|
-
|
|
4425
|
-
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
value: ""
|
|
4429
|
-
}]);
|
|
4430
|
-
evt.preventDefault();
|
|
4396
|
+
const curIndex = maxIndex;
|
|
4397
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4398
|
+
draw.render({
|
|
4399
|
+
curIndex,
|
|
4400
|
+
isSubmitHistory: false,
|
|
4401
|
+
isComputeRowList: false
|
|
4402
|
+
});
|
|
4431
4403
|
}
|
|
4432
|
-
}
|
|
4433
|
-
|
|
4434
|
-
const cursorPosition = this.position.getCursorPosition();
|
|
4435
|
-
if (!cursorPosition)
|
|
4404
|
+
} else if (evt.ctrlKey && evt.key === KeyMap.Z) {
|
|
4405
|
+
if (isReadonly)
|
|
4436
4406
|
return;
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
|
|
4441
|
-
|
|
4442
|
-
|
|
4443
|
-
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
|
|
4455
|
-
|
|
4456
|
-
|
|
4457
|
-
|
|
4458
|
-
|
|
4459
|
-
|
|
4460
|
-
|
|
4407
|
+
historyManager.undo();
|
|
4408
|
+
evt.preventDefault();
|
|
4409
|
+
} else if (evt.ctrlKey && evt.key === KeyMap.Y) {
|
|
4410
|
+
if (isReadonly)
|
|
4411
|
+
return;
|
|
4412
|
+
historyManager.redo();
|
|
4413
|
+
evt.preventDefault();
|
|
4414
|
+
} else if (evt.ctrlKey && evt.key === KeyMap.C) {
|
|
4415
|
+
host.copy();
|
|
4416
|
+
evt.preventDefault();
|
|
4417
|
+
} else if (evt.ctrlKey && evt.key === KeyMap.X) {
|
|
4418
|
+
host.cut();
|
|
4419
|
+
evt.preventDefault();
|
|
4420
|
+
} else if (evt.ctrlKey && evt.key === KeyMap.A) {
|
|
4421
|
+
host.selectAll();
|
|
4422
|
+
evt.preventDefault();
|
|
4423
|
+
} else if (evt.ctrlKey && evt.key === KeyMap.S) {
|
|
4424
|
+
if (isReadonly)
|
|
4425
|
+
return;
|
|
4426
|
+
const listener = draw.getListener();
|
|
4427
|
+
if (listener.saved) {
|
|
4428
|
+
listener.saved(draw.getValue());
|
|
4429
|
+
}
|
|
4430
|
+
evt.preventDefault();
|
|
4431
|
+
} else if (evt.key === KeyMap.ESC) {
|
|
4432
|
+
host.clearPainterStyle();
|
|
4433
|
+
evt.preventDefault();
|
|
4434
|
+
} else if (evt.key === KeyMap.TAB) {
|
|
4435
|
+
draw.insertElementList([{
|
|
4436
|
+
type: ElementType.TAB,
|
|
4437
|
+
value: ""
|
|
4438
|
+
}]);
|
|
4439
|
+
evt.preventDefault();
|
|
4440
|
+
}
|
|
4441
|
+
}
|
|
4442
|
+
function input(data2, host) {
|
|
4443
|
+
var _a;
|
|
4444
|
+
const draw = host.getDraw();
|
|
4445
|
+
const isReadonly = draw.isReadonly();
|
|
4446
|
+
if (isReadonly)
|
|
4447
|
+
return;
|
|
4448
|
+
const position = draw.getPosition();
|
|
4449
|
+
const cursorPosition = position.getCursorPosition();
|
|
4450
|
+
if (!data2 || !cursorPosition || host.isCompositing)
|
|
4451
|
+
return;
|
|
4452
|
+
const control = draw.getControl();
|
|
4453
|
+
if (control.isPartRangeInControlOutside()) {
|
|
4454
|
+
return;
|
|
4455
|
+
}
|
|
4456
|
+
const activeControl = control.getActiveControl();
|
|
4457
|
+
const { TEXT, HYPERLINK, SUBSCRIPT, SUPERSCRIPT, DATE } = ElementType;
|
|
4458
|
+
const text = data2.replaceAll(`
|
|
4459
|
+
`, ZERO);
|
|
4460
|
+
const cursor = draw.getCursor();
|
|
4461
|
+
const agentDom = cursor.getAgentDom();
|
|
4462
|
+
agentDom.value = "";
|
|
4463
|
+
const { index: index2 } = cursorPosition;
|
|
4464
|
+
const rangeManager = draw.getRange();
|
|
4465
|
+
const { startIndex, endIndex } = rangeManager.getRange();
|
|
4466
|
+
const isCollapsed = startIndex === endIndex;
|
|
4467
|
+
const positionContext = position.getPositionContext();
|
|
4468
|
+
let restArg = {};
|
|
4469
|
+
if (positionContext.isTable) {
|
|
4470
|
+
const { tdId, trId, tableId } = positionContext;
|
|
4471
|
+
restArg = { tdId, trId, tableId };
|
|
4472
|
+
}
|
|
4473
|
+
const elementList = draw.getElementList();
|
|
4474
|
+
const element = elementList[endIndex];
|
|
4475
|
+
const inputData = splitText(text).map((value) => {
|
|
4476
|
+
const newElement = __spreadValues({
|
|
4477
|
+
value
|
|
4478
|
+
}, restArg);
|
|
4479
|
+
const nextElement = elementList[endIndex + 1];
|
|
4480
|
+
if (element.type === TEXT || !element.type && element.value !== ZERO || element.type === HYPERLINK && (nextElement == null ? void 0 : nextElement.type) === HYPERLINK || element.type === DATE && (nextElement == null ? void 0 : nextElement.type) === DATE || element.type === SUBSCRIPT && (nextElement == null ? void 0 : nextElement.type) === SUBSCRIPT || element.type === SUPERSCRIPT && (nextElement == null ? void 0 : nextElement.type) === SUPERSCRIPT) {
|
|
4481
|
+
EDITOR_ELEMENT_COPY_ATTR.forEach((attr) => {
|
|
4482
|
+
const value2 = element[attr];
|
|
4483
|
+
if (value2 !== void 0) {
|
|
4484
|
+
newElement[attr] = value2;
|
|
4461
4485
|
}
|
|
4486
|
+
});
|
|
4487
|
+
}
|
|
4488
|
+
return newElement;
|
|
4489
|
+
});
|
|
4490
|
+
let curIndex;
|
|
4491
|
+
if (activeControl && ((_a = elementList[endIndex + 1]) == null ? void 0 : _a.controlId) === element.controlId) {
|
|
4492
|
+
curIndex = control.setValue(inputData);
|
|
4493
|
+
} else {
|
|
4494
|
+
let start = 0;
|
|
4495
|
+
if (isCollapsed) {
|
|
4496
|
+
start = index2 + 1;
|
|
4497
|
+
} else {
|
|
4498
|
+
start = startIndex + 1;
|
|
4499
|
+
elementList.splice(startIndex + 1, endIndex - startIndex);
|
|
4500
|
+
}
|
|
4501
|
+
for (let i = 0; i < inputData.length; i++) {
|
|
4502
|
+
elementList.splice(start + i, 0, inputData[i]);
|
|
4503
|
+
}
|
|
4504
|
+
curIndex = (isCollapsed ? index2 : startIndex) + inputData.length;
|
|
4505
|
+
}
|
|
4506
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4507
|
+
draw.render({ curIndex });
|
|
4508
|
+
}
|
|
4509
|
+
function cut(host) {
|
|
4510
|
+
const draw = host.getDraw();
|
|
4511
|
+
const rangeManager = draw.getRange();
|
|
4512
|
+
const { startIndex, endIndex } = rangeManager.getRange();
|
|
4513
|
+
if (!~startIndex && !~startIndex)
|
|
4514
|
+
return;
|
|
4515
|
+
const isReadonly = draw.isReadonly();
|
|
4516
|
+
if (isReadonly)
|
|
4517
|
+
return;
|
|
4518
|
+
const control = draw.getControl();
|
|
4519
|
+
const isPartRangeInControlOutside = control.isPartRangeInControlOutside();
|
|
4520
|
+
if (isPartRangeInControlOutside)
|
|
4521
|
+
return;
|
|
4522
|
+
const activeControl = control.getActiveControl();
|
|
4523
|
+
const elementList = draw.getElementList();
|
|
4524
|
+
let start = startIndex;
|
|
4525
|
+
let end = endIndex;
|
|
4526
|
+
if (startIndex === endIndex) {
|
|
4527
|
+
const position = draw.getPosition();
|
|
4528
|
+
const positionList = position.getPositionList();
|
|
4529
|
+
const curRowNo = positionList[startIndex].rowNo;
|
|
4530
|
+
const cutElementIndexList = [];
|
|
4531
|
+
for (let p = 0; p < positionList.length; p++) {
|
|
4532
|
+
const position2 = positionList[p];
|
|
4533
|
+
if (position2.rowNo > curRowNo)
|
|
4534
|
+
break;
|
|
4535
|
+
if (position2.rowNo === curRowNo) {
|
|
4536
|
+
cutElementIndexList.push(p);
|
|
4462
4537
|
}
|
|
4463
4538
|
}
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
isSetCursor: false,
|
|
4468
|
-
isComputeRowList: false
|
|
4469
|
-
});
|
|
4539
|
+
const firstElementIndex = cutElementIndexList[0] - 1;
|
|
4540
|
+
start = firstElementIndex < 0 ? 0 : firstElementIndex;
|
|
4541
|
+
end = cutElementIndexList[cutElementIndexList.length - 1];
|
|
4470
4542
|
}
|
|
4471
|
-
|
|
4472
|
-
|
|
4473
|
-
|
|
4474
|
-
|
|
4475
|
-
|
|
4476
|
-
|
|
4477
|
-
|
|
4478
|
-
|
|
4543
|
+
const options = draw.getOptions();
|
|
4544
|
+
writeElementList(elementList.slice(start + 1, end + 1), options);
|
|
4545
|
+
let curIndex;
|
|
4546
|
+
if (activeControl) {
|
|
4547
|
+
curIndex = control.cut();
|
|
4548
|
+
} else {
|
|
4549
|
+
elementList.splice(start + 1, end - start);
|
|
4550
|
+
curIndex = start;
|
|
4551
|
+
}
|
|
4552
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4553
|
+
draw.render({ curIndex });
|
|
4554
|
+
}
|
|
4555
|
+
function copy(host) {
|
|
4556
|
+
const draw = host.getDraw();
|
|
4557
|
+
const rangeManager = draw.getRange();
|
|
4558
|
+
const { startIndex, endIndex } = rangeManager.getRange();
|
|
4559
|
+
if (startIndex !== endIndex) {
|
|
4560
|
+
const options = draw.getOptions();
|
|
4561
|
+
const elementList = draw.getElementList();
|
|
4562
|
+
writeElementList(elementList.slice(startIndex + 1, endIndex + 1), options);
|
|
4563
|
+
}
|
|
4564
|
+
}
|
|
4565
|
+
function drop(evt, host) {
|
|
4566
|
+
var _a;
|
|
4567
|
+
evt.preventDefault();
|
|
4568
|
+
const data2 = (_a = evt.dataTransfer) == null ? void 0 : _a.getData("text");
|
|
4569
|
+
if (data2) {
|
|
4570
|
+
host.input(data2);
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4573
|
+
const LETTER_REG = /[a-zA-Z]/;
|
|
4574
|
+
const NUMBER_LIKE_REG = /[0-9.]/;
|
|
4575
|
+
function dblclick(host) {
|
|
4576
|
+
const draw = host.getDraw();
|
|
4577
|
+
const position = draw.getPosition();
|
|
4578
|
+
const cursorPosition = position.getCursorPosition();
|
|
4579
|
+
if (!cursorPosition)
|
|
4580
|
+
return;
|
|
4581
|
+
const { value, index: index2 } = cursorPosition;
|
|
4582
|
+
let upCount = 0;
|
|
4583
|
+
let downCount = 0;
|
|
4584
|
+
const isNumber = NUMBER_LIKE_REG.test(value);
|
|
4585
|
+
if (isNumber || LETTER_REG.test(value)) {
|
|
4586
|
+
const elementList = draw.getElementList();
|
|
4479
4587
|
let upStartIndex = index2 - 1;
|
|
4480
4588
|
while (upStartIndex > 0) {
|
|
4481
|
-
const
|
|
4482
|
-
if (
|
|
4589
|
+
const value2 = elementList[upStartIndex].value;
|
|
4590
|
+
if (isNumber && NUMBER_LIKE_REG.test(value2) || !isNumber && LETTER_REG.test(value2)) {
|
|
4483
4591
|
upCount++;
|
|
4484
4592
|
upStartIndex--;
|
|
4485
4593
|
} else {
|
|
@@ -4488,113 +4596,184 @@ class CanvasEvent {
|
|
|
4488
4596
|
}
|
|
4489
4597
|
let downStartIndex = index2 + 1;
|
|
4490
4598
|
while (downStartIndex < elementList.length) {
|
|
4491
|
-
const
|
|
4492
|
-
if (
|
|
4599
|
+
const value2 = elementList[downStartIndex].value;
|
|
4600
|
+
if (isNumber && NUMBER_LIKE_REG.test(value2) || !isNumber && LETTER_REG.test(value2)) {
|
|
4493
4601
|
downCount++;
|
|
4494
4602
|
downStartIndex++;
|
|
4495
4603
|
} else {
|
|
4496
4604
|
break;
|
|
4497
4605
|
}
|
|
4498
4606
|
}
|
|
4499
|
-
this.range.setRange(index2 - upCount - 1, index2 + downCount);
|
|
4500
|
-
this.draw.render({
|
|
4501
|
-
isSubmitHistory: false,
|
|
4502
|
-
isSetCursor: false,
|
|
4503
|
-
isComputeRowList: false
|
|
4504
|
-
});
|
|
4505
4607
|
}
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
|
|
4515
|
-
|
|
4516
|
-
|
|
4517
|
-
|
|
4518
|
-
|
|
4519
|
-
|
|
4520
|
-
|
|
4521
|
-
|
|
4522
|
-
|
|
4523
|
-
|
|
4524
|
-
|
|
4525
|
-
|
|
4526
|
-
const
|
|
4527
|
-
|
|
4528
|
-
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4608
|
+
const rangeManager = draw.getRange();
|
|
4609
|
+
rangeManager.setRange(index2 - upCount - 1, index2 + downCount);
|
|
4610
|
+
draw.render({
|
|
4611
|
+
isSubmitHistory: false,
|
|
4612
|
+
isSetCursor: false,
|
|
4613
|
+
isComputeRowList: false
|
|
4614
|
+
});
|
|
4615
|
+
}
|
|
4616
|
+
function threeClick(host) {
|
|
4617
|
+
const draw = host.getDraw();
|
|
4618
|
+
const position = draw.getPosition();
|
|
4619
|
+
const cursorPosition = position.getCursorPosition();
|
|
4620
|
+
if (!cursorPosition)
|
|
4621
|
+
return;
|
|
4622
|
+
const { index: index2 } = cursorPosition;
|
|
4623
|
+
const elementList = draw.getElementList();
|
|
4624
|
+
let upCount = 0;
|
|
4625
|
+
let downCount = 0;
|
|
4626
|
+
let upStartIndex = index2 - 1;
|
|
4627
|
+
while (upStartIndex > 0) {
|
|
4628
|
+
const value = elementList[upStartIndex].value;
|
|
4629
|
+
if (value !== ZERO) {
|
|
4630
|
+
upCount++;
|
|
4631
|
+
upStartIndex--;
|
|
4632
|
+
} else {
|
|
4633
|
+
break;
|
|
4634
|
+
}
|
|
4635
|
+
}
|
|
4636
|
+
let downStartIndex = index2 + 1;
|
|
4637
|
+
while (downStartIndex < elementList.length) {
|
|
4638
|
+
const value = elementList[downStartIndex].value;
|
|
4639
|
+
if (value !== ZERO) {
|
|
4640
|
+
downCount++;
|
|
4641
|
+
downStartIndex++;
|
|
4642
|
+
} else {
|
|
4643
|
+
break;
|
|
4644
|
+
}
|
|
4645
|
+
}
|
|
4646
|
+
const rangeManager = draw.getRange();
|
|
4647
|
+
rangeManager.setRange(index2 - upCount - 1, index2 + downCount);
|
|
4648
|
+
draw.render({
|
|
4649
|
+
isSubmitHistory: false,
|
|
4650
|
+
isSetCursor: false,
|
|
4651
|
+
isComputeRowList: false
|
|
4652
|
+
});
|
|
4653
|
+
}
|
|
4654
|
+
var click = {
|
|
4655
|
+
dblclick,
|
|
4656
|
+
threeClick
|
|
4657
|
+
};
|
|
4658
|
+
function compositionstart(host) {
|
|
4659
|
+
host.isCompositing = true;
|
|
4660
|
+
}
|
|
4661
|
+
function compositionend(host) {
|
|
4662
|
+
host.isCompositing = false;
|
|
4663
|
+
}
|
|
4664
|
+
var composition = {
|
|
4665
|
+
compositionstart,
|
|
4666
|
+
compositionend
|
|
4667
|
+
};
|
|
4668
|
+
function dragover(evt, host) {
|
|
4669
|
+
const draw = host.getDraw();
|
|
4670
|
+
const isReadonly = draw.isReadonly();
|
|
4671
|
+
if (isReadonly)
|
|
4672
|
+
return;
|
|
4673
|
+
evt.preventDefault();
|
|
4674
|
+
const pageContainer = draw.getPageContainer();
|
|
4675
|
+
const editorRegion = findParent(evt.target, (node) => node === pageContainer, true);
|
|
4676
|
+
if (!editorRegion)
|
|
4677
|
+
return;
|
|
4678
|
+
const target = evt.target;
|
|
4679
|
+
const pageIndex = target.dataset.index;
|
|
4680
|
+
if (pageIndex) {
|
|
4681
|
+
draw.setPageNo(Number(pageIndex));
|
|
4682
|
+
}
|
|
4683
|
+
const position = draw.getPosition();
|
|
4684
|
+
const { isTable, tdValueIndex, index: index2 } = position.adjustPositionContext({
|
|
4685
|
+
x: evt.offsetX,
|
|
4686
|
+
y: evt.offsetY
|
|
4687
|
+
});
|
|
4688
|
+
const positionList = position.getPositionList();
|
|
4689
|
+
const curIndex = isTable ? tdValueIndex : index2;
|
|
4690
|
+
if (~index2) {
|
|
4691
|
+
const rangeManager = draw.getRange();
|
|
4692
|
+
rangeManager.setRange(curIndex, curIndex);
|
|
4693
|
+
position.setCursorPosition(positionList[curIndex]);
|
|
4694
|
+
}
|
|
4695
|
+
const cursor = draw.getCursor();
|
|
4696
|
+
cursor.drawCursor();
|
|
4697
|
+
}
|
|
4698
|
+
var drag = {
|
|
4699
|
+
dragover
|
|
4700
|
+
};
|
|
4701
|
+
class CanvasEvent {
|
|
4702
|
+
constructor(draw) {
|
|
4703
|
+
__publicField(this, "isAllowSelection");
|
|
4704
|
+
__publicField(this, "isCompositing");
|
|
4705
|
+
__publicField(this, "isAllowDrag");
|
|
4706
|
+
__publicField(this, "isAllowDrop");
|
|
4707
|
+
__publicField(this, "cacheRange");
|
|
4708
|
+
__publicField(this, "cacheElementList");
|
|
4709
|
+
__publicField(this, "cachePositionList");
|
|
4710
|
+
__publicField(this, "mouseDownStartPosition");
|
|
4711
|
+
__publicField(this, "draw");
|
|
4712
|
+
__publicField(this, "pageContainer");
|
|
4713
|
+
__publicField(this, "pageList");
|
|
4714
|
+
__publicField(this, "range");
|
|
4715
|
+
__publicField(this, "position");
|
|
4716
|
+
this.draw = draw;
|
|
4717
|
+
this.pageContainer = draw.getPageContainer();
|
|
4718
|
+
this.pageList = draw.getPageList();
|
|
4719
|
+
this.range = this.draw.getRange();
|
|
4720
|
+
this.position = this.draw.getPosition();
|
|
4721
|
+
this.isAllowSelection = false;
|
|
4722
|
+
this.isCompositing = false;
|
|
4723
|
+
this.isAllowDrag = false;
|
|
4724
|
+
this.isAllowDrop = false;
|
|
4725
|
+
this.cacheRange = null;
|
|
4726
|
+
this.cacheElementList = null;
|
|
4727
|
+
this.cachePositionList = null;
|
|
4728
|
+
this.mouseDownStartPosition = null;
|
|
4729
|
+
}
|
|
4730
|
+
getDraw() {
|
|
4731
|
+
return this.draw;
|
|
4732
|
+
}
|
|
4733
|
+
register() {
|
|
4734
|
+
this.pageContainer.addEventListener("mousedown", this.mousedown.bind(this));
|
|
4735
|
+
this.pageContainer.addEventListener("mouseup", this.mouseup.bind(this));
|
|
4736
|
+
this.pageContainer.addEventListener("mouseleave", this.mouseleave.bind(this));
|
|
4737
|
+
this.pageContainer.addEventListener("mousemove", this.mousemove.bind(this));
|
|
4738
|
+
this.pageContainer.addEventListener("dblclick", this.dblclick.bind(this));
|
|
4739
|
+
this.pageContainer.addEventListener("dragover", this.dragover.bind(this));
|
|
4740
|
+
this.pageContainer.addEventListener("drop", this.drop.bind(this));
|
|
4741
|
+
threeClick$1(this.pageContainer, this.threeClick.bind(this));
|
|
4742
|
+
}
|
|
4743
|
+
setIsAllowSelection(payload) {
|
|
4744
|
+
this.isAllowSelection = payload;
|
|
4745
|
+
if (!payload) {
|
|
4746
|
+
this.applyPainterStyle();
|
|
4534
4747
|
}
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
const value2 = element[attr];
|
|
4544
|
-
if (value2 !== void 0) {
|
|
4545
|
-
newElement[attr] = value2;
|
|
4546
|
-
}
|
|
4547
|
-
});
|
|
4548
|
-
}
|
|
4549
|
-
return newElement;
|
|
4748
|
+
}
|
|
4749
|
+
setIsAllowDrag(payload) {
|
|
4750
|
+
this.isAllowDrag = payload;
|
|
4751
|
+
this.isAllowDrop = payload;
|
|
4752
|
+
}
|
|
4753
|
+
clearPainterStyle() {
|
|
4754
|
+
this.pageList.forEach((p) => {
|
|
4755
|
+
p.style.cursor = "text";
|
|
4550
4756
|
});
|
|
4551
|
-
|
|
4552
|
-
if (activeControl && ((_a = elementList[endIndex + 1]) == null ? void 0 : _a.controlId) === element.controlId) {
|
|
4553
|
-
curIndex = this.control.setValue(inputData);
|
|
4554
|
-
} else {
|
|
4555
|
-
let start = 0;
|
|
4556
|
-
if (isCollapsed) {
|
|
4557
|
-
start = index2 + 1;
|
|
4558
|
-
} else {
|
|
4559
|
-
start = startIndex + 1;
|
|
4560
|
-
elementList.splice(startIndex + 1, endIndex - startIndex);
|
|
4561
|
-
}
|
|
4562
|
-
for (let i = 0; i < inputData.length; i++) {
|
|
4563
|
-
elementList.splice(start + i, 0, inputData[i]);
|
|
4564
|
-
}
|
|
4565
|
-
curIndex = (isCollapsed ? index2 : startIndex) + inputData.length;
|
|
4566
|
-
}
|
|
4567
|
-
this.range.setRange(curIndex, curIndex);
|
|
4568
|
-
this.draw.render({ curIndex });
|
|
4757
|
+
this.draw.setPainterStyle(null);
|
|
4569
4758
|
}
|
|
4570
|
-
|
|
4571
|
-
const
|
|
4572
|
-
if (
|
|
4759
|
+
applyPainterStyle() {
|
|
4760
|
+
const painterStyle = this.draw.getPainterStyle();
|
|
4761
|
+
if (!painterStyle)
|
|
4573
4762
|
return;
|
|
4574
|
-
const
|
|
4575
|
-
if (
|
|
4763
|
+
const selection = this.range.getSelection();
|
|
4764
|
+
if (!selection)
|
|
4576
4765
|
return;
|
|
4577
|
-
const
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
}
|
|
4589
|
-
this.range.setRange(curIndex, curIndex);
|
|
4590
|
-
this.draw.render({ curIndex });
|
|
4591
|
-
}
|
|
4592
|
-
}
|
|
4593
|
-
copy() {
|
|
4594
|
-
const { startIndex, endIndex } = this.range.getRange();
|
|
4595
|
-
const elementList = this.draw.getElementList();
|
|
4596
|
-
if (startIndex !== endIndex) {
|
|
4597
|
-
writeElementList(elementList.slice(startIndex + 1, endIndex + 1), this.options);
|
|
4766
|
+
const painterStyleKeys = Object.keys(painterStyle);
|
|
4767
|
+
selection.forEach((s) => {
|
|
4768
|
+
painterStyleKeys.forEach((pKey) => {
|
|
4769
|
+
const key = pKey;
|
|
4770
|
+
s[key] = painterStyle[key];
|
|
4771
|
+
});
|
|
4772
|
+
});
|
|
4773
|
+
this.draw.render({ isSetCursor: false });
|
|
4774
|
+
const painterOptions = this.draw.getPainterOptions();
|
|
4775
|
+
if (!painterOptions || !painterOptions.isDblclick) {
|
|
4776
|
+
this.clearPainterStyle();
|
|
4598
4777
|
}
|
|
4599
4778
|
}
|
|
4600
4779
|
selectAll() {
|
|
@@ -4606,14 +4785,49 @@ class CanvasEvent {
|
|
|
4606
4785
|
isComputeRowList: false
|
|
4607
4786
|
});
|
|
4608
4787
|
}
|
|
4788
|
+
mousemove(evt) {
|
|
4789
|
+
mousemove(evt, this);
|
|
4790
|
+
}
|
|
4791
|
+
mousedown(evt) {
|
|
4792
|
+
mousedown(evt, this);
|
|
4793
|
+
}
|
|
4794
|
+
mouseup(evt) {
|
|
4795
|
+
mouseup(evt, this);
|
|
4796
|
+
}
|
|
4797
|
+
mouseleave(evt) {
|
|
4798
|
+
mouseleave(evt, this);
|
|
4799
|
+
}
|
|
4800
|
+
keydown(evt) {
|
|
4801
|
+
keydown(evt, this);
|
|
4802
|
+
}
|
|
4803
|
+
dblclick() {
|
|
4804
|
+
click.dblclick(this);
|
|
4805
|
+
}
|
|
4806
|
+
threeClick() {
|
|
4807
|
+
click.threeClick(this);
|
|
4808
|
+
}
|
|
4809
|
+
input(data2) {
|
|
4810
|
+
input(data2, this);
|
|
4811
|
+
}
|
|
4812
|
+
cut() {
|
|
4813
|
+
cut(this);
|
|
4814
|
+
}
|
|
4815
|
+
copy() {
|
|
4816
|
+
copy(this);
|
|
4817
|
+
}
|
|
4609
4818
|
compositionstart() {
|
|
4610
|
-
this
|
|
4819
|
+
composition.compositionstart(this);
|
|
4611
4820
|
}
|
|
4612
4821
|
compositionend() {
|
|
4613
|
-
this
|
|
4822
|
+
composition.compositionend(this);
|
|
4823
|
+
}
|
|
4824
|
+
drop(evt) {
|
|
4825
|
+
drop(evt, this);
|
|
4826
|
+
}
|
|
4827
|
+
dragover(evt) {
|
|
4828
|
+
drag.dragover(evt, this);
|
|
4614
4829
|
}
|
|
4615
4830
|
}
|
|
4616
|
-
const EDITOR_COMPONENT = "editor-component";
|
|
4617
4831
|
class GlobalEvent {
|
|
4618
4832
|
constructor(draw, canvasEvent) {
|
|
4619
4833
|
__publicField(this, "draw");
|
|
@@ -4626,6 +4840,60 @@ class GlobalEvent {
|
|
|
4626
4840
|
__publicField(this, "tableTool");
|
|
4627
4841
|
__publicField(this, "hyperlinkParticle");
|
|
4628
4842
|
__publicField(this, "control");
|
|
4843
|
+
__publicField(this, "dateParticle");
|
|
4844
|
+
__publicField(this, "recoverEffect", (evt) => {
|
|
4845
|
+
if (!this.cursor)
|
|
4846
|
+
return;
|
|
4847
|
+
const cursorDom = this.cursor.getCursorDom();
|
|
4848
|
+
const agentDom = this.cursor.getAgentDom();
|
|
4849
|
+
const innerDoms = [this.canvas, cursorDom, agentDom, document.body];
|
|
4850
|
+
if (innerDoms.includes(evt.target)) {
|
|
4851
|
+
this.setRangeStyle();
|
|
4852
|
+
return;
|
|
4853
|
+
}
|
|
4854
|
+
const outerEditorDom = findParent(evt.target, (node) => !!node && node.nodeType === 1 && !!node.getAttribute(EDITOR_COMPONENT), true);
|
|
4855
|
+
if (outerEditorDom) {
|
|
4856
|
+
this.setRangeStyle();
|
|
4857
|
+
return;
|
|
4858
|
+
}
|
|
4859
|
+
this.cursor.recoveryCursor();
|
|
4860
|
+
this.range.recoveryRangeStyle();
|
|
4861
|
+
this.previewer.clearResizer();
|
|
4862
|
+
this.tableTool.dispose();
|
|
4863
|
+
this.hyperlinkParticle.clearHyperlinkPopup();
|
|
4864
|
+
this.control.destroyControl();
|
|
4865
|
+
this.dateParticle.clearDatePicker();
|
|
4866
|
+
});
|
|
4867
|
+
__publicField(this, "setCanvasEventAbility", () => {
|
|
4868
|
+
this.canvasEvent.setIsAllowDrag(false);
|
|
4869
|
+
this.canvasEvent.setIsAllowSelection(false);
|
|
4870
|
+
});
|
|
4871
|
+
__publicField(this, "setRangeStyle", () => {
|
|
4872
|
+
this.range.setRangeStyle();
|
|
4873
|
+
});
|
|
4874
|
+
__publicField(this, "setPageScale", (evt) => {
|
|
4875
|
+
if (!evt.ctrlKey)
|
|
4876
|
+
return;
|
|
4877
|
+
evt.preventDefault();
|
|
4878
|
+
const { scale } = this.options;
|
|
4879
|
+
if (evt.deltaY < 0) {
|
|
4880
|
+
const nextScale = scale * 10 + 1;
|
|
4881
|
+
if (nextScale <= 30) {
|
|
4882
|
+
this.draw.setPageScale(nextScale / 10);
|
|
4883
|
+
}
|
|
4884
|
+
} else {
|
|
4885
|
+
const nextScale = scale * 10 - 1;
|
|
4886
|
+
if (nextScale >= 5) {
|
|
4887
|
+
this.draw.setPageScale(nextScale / 10);
|
|
4888
|
+
}
|
|
4889
|
+
}
|
|
4890
|
+
});
|
|
4891
|
+
__publicField(this, "_handleVisibilityChange", () => {
|
|
4892
|
+
var _a;
|
|
4893
|
+
if (document.visibilityState) {
|
|
4894
|
+
(_a = this.cursor) == null ? void 0 : _a.drawCursor();
|
|
4895
|
+
}
|
|
4896
|
+
});
|
|
4629
4897
|
this.draw = draw;
|
|
4630
4898
|
this.canvas = draw.getPage();
|
|
4631
4899
|
this.options = draw.getOptions();
|
|
@@ -4635,68 +4903,28 @@ class GlobalEvent {
|
|
|
4635
4903
|
this.previewer = draw.getPreviewer();
|
|
4636
4904
|
this.tableTool = draw.getTableTool();
|
|
4637
4905
|
this.hyperlinkParticle = draw.getHyperlinkParticle();
|
|
4906
|
+
this.dateParticle = draw.getDateParticle();
|
|
4638
4907
|
this.control = draw.getControl();
|
|
4639
4908
|
}
|
|
4640
4909
|
register() {
|
|
4641
4910
|
this.cursor = this.draw.getCursor();
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
document.addEventListener("mouseup",
|
|
4649
|
-
|
|
4650
|
-
|
|
4651
|
-
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
const agentDom = this.cursor.getAgentDom();
|
|
4660
|
-
const innerDoms = [this.canvas, cursorDom, agentDom, document.body];
|
|
4661
|
-
if (innerDoms.includes(evt.target)) {
|
|
4662
|
-
this.setRangeStyle();
|
|
4663
|
-
return;
|
|
4664
|
-
}
|
|
4665
|
-
const outerEditorDom = findParent(evt.target, (node) => !!node && node.nodeType === 1 && !!node.getAttribute(EDITOR_COMPONENT), true);
|
|
4666
|
-
if (outerEditorDom) {
|
|
4667
|
-
this.setRangeStyle();
|
|
4668
|
-
return;
|
|
4669
|
-
}
|
|
4670
|
-
this.cursor.recoveryCursor();
|
|
4671
|
-
this.range.recoveryRangeStyle();
|
|
4672
|
-
this.range.setRange(-1, -1);
|
|
4673
|
-
this.previewer.clearResizer();
|
|
4674
|
-
this.tableTool.dispose();
|
|
4675
|
-
this.hyperlinkParticle.clearHyperlinkPopup();
|
|
4676
|
-
this.control.destroyControl();
|
|
4677
|
-
}
|
|
4678
|
-
setDragState() {
|
|
4679
|
-
this.canvasEvent.setIsAllowDrag(false);
|
|
4680
|
-
}
|
|
4681
|
-
setRangeStyle() {
|
|
4682
|
-
this.range.setRangeStyle();
|
|
4683
|
-
}
|
|
4684
|
-
setPageScale(evt) {
|
|
4685
|
-
if (!evt.ctrlKey)
|
|
4686
|
-
return;
|
|
4687
|
-
evt.preventDefault();
|
|
4688
|
-
const { scale } = this.options;
|
|
4689
|
-
if (evt.deltaY < 0) {
|
|
4690
|
-
const nextScale = scale * 10 + 1;
|
|
4691
|
-
if (nextScale <= 30) {
|
|
4692
|
-
this.draw.setPageScale(nextScale / 10);
|
|
4693
|
-
}
|
|
4694
|
-
} else {
|
|
4695
|
-
const nextScale = scale * 10 - 1;
|
|
4696
|
-
if (nextScale >= 5) {
|
|
4697
|
-
this.draw.setPageScale(nextScale / 10);
|
|
4698
|
-
}
|
|
4699
|
-
}
|
|
4911
|
+
this.addEvent();
|
|
4912
|
+
}
|
|
4913
|
+
addEvent() {
|
|
4914
|
+
window.addEventListener("blur", this.recoverEffect);
|
|
4915
|
+
document.addEventListener("keyup", this.setRangeStyle);
|
|
4916
|
+
document.addEventListener("click", this.recoverEffect);
|
|
4917
|
+
document.addEventListener("mouseup", this.setCanvasEventAbility);
|
|
4918
|
+
document.addEventListener("wheel", this.setPageScale, { passive: false });
|
|
4919
|
+
document.addEventListener("visibilitychange", this._handleVisibilityChange);
|
|
4920
|
+
}
|
|
4921
|
+
removeEvent() {
|
|
4922
|
+
window.removeEventListener("blur", this.recoverEffect);
|
|
4923
|
+
document.removeEventListener("keyup", this.setRangeStyle);
|
|
4924
|
+
document.removeEventListener("click", this.recoverEffect);
|
|
4925
|
+
document.removeEventListener("mouseup", this.setCanvasEventAbility);
|
|
4926
|
+
document.removeEventListener("wheel", this.setPageScale);
|
|
4927
|
+
document.removeEventListener("visibilitychange", this._handleVisibilityChange);
|
|
4700
4928
|
}
|
|
4701
4929
|
}
|
|
4702
4930
|
class HistoryManager {
|
|
@@ -4901,6 +5129,43 @@ class Position {
|
|
|
4901
5129
|
isControl: ((_b = elementList[curPositionIndex]) == null ? void 0 : _b.type) === ElementType.CONTROL
|
|
4902
5130
|
};
|
|
4903
5131
|
}
|
|
5132
|
+
adjustPositionContext(payload) {
|
|
5133
|
+
const isReadonly = this.draw.isReadonly();
|
|
5134
|
+
const { x, y } = payload;
|
|
5135
|
+
const positionResult = this.getPositionByXY({
|
|
5136
|
+
x,
|
|
5137
|
+
y
|
|
5138
|
+
});
|
|
5139
|
+
if (positionResult.isControl && !isReadonly) {
|
|
5140
|
+
const { index: index22, isTable: isTable2, trIndex: trIndex2, tdIndex: tdIndex2, tdValueIndex } = positionResult;
|
|
5141
|
+
const control = this.draw.getControl();
|
|
5142
|
+
const { newIndex } = control.moveCursor({
|
|
5143
|
+
index: index22,
|
|
5144
|
+
isTable: isTable2,
|
|
5145
|
+
trIndex: trIndex2,
|
|
5146
|
+
tdIndex: tdIndex2,
|
|
5147
|
+
tdValueIndex
|
|
5148
|
+
});
|
|
5149
|
+
if (isTable2) {
|
|
5150
|
+
positionResult.tdValueIndex = newIndex;
|
|
5151
|
+
} else {
|
|
5152
|
+
positionResult.index = newIndex;
|
|
5153
|
+
}
|
|
5154
|
+
}
|
|
5155
|
+
const { index: index2, isCheckbox, isControl, isTable, trIndex, tdIndex, tdId, trId, tableId } = positionResult;
|
|
5156
|
+
this.setPositionContext({
|
|
5157
|
+
isTable: isTable || false,
|
|
5158
|
+
isCheckbox: isCheckbox || false,
|
|
5159
|
+
isControl: isControl || false,
|
|
5160
|
+
index: index2,
|
|
5161
|
+
trIndex,
|
|
5162
|
+
tdIndex,
|
|
5163
|
+
tdId,
|
|
5164
|
+
trId,
|
|
5165
|
+
tableId
|
|
5166
|
+
});
|
|
5167
|
+
return positionResult;
|
|
5168
|
+
}
|
|
4904
5169
|
}
|
|
4905
5170
|
class RangeManager {
|
|
4906
5171
|
constructor(draw) {
|
|
@@ -4949,6 +5214,17 @@ class RangeManager {
|
|
|
4949
5214
|
}
|
|
4950
5215
|
return rangeRow;
|
|
4951
5216
|
}
|
|
5217
|
+
getIsPointInRange(x, y) {
|
|
5218
|
+
const { startIndex, endIndex } = this.range;
|
|
5219
|
+
const positionList = this.position.getPositionList();
|
|
5220
|
+
for (let p = startIndex + 1; p <= endIndex; p++) {
|
|
5221
|
+
const { coordinate: { leftTop, rightBottom } } = positionList[p];
|
|
5222
|
+
if (x >= leftTop[0] && x <= rightBottom[0] && y >= leftTop[1] && y <= rightBottom[1]) {
|
|
5223
|
+
return true;
|
|
5224
|
+
}
|
|
5225
|
+
}
|
|
5226
|
+
return false;
|
|
5227
|
+
}
|
|
4952
5228
|
setRange(startIndex, endIndex, tableId, startTdIndex, endTdIndex, startTrIndex, endTrIndex) {
|
|
4953
5229
|
this.range.startIndex = startIndex;
|
|
4954
5230
|
this.range.endIndex = endIndex;
|
|
@@ -5611,6 +5887,38 @@ class ScrollObserver {
|
|
|
5611
5887
|
__publicField(this, "options");
|
|
5612
5888
|
__publicField(this, "pageContainer");
|
|
5613
5889
|
__publicField(this, "pageHeight");
|
|
5890
|
+
__publicField(this, "_observer", debounce(() => {
|
|
5891
|
+
const rect = this.pageContainer.getBoundingClientRect();
|
|
5892
|
+
const top = Math.abs(rect.top);
|
|
5893
|
+
const bottom = top + window.innerHeight;
|
|
5894
|
+
const pageList = this.draw.getPageList();
|
|
5895
|
+
const visiblePageNoList = [];
|
|
5896
|
+
let intersectionPageNo = 0;
|
|
5897
|
+
let intersectionMaxHeight = 0;
|
|
5898
|
+
for (let i = 0; i < pageList.length; i++) {
|
|
5899
|
+
const curTop = i * this.pageHeight;
|
|
5900
|
+
const curBottom = (i + 1) * this.pageHeight;
|
|
5901
|
+
if (curTop > bottom)
|
|
5902
|
+
break;
|
|
5903
|
+
if (curBottom < top)
|
|
5904
|
+
continue;
|
|
5905
|
+
let intersectionHeight = 0;
|
|
5906
|
+
if (curTop < top && curBottom < bottom) {
|
|
5907
|
+
intersectionHeight = curBottom - top;
|
|
5908
|
+
} else if (curTop > top && curBottom > bottom) {
|
|
5909
|
+
intersectionHeight = bottom - curTop;
|
|
5910
|
+
} else {
|
|
5911
|
+
intersectionHeight = rect.height;
|
|
5912
|
+
}
|
|
5913
|
+
if (intersectionHeight > intersectionMaxHeight) {
|
|
5914
|
+
intersectionMaxHeight = intersectionHeight;
|
|
5915
|
+
intersectionPageNo = i;
|
|
5916
|
+
}
|
|
5917
|
+
visiblePageNoList.push(i);
|
|
5918
|
+
}
|
|
5919
|
+
this.draw.setIntersectionPageNo(intersectionPageNo);
|
|
5920
|
+
this.draw.setVisiblePageNoList(visiblePageNoList);
|
|
5921
|
+
}, 150));
|
|
5614
5922
|
this.draw = draw;
|
|
5615
5923
|
this.options = draw.getOptions();
|
|
5616
5924
|
this.pageContainer = draw.getPageContainer();
|
|
@@ -5621,39 +5929,13 @@ class ScrollObserver {
|
|
|
5621
5929
|
this._observer();
|
|
5622
5930
|
}
|
|
5623
5931
|
});
|
|
5624
|
-
|
|
5625
|
-
}
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
const visiblePageNoList = [];
|
|
5632
|
-
let intersectionPageNo = 0;
|
|
5633
|
-
let intersectionMaxHeight = 0;
|
|
5634
|
-
for (let i = 0; i < pageList.length; i++) {
|
|
5635
|
-
const curTop = i * this.pageHeight;
|
|
5636
|
-
const curBottom = (i + 1) * this.pageHeight;
|
|
5637
|
-
if (curTop > bottom)
|
|
5638
|
-
break;
|
|
5639
|
-
if (curBottom < top)
|
|
5640
|
-
continue;
|
|
5641
|
-
let intersectionHeight = 0;
|
|
5642
|
-
if (curTop < top && curBottom < bottom) {
|
|
5643
|
-
intersectionHeight = curBottom - top;
|
|
5644
|
-
} else if (curTop > top && curBottom > bottom) {
|
|
5645
|
-
intersectionHeight = bottom - curTop;
|
|
5646
|
-
} else {
|
|
5647
|
-
intersectionHeight = rect.height;
|
|
5648
|
-
}
|
|
5649
|
-
if (intersectionHeight > intersectionMaxHeight) {
|
|
5650
|
-
intersectionMaxHeight = intersectionHeight;
|
|
5651
|
-
intersectionPageNo = i;
|
|
5652
|
-
}
|
|
5653
|
-
visiblePageNoList.push(i);
|
|
5654
|
-
}
|
|
5655
|
-
this.draw.setIntersectionPageNo(intersectionPageNo);
|
|
5656
|
-
this.draw.setVisiblePageNoList(visiblePageNoList);
|
|
5932
|
+
this._addEvent();
|
|
5933
|
+
}
|
|
5934
|
+
_addEvent() {
|
|
5935
|
+
document.addEventListener("scroll", this._observer);
|
|
5936
|
+
}
|
|
5937
|
+
removeEvent() {
|
|
5938
|
+
document.removeEventListener("scroll", this._observer);
|
|
5657
5939
|
}
|
|
5658
5940
|
}
|
|
5659
5941
|
var MoveDirection;
|
|
@@ -5672,6 +5954,29 @@ class SelectionObserver {
|
|
|
5672
5954
|
__publicField(this, "isMoving");
|
|
5673
5955
|
__publicField(this, "clientWidth");
|
|
5674
5956
|
__publicField(this, "clientHeight");
|
|
5957
|
+
__publicField(this, "_mousedown", () => {
|
|
5958
|
+
this.isMousedown = true;
|
|
5959
|
+
});
|
|
5960
|
+
__publicField(this, "_mouseup", () => {
|
|
5961
|
+
this.isMousedown = false;
|
|
5962
|
+
this._stopMove();
|
|
5963
|
+
});
|
|
5964
|
+
__publicField(this, "_mousemove", (evt) => {
|
|
5965
|
+
if (!this.isMousedown)
|
|
5966
|
+
return;
|
|
5967
|
+
const { x, y } = evt;
|
|
5968
|
+
if (y < this.tippingPoints[0]) {
|
|
5969
|
+
this._startMove(MoveDirection.UP);
|
|
5970
|
+
} else if (this.clientHeight - y <= this.tippingPoints[1]) {
|
|
5971
|
+
this._startMove(MoveDirection.DOWN);
|
|
5972
|
+
} else if (x < this.tippingPoints[2]) {
|
|
5973
|
+
this._startMove(MoveDirection.LEFT);
|
|
5974
|
+
} else if (this.clientWidth - x < this.tippingPoints[3]) {
|
|
5975
|
+
this._startMove(MoveDirection.RIGHT);
|
|
5976
|
+
} else {
|
|
5977
|
+
this._stopMove();
|
|
5978
|
+
}
|
|
5979
|
+
});
|
|
5675
5980
|
this.threshold = 10;
|
|
5676
5981
|
this.tippingPoints = [70, 40, 10, 20];
|
|
5677
5982
|
this.requestAnimationFrameId = -1;
|
|
@@ -5679,32 +5984,17 @@ class SelectionObserver {
|
|
|
5679
5984
|
this.isMoving = false;
|
|
5680
5985
|
this.clientWidth = 0;
|
|
5681
5986
|
this.clientHeight = 0;
|
|
5682
|
-
|
|
5683
|
-
document.addEventListener("mousemove", this._mousemove.bind(this));
|
|
5684
|
-
document.addEventListener("mouseup", this._mouseup.bind(this));
|
|
5987
|
+
this._addEvent();
|
|
5685
5988
|
}
|
|
5686
|
-
|
|
5687
|
-
this.
|
|
5989
|
+
_addEvent() {
|
|
5990
|
+
document.addEventListener("mousedown", this._mousedown);
|
|
5991
|
+
document.addEventListener("mousemove", this._mousemove);
|
|
5992
|
+
document.addEventListener("mouseup", this._mouseup);
|
|
5688
5993
|
}
|
|
5689
|
-
|
|
5690
|
-
this.
|
|
5691
|
-
this.
|
|
5692
|
-
|
|
5693
|
-
_mousemove(evt) {
|
|
5694
|
-
if (!this.isMousedown)
|
|
5695
|
-
return;
|
|
5696
|
-
const { x, y } = evt;
|
|
5697
|
-
if (y < this.tippingPoints[0]) {
|
|
5698
|
-
this._startMove(MoveDirection.UP);
|
|
5699
|
-
} else if (this.clientHeight - y <= this.tippingPoints[1]) {
|
|
5700
|
-
this._startMove(MoveDirection.DOWN);
|
|
5701
|
-
} else if (x < this.tippingPoints[2]) {
|
|
5702
|
-
this._startMove(MoveDirection.LEFT);
|
|
5703
|
-
} else if (this.clientWidth - x < this.tippingPoints[3]) {
|
|
5704
|
-
this._startMove(MoveDirection.RIGHT);
|
|
5705
|
-
} else {
|
|
5706
|
-
this._stopMove();
|
|
5707
|
-
}
|
|
5994
|
+
removeEvent() {
|
|
5995
|
+
document.removeEventListener("mousedown", this._mousedown);
|
|
5996
|
+
document.removeEventListener("mousemove", this._mousemove);
|
|
5997
|
+
document.removeEventListener("mouseup", this._mouseup);
|
|
5708
5998
|
}
|
|
5709
5999
|
_move(direction) {
|
|
5710
6000
|
const x = window.screenX;
|
|
@@ -5951,17 +6241,17 @@ class TableTool {
|
|
|
5951
6241
|
const rowList = trList.map((tr) => tr.height);
|
|
5952
6242
|
const colList = colgroup.map((col) => col.width);
|
|
5953
6243
|
const rowContainer = document.createElement("div");
|
|
5954
|
-
rowContainer.classList.add(
|
|
6244
|
+
rowContainer.classList.add(`${EDITOR_PREFIX}-table-tool__row`);
|
|
5955
6245
|
rowContainer.style.transform = `translateX(-${this.translate * scale}px)`;
|
|
5956
6246
|
for (let r = 0; r < rowList.length; r++) {
|
|
5957
6247
|
const rowHeight = rowList[r] * scale;
|
|
5958
6248
|
const rowItem = document.createElement("div");
|
|
5959
|
-
rowItem.classList.add(
|
|
6249
|
+
rowItem.classList.add(`${EDITOR_PREFIX}-table-tool__row__item`);
|
|
5960
6250
|
if (r === rowIndex) {
|
|
5961
6251
|
rowItem.classList.add("active");
|
|
5962
6252
|
}
|
|
5963
6253
|
const rowItemAnchor = document.createElement("div");
|
|
5964
|
-
rowItemAnchor.classList.add(
|
|
6254
|
+
rowItemAnchor.classList.add(`${EDITOR_PREFIX}-table-tool__anchor`);
|
|
5965
6255
|
rowItemAnchor.onmousedown = (evt) => {
|
|
5966
6256
|
this._mousedown({
|
|
5967
6257
|
evt,
|
|
@@ -5980,17 +6270,17 @@ class TableTool {
|
|
|
5980
6270
|
this.container.append(rowContainer);
|
|
5981
6271
|
this.toolRowContainer = rowContainer;
|
|
5982
6272
|
const colContainer = document.createElement("div");
|
|
5983
|
-
colContainer.classList.add(
|
|
6273
|
+
colContainer.classList.add(`${EDITOR_PREFIX}-table-tool__col`);
|
|
5984
6274
|
colContainer.style.transform = `translateY(-${this.translate * scale}px)`;
|
|
5985
6275
|
for (let c = 0; c < colList.length; c++) {
|
|
5986
6276
|
const colHeight = colList[c] * scale;
|
|
5987
6277
|
const colItem = document.createElement("div");
|
|
5988
|
-
colItem.classList.add(
|
|
6278
|
+
colItem.classList.add(`${EDITOR_PREFIX}-table-tool__col__item`);
|
|
5989
6279
|
if (c === colIndex) {
|
|
5990
6280
|
colItem.classList.add("active");
|
|
5991
6281
|
}
|
|
5992
6282
|
const colItemAnchor = document.createElement("div");
|
|
5993
|
-
colItemAnchor.classList.add(
|
|
6283
|
+
colItemAnchor.classList.add(`${EDITOR_PREFIX}-table-tool__anchor`);
|
|
5994
6284
|
colItemAnchor.onmousedown = (evt) => {
|
|
5995
6285
|
this._mousedown({
|
|
5996
6286
|
evt,
|
|
@@ -6027,14 +6317,14 @@ class TableTool {
|
|
|
6027
6317
|
let startX = 0;
|
|
6028
6318
|
let startY = 0;
|
|
6029
6319
|
const anchorLine = document.createElement("div");
|
|
6030
|
-
anchorLine.classList.add(
|
|
6320
|
+
anchorLine.classList.add(`${EDITOR_PREFIX}-table-anchor__line`);
|
|
6031
6321
|
if (order === TableOrder.ROW) {
|
|
6032
|
-
anchorLine.classList.add(
|
|
6322
|
+
anchorLine.classList.add(`${EDITOR_PREFIX}-table-anchor__line__row`);
|
|
6033
6323
|
anchorLine.style.width = `${width}px`;
|
|
6034
6324
|
startX = 0;
|
|
6035
6325
|
startY = prePageHeight + this.mousedownY - canvasRect.top;
|
|
6036
6326
|
} else {
|
|
6037
|
-
anchorLine.classList.add(
|
|
6327
|
+
anchorLine.classList.add(`${EDITOR_PREFIX}-table-anchor__line__col`);
|
|
6038
6328
|
anchorLine.style.height = `${height}px`;
|
|
6039
6329
|
startX = this.mousedownX - canvasRect.left;
|
|
6040
6330
|
startY = prePageHeight;
|
|
@@ -6138,7 +6428,7 @@ class HyperlinkParticle {
|
|
|
6138
6428
|
}
|
|
6139
6429
|
_createHyperlinkPopupDom() {
|
|
6140
6430
|
const hyperlinkPopupContainer = document.createElement("div");
|
|
6141
|
-
hyperlinkPopupContainer.classList.add(
|
|
6431
|
+
hyperlinkPopupContainer.classList.add(`${EDITOR_PREFIX}-hyperlink-popup`);
|
|
6142
6432
|
const hyperlinkDom = document.createElement("a");
|
|
6143
6433
|
hyperlinkDom.target = "_blank";
|
|
6144
6434
|
hyperlinkPopupContainer.append(hyperlinkDom);
|
|
@@ -6448,7 +6738,7 @@ class SelectControl {
|
|
|
6448
6738
|
if (!position)
|
|
6449
6739
|
return;
|
|
6450
6740
|
const selectPopupContainer = document.createElement("div");
|
|
6451
|
-
selectPopupContainer.classList.add(
|
|
6741
|
+
selectPopupContainer.classList.add(`${EDITOR_PREFIX}-select-control-popup`);
|
|
6452
6742
|
selectPopupContainer.setAttribute(EDITOR_COMPONENT, EditorComponent.POPUP);
|
|
6453
6743
|
const ul = document.createElement("ul");
|
|
6454
6744
|
for (let v = 0; v < valueSets.length; v++) {
|
|
@@ -6985,7 +7275,7 @@ class Previewer {
|
|
|
6985
7275
|
}
|
|
6986
7276
|
_createResizerDom() {
|
|
6987
7277
|
const resizerSelection = document.createElement("div");
|
|
6988
|
-
resizerSelection.classList.add(
|
|
7278
|
+
resizerSelection.classList.add(`${EDITOR_PREFIX}-resizer-selection`);
|
|
6989
7279
|
resizerSelection.style.display = "none";
|
|
6990
7280
|
resizerSelection.style.borderColor = this.options.resizerColor;
|
|
6991
7281
|
const resizerHandleList = [];
|
|
@@ -7000,7 +7290,7 @@ class Previewer {
|
|
|
7000
7290
|
}
|
|
7001
7291
|
this.container.append(resizerSelection);
|
|
7002
7292
|
const resizerImageContainer = document.createElement("div");
|
|
7003
|
-
resizerImageContainer.classList.add(
|
|
7293
|
+
resizerImageContainer.classList.add(`${EDITOR_PREFIX}-resizer-image`);
|
|
7004
7294
|
resizerImageContainer.style.display = "none";
|
|
7005
7295
|
const resizerImage = document.createElement("img");
|
|
7006
7296
|
resizerImageContainer.append(resizerImage);
|
|
@@ -7095,7 +7385,7 @@ class Previewer {
|
|
|
7095
7385
|
}
|
|
7096
7386
|
_drawPreviewer() {
|
|
7097
7387
|
const previewerContainer = document.createElement("div");
|
|
7098
|
-
previewerContainer.classList.add(
|
|
7388
|
+
previewerContainer.classList.add(`${EDITOR_PREFIX}-image-previewer`);
|
|
7099
7389
|
const closeBtn = document.createElement("i");
|
|
7100
7390
|
closeBtn.classList.add("image-close");
|
|
7101
7391
|
closeBtn.onclick = () => {
|
|
@@ -7103,7 +7393,7 @@ class Previewer {
|
|
|
7103
7393
|
};
|
|
7104
7394
|
previewerContainer.append(closeBtn);
|
|
7105
7395
|
const imgContainer = document.createElement("div");
|
|
7106
|
-
imgContainer.classList.add(
|
|
7396
|
+
imgContainer.classList.add(`${EDITOR_PREFIX}-image-container`);
|
|
7107
7397
|
const img = document.createElement("img");
|
|
7108
7398
|
img.src = this.curElementSrc;
|
|
7109
7399
|
img.draggable = false;
|
|
@@ -7115,7 +7405,7 @@ class Previewer {
|
|
|
7115
7405
|
let scaleSize = 1;
|
|
7116
7406
|
let rotateSize = 0;
|
|
7117
7407
|
const menuContainer = document.createElement("div");
|
|
7118
|
-
menuContainer.classList.add(
|
|
7408
|
+
menuContainer.classList.add(`${EDITOR_PREFIX}-image-menu`);
|
|
7119
7409
|
const zoomIn = document.createElement("i");
|
|
7120
7410
|
zoomIn.classList.add("zoom-in");
|
|
7121
7411
|
zoomIn.onclick = () => {
|
|
@@ -7258,24 +7548,24 @@ class DatePicker {
|
|
|
7258
7548
|
}
|
|
7259
7549
|
_createDom() {
|
|
7260
7550
|
const datePickerContainer = document.createElement("div");
|
|
7261
|
-
datePickerContainer.classList.add(
|
|
7551
|
+
datePickerContainer.classList.add(`${EDITOR_PREFIX}-date-container`);
|
|
7262
7552
|
const dateWrap = document.createElement("div");
|
|
7263
|
-
dateWrap.classList.add(
|
|
7553
|
+
dateWrap.classList.add(`${EDITOR_PREFIX}-date-wrap`);
|
|
7264
7554
|
const datePickerTitle = document.createElement("div");
|
|
7265
|
-
datePickerTitle.classList.add(
|
|
7555
|
+
datePickerTitle.classList.add(`${EDITOR_PREFIX}-date-title`);
|
|
7266
7556
|
const preYearTitle = document.createElement("span");
|
|
7267
|
-
preYearTitle.classList.add(
|
|
7557
|
+
preYearTitle.classList.add(`${EDITOR_PREFIX}-date-title__pre-year`);
|
|
7268
7558
|
preYearTitle.innerText = `<<`;
|
|
7269
7559
|
const preMonthTitle = document.createElement("span");
|
|
7270
|
-
preMonthTitle.classList.add(
|
|
7560
|
+
preMonthTitle.classList.add(`${EDITOR_PREFIX}-date-title__pre-month`);
|
|
7271
7561
|
preMonthTitle.innerText = `<`;
|
|
7272
7562
|
const nowTitle = document.createElement("span");
|
|
7273
|
-
nowTitle.classList.add(
|
|
7563
|
+
nowTitle.classList.add(`${EDITOR_PREFIX}-date-title__now`);
|
|
7274
7564
|
const nextMonthTitle = document.createElement("span");
|
|
7275
|
-
nextMonthTitle.classList.add(
|
|
7565
|
+
nextMonthTitle.classList.add(`${EDITOR_PREFIX}-date-title__next-month`);
|
|
7276
7566
|
nextMonthTitle.innerText = `>`;
|
|
7277
7567
|
const nextYearTitle = document.createElement("span");
|
|
7278
|
-
nextYearTitle.classList.add(
|
|
7568
|
+
nextYearTitle.classList.add(`${EDITOR_PREFIX}-date-title__next-year`);
|
|
7279
7569
|
nextYearTitle.innerText = `>>`;
|
|
7280
7570
|
datePickerTitle.append(preYearTitle);
|
|
7281
7571
|
datePickerTitle.append(preMonthTitle);
|
|
@@ -7283,7 +7573,7 @@ class DatePicker {
|
|
|
7283
7573
|
datePickerTitle.append(nextMonthTitle);
|
|
7284
7574
|
datePickerTitle.append(nextYearTitle);
|
|
7285
7575
|
const datePickerWeek = document.createElement("div");
|
|
7286
|
-
datePickerWeek.classList.add(
|
|
7576
|
+
datePickerWeek.classList.add(`${EDITOR_PREFIX}-date-week`);
|
|
7287
7577
|
const weekList = ["\u65E5", "\u4E00", "\u4E8C", "\u4E09", "\u56DB", "\u4E94", "\u516D"];
|
|
7288
7578
|
weekList.forEach((week) => {
|
|
7289
7579
|
const weekDom = document.createElement("span");
|
|
@@ -7291,12 +7581,12 @@ class DatePicker {
|
|
|
7291
7581
|
datePickerWeek.append(weekDom);
|
|
7292
7582
|
});
|
|
7293
7583
|
const datePickerDay = document.createElement("div");
|
|
7294
|
-
datePickerDay.classList.add(
|
|
7584
|
+
datePickerDay.classList.add(`${EDITOR_PREFIX}-date-day`);
|
|
7295
7585
|
dateWrap.append(datePickerTitle);
|
|
7296
7586
|
dateWrap.append(datePickerWeek);
|
|
7297
7587
|
dateWrap.append(datePickerDay);
|
|
7298
7588
|
const timeWrap = document.createElement("ul");
|
|
7299
|
-
timeWrap.classList.add(
|
|
7589
|
+
timeWrap.classList.add(`${EDITOR_PREFIX}-time-wrap`);
|
|
7300
7590
|
let hourTime;
|
|
7301
7591
|
let minuteTime;
|
|
7302
7592
|
let secondTime;
|
|
@@ -7327,15 +7617,15 @@ class DatePicker {
|
|
|
7327
7617
|
timeWrap.append(li);
|
|
7328
7618
|
});
|
|
7329
7619
|
const datePickerMenu = document.createElement("div");
|
|
7330
|
-
datePickerMenu.classList.add(
|
|
7620
|
+
datePickerMenu.classList.add(`${EDITOR_PREFIX}-date-menu`);
|
|
7331
7621
|
const timeMenu = document.createElement("button");
|
|
7332
|
-
timeMenu.classList.add(
|
|
7622
|
+
timeMenu.classList.add(`${EDITOR_PREFIX}-date-menu__time`);
|
|
7333
7623
|
timeMenu.innerText = "\u65F6\u95F4\u9009\u62E9";
|
|
7334
7624
|
const nowMenu = document.createElement("button");
|
|
7335
|
-
nowMenu.classList.add(
|
|
7625
|
+
nowMenu.classList.add(`${EDITOR_PREFIX}-date-menu__now`);
|
|
7336
7626
|
nowMenu.innerText = "\u6B64\u523B";
|
|
7337
7627
|
const submitMenu = document.createElement("button");
|
|
7338
|
-
submitMenu.classList.add(
|
|
7628
|
+
submitMenu.classList.add(`${EDITOR_PREFIX}-date-menu__submit`);
|
|
7339
7629
|
submitMenu.innerText = "\u786E\u5B9A";
|
|
7340
7630
|
datePickerMenu.append(timeMenu);
|
|
7341
7631
|
datePickerMenu.append(nowMenu);
|
|
@@ -7797,7 +8087,7 @@ class BaseBlock {
|
|
|
7797
8087
|
}
|
|
7798
8088
|
_createBlockItem() {
|
|
7799
8089
|
const blockItem = document.createElement("div");
|
|
7800
|
-
blockItem.classList.add(
|
|
8090
|
+
blockItem.classList.add(`${EDITOR_PREFIX}-block-item`);
|
|
7801
8091
|
return blockItem;
|
|
7802
8092
|
}
|
|
7803
8093
|
render() {
|
|
@@ -7838,7 +8128,7 @@ class BlockParticle {
|
|
|
7838
8128
|
}
|
|
7839
8129
|
_createBlockContainer() {
|
|
7840
8130
|
const blockContainer = document.createElement("div");
|
|
7841
|
-
blockContainer.classList.add(
|
|
8131
|
+
blockContainer.classList.add(`${EDITOR_PREFIX}-block-container`);
|
|
7842
8132
|
return blockContainer;
|
|
7843
8133
|
}
|
|
7844
8134
|
getDraw() {
|
|
@@ -7880,7 +8170,7 @@ class BlockParticle {
|
|
|
7880
8170
|
}
|
|
7881
8171
|
}
|
|
7882
8172
|
class Draw {
|
|
7883
|
-
constructor(
|
|
8173
|
+
constructor(rootContainer, options, elementList, listener) {
|
|
7884
8174
|
__publicField(this, "container");
|
|
7885
8175
|
__publicField(this, "pageContainer");
|
|
7886
8176
|
__publicField(this, "pageList");
|
|
@@ -7892,6 +8182,7 @@ class Draw {
|
|
|
7892
8182
|
__publicField(this, "elementList");
|
|
7893
8183
|
__publicField(this, "listener");
|
|
7894
8184
|
__publicField(this, "canvasEvent");
|
|
8185
|
+
__publicField(this, "globalEvent");
|
|
7895
8186
|
__publicField(this, "cursor");
|
|
7896
8187
|
__publicField(this, "range");
|
|
7897
8188
|
__publicField(this, "margin");
|
|
@@ -7920,12 +8211,14 @@ class Draw {
|
|
|
7920
8211
|
__publicField(this, "blockParticle");
|
|
7921
8212
|
__publicField(this, "control");
|
|
7922
8213
|
__publicField(this, "workerManager");
|
|
8214
|
+
__publicField(this, "scrollObserver");
|
|
8215
|
+
__publicField(this, "selectionObserver");
|
|
7923
8216
|
__publicField(this, "rowList");
|
|
7924
8217
|
__publicField(this, "painterStyle");
|
|
7925
8218
|
__publicField(this, "painterOptions");
|
|
7926
8219
|
__publicField(this, "visiblePageNoList");
|
|
7927
8220
|
__publicField(this, "intersectionPageNo");
|
|
7928
|
-
this.container =
|
|
8221
|
+
this.container = this._wrapContainer(rootContainer);
|
|
7929
8222
|
this.pageList = [];
|
|
7930
8223
|
this.ctxList = [];
|
|
7931
8224
|
this.pageNo = 0;
|
|
@@ -7963,13 +8256,13 @@ class Draw {
|
|
|
7963
8256
|
this.checkboxParticle = new CheckboxParticle(this);
|
|
7964
8257
|
this.blockParticle = new BlockParticle(this);
|
|
7965
8258
|
this.control = new Control(this);
|
|
7966
|
-
new ScrollObserver(this);
|
|
7967
|
-
new SelectionObserver();
|
|
8259
|
+
this.scrollObserver = new ScrollObserver(this);
|
|
8260
|
+
this.selectionObserver = new SelectionObserver();
|
|
7968
8261
|
this.canvasEvent = new CanvasEvent(this);
|
|
7969
8262
|
this.cursor = new Cursor(this, this.canvasEvent);
|
|
7970
8263
|
this.canvasEvent.register();
|
|
7971
|
-
|
|
7972
|
-
globalEvent.register();
|
|
8264
|
+
this.globalEvent = new GlobalEvent(this, this.canvasEvent);
|
|
8265
|
+
this.globalEvent.register();
|
|
7973
8266
|
this.workerManager = new WorkerManager(this);
|
|
7974
8267
|
this.rowList = [];
|
|
7975
8268
|
this.painterStyle = null;
|
|
@@ -8271,6 +8564,11 @@ class Draw {
|
|
|
8271
8564
|
data: data2
|
|
8272
8565
|
};
|
|
8273
8566
|
}
|
|
8567
|
+
_wrapContainer(rootContainer) {
|
|
8568
|
+
const container = document.createElement("div");
|
|
8569
|
+
rootContainer.append(container);
|
|
8570
|
+
return container;
|
|
8571
|
+
}
|
|
8274
8572
|
_formatContainer() {
|
|
8275
8573
|
this.container.style.position = "relative";
|
|
8276
8574
|
this.container.style.width = `${this.getWidth()}px`;
|
|
@@ -8278,7 +8576,7 @@ class Draw {
|
|
|
8278
8576
|
}
|
|
8279
8577
|
_createPageContainer() {
|
|
8280
8578
|
const pageContainer = document.createElement("div");
|
|
8281
|
-
pageContainer.classList.add(
|
|
8579
|
+
pageContainer.classList.add(`${EDITOR_PREFIX}-page-container`);
|
|
8282
8580
|
this.container.append(pageContainer);
|
|
8283
8581
|
return pageContainer;
|
|
8284
8582
|
}
|
|
@@ -8840,6 +9138,12 @@ class Draw {
|
|
|
8840
9138
|
}
|
|
8841
9139
|
});
|
|
8842
9140
|
}
|
|
9141
|
+
destroy() {
|
|
9142
|
+
this.container.remove();
|
|
9143
|
+
this.globalEvent.removeEvent();
|
|
9144
|
+
this.scrollObserver.removeEvent();
|
|
9145
|
+
this.selectionObserver.removeEvent();
|
|
9146
|
+
}
|
|
8843
9147
|
}
|
|
8844
9148
|
const _Command = class {
|
|
8845
9149
|
constructor(adapt) {
|
|
@@ -10672,7 +10976,7 @@ const globalMenus = [
|
|
|
10672
10976
|
name: "\u526A\u5207",
|
|
10673
10977
|
shortCut: "Ctrl + X",
|
|
10674
10978
|
when: (payload) => {
|
|
10675
|
-
return !payload.isReadonly
|
|
10979
|
+
return !payload.isReadonly;
|
|
10676
10980
|
},
|
|
10677
10981
|
callback: (command) => {
|
|
10678
10982
|
command.executeCut();
|
|
@@ -10925,6 +11229,41 @@ class ContextMenu {
|
|
|
10925
11229
|
__publicField(this, "contextMenuContainerList");
|
|
10926
11230
|
__publicField(this, "contextMenuRelationShip");
|
|
10927
11231
|
__publicField(this, "context");
|
|
11232
|
+
__publicField(this, "_proxyContextMenuEvent", (evt) => {
|
|
11233
|
+
var _a;
|
|
11234
|
+
this.context = this._getContext();
|
|
11235
|
+
const renderList = [];
|
|
11236
|
+
let isRegisterContextMenu = false;
|
|
11237
|
+
for (let c = 0; c < this.contextMenuList.length; c++) {
|
|
11238
|
+
const menu = this.contextMenuList[c];
|
|
11239
|
+
if (menu.isDivider) {
|
|
11240
|
+
renderList.push(menu);
|
|
11241
|
+
} else {
|
|
11242
|
+
const isMatch = (_a = menu.when) == null ? void 0 : _a.call(menu, this.context);
|
|
11243
|
+
if (isMatch) {
|
|
11244
|
+
renderList.push(menu);
|
|
11245
|
+
isRegisterContextMenu = true;
|
|
11246
|
+
}
|
|
11247
|
+
}
|
|
11248
|
+
}
|
|
11249
|
+
if (isRegisterContextMenu) {
|
|
11250
|
+
this.dispose();
|
|
11251
|
+
this._render({
|
|
11252
|
+
contextMenuList: renderList,
|
|
11253
|
+
left: evt.x,
|
|
11254
|
+
top: evt.y
|
|
11255
|
+
});
|
|
11256
|
+
}
|
|
11257
|
+
evt.preventDefault();
|
|
11258
|
+
});
|
|
11259
|
+
__publicField(this, "_handleEffect", (evt) => {
|
|
11260
|
+
if (this.contextMenuContainerList.length) {
|
|
11261
|
+
const contextMenuDom = findParent(evt.target, (node) => !!node && node.nodeType === 1 && node.getAttribute(EDITOR_COMPONENT) === EditorComponent.CONTEXTMENU, true);
|
|
11262
|
+
if (!contextMenuDom) {
|
|
11263
|
+
this.dispose();
|
|
11264
|
+
}
|
|
11265
|
+
}
|
|
11266
|
+
});
|
|
10928
11267
|
this.draw = draw;
|
|
10929
11268
|
this.command = command;
|
|
10930
11269
|
this.range = draw.getRange();
|
|
@@ -10940,43 +11279,15 @@ class ContextMenu {
|
|
|
10940
11279
|
];
|
|
10941
11280
|
this.contextMenuContainerList = [];
|
|
10942
11281
|
this.contextMenuRelationShip = new Map();
|
|
10943
|
-
|
|
10944
|
-
document.addEventListener("mousedown", this._handleEffect.bind(this));
|
|
11282
|
+
this._addEvent();
|
|
10945
11283
|
}
|
|
10946
|
-
|
|
10947
|
-
|
|
10948
|
-
|
|
10949
|
-
const renderList = [];
|
|
10950
|
-
let isRegisterContextMenu = false;
|
|
10951
|
-
for (let c = 0; c < this.contextMenuList.length; c++) {
|
|
10952
|
-
const menu = this.contextMenuList[c];
|
|
10953
|
-
if (menu.isDivider) {
|
|
10954
|
-
renderList.push(menu);
|
|
10955
|
-
} else {
|
|
10956
|
-
const isMatch = (_a = menu.when) == null ? void 0 : _a.call(menu, this.context);
|
|
10957
|
-
if (isMatch) {
|
|
10958
|
-
renderList.push(menu);
|
|
10959
|
-
isRegisterContextMenu = true;
|
|
10960
|
-
}
|
|
10961
|
-
}
|
|
10962
|
-
}
|
|
10963
|
-
if (isRegisterContextMenu) {
|
|
10964
|
-
this.dispose();
|
|
10965
|
-
this._render({
|
|
10966
|
-
contextMenuList: renderList,
|
|
10967
|
-
left: evt.x,
|
|
10968
|
-
top: evt.y
|
|
10969
|
-
});
|
|
10970
|
-
}
|
|
10971
|
-
evt.preventDefault();
|
|
11284
|
+
_addEvent() {
|
|
11285
|
+
document.addEventListener("contextmenu", this._proxyContextMenuEvent);
|
|
11286
|
+
document.addEventListener("mousedown", this._handleEffect);
|
|
10972
11287
|
}
|
|
10973
|
-
|
|
10974
|
-
|
|
10975
|
-
|
|
10976
|
-
if (!contextMenuDom) {
|
|
10977
|
-
this.dispose();
|
|
10978
|
-
}
|
|
10979
|
-
}
|
|
11288
|
+
removeEvent() {
|
|
11289
|
+
document.removeEventListener("contextmenu", this._proxyContextMenuEvent);
|
|
11290
|
+
document.removeEventListener("mousedown", this._handleEffect);
|
|
10980
11291
|
}
|
|
10981
11292
|
_getContext() {
|
|
10982
11293
|
const isReadonly = this.draw.isReadonly();
|
|
@@ -11001,7 +11312,7 @@ class ContextMenu {
|
|
|
11001
11312
|
}
|
|
11002
11313
|
_createContextMenuContainer() {
|
|
11003
11314
|
const contextMenuContainer = document.createElement("div");
|
|
11004
|
-
contextMenuContainer.classList.add(
|
|
11315
|
+
contextMenuContainer.classList.add(`${EDITOR_PREFIX}-contextmenu-container`);
|
|
11005
11316
|
contextMenuContainer.setAttribute(EDITOR_COMPONENT, EditorComponent.CONTEXTMENU);
|
|
11006
11317
|
this.container.append(contextMenuContainer);
|
|
11007
11318
|
return contextMenuContainer;
|
|
@@ -11010,7 +11321,7 @@ class ContextMenu {
|
|
|
11010
11321
|
const { contextMenuList, left, top, parentMenuContainer } = payload;
|
|
11011
11322
|
const contextMenuContainer = this._createContextMenuContainer();
|
|
11012
11323
|
const contextMenuContent = document.createElement("div");
|
|
11013
|
-
contextMenuContent.classList.add(
|
|
11324
|
+
contextMenuContent.classList.add(`${EDITOR_PREFIX}-contextmenu-content`);
|
|
11014
11325
|
let childMenuContainer = null;
|
|
11015
11326
|
if (parentMenuContainer) {
|
|
11016
11327
|
this.contextMenuRelationShip.set(parentMenuContainer, contextMenuContainer);
|
|
@@ -11020,14 +11331,14 @@ class ContextMenu {
|
|
|
11020
11331
|
if (menu.isDivider) {
|
|
11021
11332
|
if (c !== 0 && c !== contextMenuList.length - 1) {
|
|
11022
11333
|
const divider = document.createElement("div");
|
|
11023
|
-
divider.classList.add(
|
|
11334
|
+
divider.classList.add(`${EDITOR_PREFIX}-contextmenu-divider`);
|
|
11024
11335
|
contextMenuContent.append(divider);
|
|
11025
11336
|
}
|
|
11026
11337
|
} else {
|
|
11027
11338
|
const menuItem = document.createElement("div");
|
|
11028
|
-
menuItem.classList.add(
|
|
11339
|
+
menuItem.classList.add(`${EDITOR_PREFIX}-contextmenu-item`);
|
|
11029
11340
|
if (menu.childMenus) {
|
|
11030
|
-
menuItem.classList.add(
|
|
11341
|
+
menuItem.classList.add(`${EDITOR_PREFIX}-contextmenu-sub-item`);
|
|
11031
11342
|
menuItem.onmouseenter = () => {
|
|
11032
11343
|
this._setHoverStatus(menuItem, true);
|
|
11033
11344
|
this._removeSubMenu(contextMenuContainer);
|
|
@@ -11064,7 +11375,7 @@ class ContextMenu {
|
|
|
11064
11375
|
const icon = document.createElement("i");
|
|
11065
11376
|
menuItem.append(icon);
|
|
11066
11377
|
if (menu.icon) {
|
|
11067
|
-
icon.classList.add(
|
|
11378
|
+
icon.classList.add(`${EDITOR_PREFIX}-contextmenu-${menu.icon}`);
|
|
11068
11379
|
}
|
|
11069
11380
|
const span = document.createElement("span");
|
|
11070
11381
|
const name = this._formatName(menu.name);
|
|
@@ -11072,7 +11383,7 @@ class ContextMenu {
|
|
|
11072
11383
|
menuItem.append(span);
|
|
11073
11384
|
if (menu.shortCut) {
|
|
11074
11385
|
const span2 = document.createElement("span");
|
|
11075
|
-
span2.classList.add(
|
|
11386
|
+
span2.classList.add(`${EDITOR_PREFIX}-shortcut`);
|
|
11076
11387
|
span2.append(document.createTextNode(menu.shortCut));
|
|
11077
11388
|
menuItem.append(span2);
|
|
11078
11389
|
}
|
|
@@ -11100,7 +11411,7 @@ class ContextMenu {
|
|
|
11100
11411
|
_setHoverStatus(payload, status) {
|
|
11101
11412
|
var _a;
|
|
11102
11413
|
if (status) {
|
|
11103
|
-
(_a = payload.parentNode) == null ? void 0 : _a.querySelectorAll(
|
|
11414
|
+
(_a = payload.parentNode) == null ? void 0 : _a.querySelectorAll(`${EDITOR_PREFIX}-contextmenu-item`).forEach((child) => child.classList.remove("hover"));
|
|
11104
11415
|
payload.classList.add("hover");
|
|
11105
11416
|
} else {
|
|
11106
11417
|
payload.classList.remove("hover");
|
|
@@ -11228,16 +11539,27 @@ class Shortcut {
|
|
|
11228
11539
|
__publicField(this, "command");
|
|
11229
11540
|
__publicField(this, "globalShortcutList");
|
|
11230
11541
|
__publicField(this, "agentShortcutList");
|
|
11542
|
+
__publicField(this, "_globalKeydown", (evt) => {
|
|
11543
|
+
if (!this.globalShortcutList.length)
|
|
11544
|
+
return;
|
|
11545
|
+
this._execute(evt, this.globalShortcutList);
|
|
11546
|
+
});
|
|
11231
11547
|
this.command = command;
|
|
11232
11548
|
this.globalShortcutList = [];
|
|
11233
11549
|
this.agentShortcutList = [];
|
|
11234
11550
|
this._addShortcutList([
|
|
11235
11551
|
...richtextKeys
|
|
11236
11552
|
]);
|
|
11237
|
-
|
|
11553
|
+
this._addEvent();
|
|
11238
11554
|
const agentDom = draw.getCursor().getAgentDom();
|
|
11239
11555
|
agentDom.addEventListener("keydown", this._agentKeydown.bind(this));
|
|
11240
11556
|
}
|
|
11557
|
+
_addEvent() {
|
|
11558
|
+
document.addEventListener("keydown", this._globalKeydown);
|
|
11559
|
+
}
|
|
11560
|
+
removeEvent() {
|
|
11561
|
+
document.removeEventListener("keydown", this._globalKeydown);
|
|
11562
|
+
}
|
|
11241
11563
|
_addShortcutList(payload) {
|
|
11242
11564
|
for (let s = 0; s < payload.length; s++) {
|
|
11243
11565
|
const shortCut = payload[s];
|
|
@@ -11251,11 +11573,6 @@ class Shortcut {
|
|
|
11251
11573
|
registerShortcutList(payload) {
|
|
11252
11574
|
this._addShortcutList(payload);
|
|
11253
11575
|
}
|
|
11254
|
-
_globalKeydown(evt) {
|
|
11255
|
-
if (!this.globalShortcutList.length)
|
|
11256
|
-
return;
|
|
11257
|
-
this._execute(evt, this.globalShortcutList);
|
|
11258
|
-
}
|
|
11259
11576
|
_agentKeydown(evt) {
|
|
11260
11577
|
if (!this.agentShortcutList.length)
|
|
11261
11578
|
return;
|
|
@@ -11277,6 +11594,7 @@ class Editor {
|
|
|
11277
11594
|
__publicField(this, "command");
|
|
11278
11595
|
__publicField(this, "listener");
|
|
11279
11596
|
__publicField(this, "register");
|
|
11597
|
+
__publicField(this, "destroy");
|
|
11280
11598
|
const headerOptions = __spreadValues(__spreadValues({}, defaultHeaderOption), options.header);
|
|
11281
11599
|
const waterMarkOptions = __spreadValues(__spreadValues({}, defaultWatermarkOption), options.watermark);
|
|
11282
11600
|
const controlOptions = __spreadValues(__spreadValues({}, defaultControlOption), options.control);
|
|
@@ -11333,6 +11651,11 @@ class Editor {
|
|
|
11333
11651
|
contextMenu,
|
|
11334
11652
|
shortcut
|
|
11335
11653
|
});
|
|
11654
|
+
this.destroy = () => {
|
|
11655
|
+
draw.destroy();
|
|
11656
|
+
shortcut.removeEvent();
|
|
11657
|
+
contextMenu.removeEvent();
|
|
11658
|
+
};
|
|
11336
11659
|
}
|
|
11337
11660
|
}
|
|
11338
11661
|
export { BlockType, Command, ControlType, EDITOR_COMPONENT, Editor, EditorComponent, EditorMode, ElementType, ImageDisplay, KeyMap, PageMode, RowFlex, Editor as default };
|