@hailin-zheng/editor-core 1.1.3 → 1.1.5
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/index-cjs.d.ts +1 -0
- package/index-cjs.js +264 -1060
- package/index-cjs.js.map +1 -1
- package/index.d.ts +1 -0
- package/index.js +260 -1061
- package/index.js.map +1 -1
- package/med_editor/framework/document-arrange.d.ts +1 -0
- package/med_editor/framework/element-define.d.ts +1 -0
- package/med_editor/framework/impl/data-element/data-element-base-impl.d.ts +1 -0
- package/med_editor/framework/impl/data-element/data-element-group-impl.d.ts +1 -5
- package/med_editor/framework/impl/table/table-impl.d.ts +1 -1
- package/package.json +1 -1
- package/timeline/timezone.d.ts +2 -0
package/index.js
CHANGED
@@ -2,6 +2,7 @@ import { nanoid } from 'nanoid';
|
|
2
2
|
import moment from 'moment';
|
3
3
|
import * as acor from 'acorn';
|
4
4
|
import { generate } from 'astring';
|
5
|
+
import * as estraverse from 'estraverse';
|
5
6
|
import bwipjs from 'bwip-js';
|
6
7
|
|
7
8
|
/**
|
@@ -2680,814 +2681,9 @@ class DataDecorateRenderObject extends LeafRenderObject {
|
|
2680
2681
|
}
|
2681
2682
|
}
|
2682
2683
|
|
2683
|
-
/*
|
2684
|
-
Copyright (C) 2012-2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
2685
|
-
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
2686
|
-
|
2687
|
-
Redistribution and use in source and binary forms, with or without
|
2688
|
-
modification, are permitted provided that the following conditions are met:
|
2689
|
-
|
2690
|
-
* Redistributions of source code must retain the above copyright
|
2691
|
-
notice, this list of conditions and the following disclaimer.
|
2692
|
-
* Redistributions in binary form must reproduce the above copyright
|
2693
|
-
notice, this list of conditions and the following disclaimer in the
|
2694
|
-
documentation and/or other materials provided with the distribution.
|
2695
|
-
|
2696
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
2697
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
2698
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
2699
|
-
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
2700
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
2701
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
2702
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
2703
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
2704
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
2705
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2706
|
-
*/
|
2707
|
-
/*jslint vars:false, bitwise:true*/
|
2708
|
-
/*jshint indent:4*/
|
2709
|
-
/*global exports:true*/
|
2710
|
-
(function clone(exports) {
|
2711
|
-
|
2712
|
-
var Syntax,
|
2713
|
-
VisitorOption,
|
2714
|
-
VisitorKeys,
|
2715
|
-
BREAK,
|
2716
|
-
SKIP,
|
2717
|
-
REMOVE;
|
2718
|
-
|
2719
|
-
function deepCopy(obj) {
|
2720
|
-
var ret = {}, key, val;
|
2721
|
-
for (key in obj) {
|
2722
|
-
if (obj.hasOwnProperty(key)) {
|
2723
|
-
val = obj[key];
|
2724
|
-
if (typeof val === 'object' && val !== null) {
|
2725
|
-
ret[key] = deepCopy(val);
|
2726
|
-
} else {
|
2727
|
-
ret[key] = val;
|
2728
|
-
}
|
2729
|
-
}
|
2730
|
-
}
|
2731
|
-
return ret;
|
2732
|
-
}
|
2733
|
-
|
2734
|
-
// based on LLVM libc++ upper_bound / lower_bound
|
2735
|
-
// MIT License
|
2736
|
-
|
2737
|
-
function upperBound(array, func) {
|
2738
|
-
var diff, len, i, current;
|
2739
|
-
|
2740
|
-
len = array.length;
|
2741
|
-
i = 0;
|
2742
|
-
|
2743
|
-
while (len) {
|
2744
|
-
diff = len >>> 1;
|
2745
|
-
current = i + diff;
|
2746
|
-
if (func(array[current])) {
|
2747
|
-
len = diff;
|
2748
|
-
} else {
|
2749
|
-
i = current + 1;
|
2750
|
-
len -= diff + 1;
|
2751
|
-
}
|
2752
|
-
}
|
2753
|
-
return i;
|
2754
|
-
}
|
2755
|
-
|
2756
|
-
Syntax = {
|
2757
|
-
AssignmentExpression: 'AssignmentExpression',
|
2758
|
-
AssignmentPattern: 'AssignmentPattern',
|
2759
|
-
ArrayExpression: 'ArrayExpression',
|
2760
|
-
ArrayPattern: 'ArrayPattern',
|
2761
|
-
ArrowFunctionExpression: 'ArrowFunctionExpression',
|
2762
|
-
AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.
|
2763
|
-
BlockStatement: 'BlockStatement',
|
2764
|
-
BinaryExpression: 'BinaryExpression',
|
2765
|
-
BreakStatement: 'BreakStatement',
|
2766
|
-
CallExpression: 'CallExpression',
|
2767
|
-
CatchClause: 'CatchClause',
|
2768
|
-
ChainExpression: 'ChainExpression',
|
2769
|
-
ClassBody: 'ClassBody',
|
2770
|
-
ClassDeclaration: 'ClassDeclaration',
|
2771
|
-
ClassExpression: 'ClassExpression',
|
2772
|
-
ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.
|
2773
|
-
ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.
|
2774
|
-
ConditionalExpression: 'ConditionalExpression',
|
2775
|
-
ContinueStatement: 'ContinueStatement',
|
2776
|
-
DebuggerStatement: 'DebuggerStatement',
|
2777
|
-
DirectiveStatement: 'DirectiveStatement',
|
2778
|
-
DoWhileStatement: 'DoWhileStatement',
|
2779
|
-
EmptyStatement: 'EmptyStatement',
|
2780
|
-
ExportAllDeclaration: 'ExportAllDeclaration',
|
2781
|
-
ExportDefaultDeclaration: 'ExportDefaultDeclaration',
|
2782
|
-
ExportNamedDeclaration: 'ExportNamedDeclaration',
|
2783
|
-
ExportSpecifier: 'ExportSpecifier',
|
2784
|
-
ExpressionStatement: 'ExpressionStatement',
|
2785
|
-
ForStatement: 'ForStatement',
|
2786
|
-
ForInStatement: 'ForInStatement',
|
2787
|
-
ForOfStatement: 'ForOfStatement',
|
2788
|
-
FunctionDeclaration: 'FunctionDeclaration',
|
2789
|
-
FunctionExpression: 'FunctionExpression',
|
2790
|
-
GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.
|
2791
|
-
Identifier: 'Identifier',
|
2792
|
-
IfStatement: 'IfStatement',
|
2793
|
-
ImportExpression: 'ImportExpression',
|
2794
|
-
ImportDeclaration: 'ImportDeclaration',
|
2795
|
-
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
|
2796
|
-
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
|
2797
|
-
ImportSpecifier: 'ImportSpecifier',
|
2798
|
-
Literal: 'Literal',
|
2799
|
-
LabeledStatement: 'LabeledStatement',
|
2800
|
-
LogicalExpression: 'LogicalExpression',
|
2801
|
-
MemberExpression: 'MemberExpression',
|
2802
|
-
MetaProperty: 'MetaProperty',
|
2803
|
-
MethodDefinition: 'MethodDefinition',
|
2804
|
-
ModuleSpecifier: 'ModuleSpecifier',
|
2805
|
-
NewExpression: 'NewExpression',
|
2806
|
-
ObjectExpression: 'ObjectExpression',
|
2807
|
-
ObjectPattern: 'ObjectPattern',
|
2808
|
-
PrivateIdentifier: 'PrivateIdentifier',
|
2809
|
-
Program: 'Program',
|
2810
|
-
Property: 'Property',
|
2811
|
-
PropertyDefinition: 'PropertyDefinition',
|
2812
|
-
RestElement: 'RestElement',
|
2813
|
-
ReturnStatement: 'ReturnStatement',
|
2814
|
-
SequenceExpression: 'SequenceExpression',
|
2815
|
-
SpreadElement: 'SpreadElement',
|
2816
|
-
Super: 'Super',
|
2817
|
-
SwitchStatement: 'SwitchStatement',
|
2818
|
-
SwitchCase: 'SwitchCase',
|
2819
|
-
TaggedTemplateExpression: 'TaggedTemplateExpression',
|
2820
|
-
TemplateElement: 'TemplateElement',
|
2821
|
-
TemplateLiteral: 'TemplateLiteral',
|
2822
|
-
ThisExpression: 'ThisExpression',
|
2823
|
-
ThrowStatement: 'ThrowStatement',
|
2824
|
-
TryStatement: 'TryStatement',
|
2825
|
-
UnaryExpression: 'UnaryExpression',
|
2826
|
-
UpdateExpression: 'UpdateExpression',
|
2827
|
-
VariableDeclaration: 'VariableDeclaration',
|
2828
|
-
VariableDeclarator: 'VariableDeclarator',
|
2829
|
-
WhileStatement: 'WhileStatement',
|
2830
|
-
WithStatement: 'WithStatement',
|
2831
|
-
YieldExpression: 'YieldExpression'
|
2832
|
-
};
|
2833
|
-
|
2834
|
-
VisitorKeys = {
|
2835
|
-
AssignmentExpression: ['left', 'right'],
|
2836
|
-
AssignmentPattern: ['left', 'right'],
|
2837
|
-
ArrayExpression: ['elements'],
|
2838
|
-
ArrayPattern: ['elements'],
|
2839
|
-
ArrowFunctionExpression: ['params', 'body'],
|
2840
|
-
AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.
|
2841
|
-
BlockStatement: ['body'],
|
2842
|
-
BinaryExpression: ['left', 'right'],
|
2843
|
-
BreakStatement: ['label'],
|
2844
|
-
CallExpression: ['callee', 'arguments'],
|
2845
|
-
CatchClause: ['param', 'body'],
|
2846
|
-
ChainExpression: ['expression'],
|
2847
|
-
ClassBody: ['body'],
|
2848
|
-
ClassDeclaration: ['id', 'superClass', 'body'],
|
2849
|
-
ClassExpression: ['id', 'superClass', 'body'],
|
2850
|
-
ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.
|
2851
|
-
ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
|
2852
|
-
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
2853
|
-
ContinueStatement: ['label'],
|
2854
|
-
DebuggerStatement: [],
|
2855
|
-
DirectiveStatement: [],
|
2856
|
-
DoWhileStatement: ['body', 'test'],
|
2857
|
-
EmptyStatement: [],
|
2858
|
-
ExportAllDeclaration: ['source'],
|
2859
|
-
ExportDefaultDeclaration: ['declaration'],
|
2860
|
-
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
|
2861
|
-
ExportSpecifier: ['exported', 'local'],
|
2862
|
-
ExpressionStatement: ['expression'],
|
2863
|
-
ForStatement: ['init', 'test', 'update', 'body'],
|
2864
|
-
ForInStatement: ['left', 'right', 'body'],
|
2865
|
-
ForOfStatement: ['left', 'right', 'body'],
|
2866
|
-
FunctionDeclaration: ['id', 'params', 'body'],
|
2867
|
-
FunctionExpression: ['id', 'params', 'body'],
|
2868
|
-
GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
|
2869
|
-
Identifier: [],
|
2870
|
-
IfStatement: ['test', 'consequent', 'alternate'],
|
2871
|
-
ImportExpression: ['source'],
|
2872
|
-
ImportDeclaration: ['specifiers', 'source'],
|
2873
|
-
ImportDefaultSpecifier: ['local'],
|
2874
|
-
ImportNamespaceSpecifier: ['local'],
|
2875
|
-
ImportSpecifier: ['imported', 'local'],
|
2876
|
-
Literal: [],
|
2877
|
-
LabeledStatement: ['label', 'body'],
|
2878
|
-
LogicalExpression: ['left', 'right'],
|
2879
|
-
MemberExpression: ['object', 'property'],
|
2880
|
-
MetaProperty: ['meta', 'property'],
|
2881
|
-
MethodDefinition: ['key', 'value'],
|
2882
|
-
ModuleSpecifier: [],
|
2883
|
-
NewExpression: ['callee', 'arguments'],
|
2884
|
-
ObjectExpression: ['properties'],
|
2885
|
-
ObjectPattern: ['properties'],
|
2886
|
-
PrivateIdentifier: [],
|
2887
|
-
Program: ['body'],
|
2888
|
-
Property: ['key', 'value'],
|
2889
|
-
PropertyDefinition: ['key', 'value'],
|
2890
|
-
RestElement: [ 'argument' ],
|
2891
|
-
ReturnStatement: ['argument'],
|
2892
|
-
SequenceExpression: ['expressions'],
|
2893
|
-
SpreadElement: ['argument'],
|
2894
|
-
Super: [],
|
2895
|
-
SwitchStatement: ['discriminant', 'cases'],
|
2896
|
-
SwitchCase: ['test', 'consequent'],
|
2897
|
-
TaggedTemplateExpression: ['tag', 'quasi'],
|
2898
|
-
TemplateElement: [],
|
2899
|
-
TemplateLiteral: ['quasis', 'expressions'],
|
2900
|
-
ThisExpression: [],
|
2901
|
-
ThrowStatement: ['argument'],
|
2902
|
-
TryStatement: ['block', 'handler', 'finalizer'],
|
2903
|
-
UnaryExpression: ['argument'],
|
2904
|
-
UpdateExpression: ['argument'],
|
2905
|
-
VariableDeclaration: ['declarations'],
|
2906
|
-
VariableDeclarator: ['id', 'init'],
|
2907
|
-
WhileStatement: ['test', 'body'],
|
2908
|
-
WithStatement: ['object', 'body'],
|
2909
|
-
YieldExpression: ['argument']
|
2910
|
-
};
|
2911
|
-
|
2912
|
-
// unique id
|
2913
|
-
BREAK = {};
|
2914
|
-
SKIP = {};
|
2915
|
-
REMOVE = {};
|
2916
|
-
|
2917
|
-
VisitorOption = {
|
2918
|
-
Break: BREAK,
|
2919
|
-
Skip: SKIP,
|
2920
|
-
Remove: REMOVE
|
2921
|
-
};
|
2922
|
-
|
2923
|
-
function Reference(parent, key) {
|
2924
|
-
this.parent = parent;
|
2925
|
-
this.key = key;
|
2926
|
-
}
|
2927
|
-
|
2928
|
-
Reference.prototype.replace = function replace(node) {
|
2929
|
-
this.parent[this.key] = node;
|
2930
|
-
};
|
2931
|
-
|
2932
|
-
Reference.prototype.remove = function remove() {
|
2933
|
-
if (Array.isArray(this.parent)) {
|
2934
|
-
this.parent.splice(this.key, 1);
|
2935
|
-
return true;
|
2936
|
-
} else {
|
2937
|
-
this.replace(null);
|
2938
|
-
return false;
|
2939
|
-
}
|
2940
|
-
};
|
2941
|
-
|
2942
|
-
function Element(node, path, wrap, ref) {
|
2943
|
-
this.node = node;
|
2944
|
-
this.path = path;
|
2945
|
-
this.wrap = wrap;
|
2946
|
-
this.ref = ref;
|
2947
|
-
}
|
2948
|
-
|
2949
|
-
function Controller() { }
|
2950
|
-
|
2951
|
-
// API:
|
2952
|
-
// return property path array from root to current node
|
2953
|
-
Controller.prototype.path = function path() {
|
2954
|
-
var i, iz, j, jz, result, element;
|
2955
|
-
|
2956
|
-
function addToPath(result, path) {
|
2957
|
-
if (Array.isArray(path)) {
|
2958
|
-
for (j = 0, jz = path.length; j < jz; ++j) {
|
2959
|
-
result.push(path[j]);
|
2960
|
-
}
|
2961
|
-
} else {
|
2962
|
-
result.push(path);
|
2963
|
-
}
|
2964
|
-
}
|
2965
|
-
|
2966
|
-
// root node
|
2967
|
-
if (!this.__current.path) {
|
2968
|
-
return null;
|
2969
|
-
}
|
2970
|
-
|
2971
|
-
// first node is sentinel, second node is root element
|
2972
|
-
result = [];
|
2973
|
-
for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {
|
2974
|
-
element = this.__leavelist[i];
|
2975
|
-
addToPath(result, element.path);
|
2976
|
-
}
|
2977
|
-
addToPath(result, this.__current.path);
|
2978
|
-
return result;
|
2979
|
-
};
|
2980
|
-
|
2981
|
-
// API:
|
2982
|
-
// return type of current node
|
2983
|
-
Controller.prototype.type = function () {
|
2984
|
-
var node = this.current();
|
2985
|
-
return node.type || this.__current.wrap;
|
2986
|
-
};
|
2987
|
-
|
2988
|
-
// API:
|
2989
|
-
// return array of parent elements
|
2990
|
-
Controller.prototype.parents = function parents() {
|
2991
|
-
var i, iz, result;
|
2992
|
-
|
2993
|
-
// first node is sentinel
|
2994
|
-
result = [];
|
2995
|
-
for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {
|
2996
|
-
result.push(this.__leavelist[i].node);
|
2997
|
-
}
|
2998
|
-
|
2999
|
-
return result;
|
3000
|
-
};
|
3001
|
-
|
3002
|
-
// API:
|
3003
|
-
// return current node
|
3004
|
-
Controller.prototype.current = function current() {
|
3005
|
-
return this.__current.node;
|
3006
|
-
};
|
3007
|
-
|
3008
|
-
Controller.prototype.__execute = function __execute(callback, element) {
|
3009
|
-
var previous, result;
|
3010
|
-
|
3011
|
-
result = undefined;
|
3012
|
-
|
3013
|
-
previous = this.__current;
|
3014
|
-
this.__current = element;
|
3015
|
-
this.__state = null;
|
3016
|
-
if (callback) {
|
3017
|
-
result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);
|
3018
|
-
}
|
3019
|
-
this.__current = previous;
|
3020
|
-
|
3021
|
-
return result;
|
3022
|
-
};
|
3023
|
-
|
3024
|
-
// API:
|
3025
|
-
// notify control skip / break
|
3026
|
-
Controller.prototype.notify = function notify(flag) {
|
3027
|
-
this.__state = flag;
|
3028
|
-
};
|
3029
|
-
|
3030
|
-
// API:
|
3031
|
-
// skip child nodes of current node
|
3032
|
-
Controller.prototype.skip = function () {
|
3033
|
-
this.notify(SKIP);
|
3034
|
-
};
|
3035
|
-
|
3036
|
-
// API:
|
3037
|
-
// break traversals
|
3038
|
-
Controller.prototype['break'] = function () {
|
3039
|
-
this.notify(BREAK);
|
3040
|
-
};
|
3041
|
-
|
3042
|
-
// API:
|
3043
|
-
// remove node
|
3044
|
-
Controller.prototype.remove = function () {
|
3045
|
-
this.notify(REMOVE);
|
3046
|
-
};
|
3047
|
-
|
3048
|
-
Controller.prototype.__initialize = function(root, visitor) {
|
3049
|
-
this.visitor = visitor;
|
3050
|
-
this.root = root;
|
3051
|
-
this.__worklist = [];
|
3052
|
-
this.__leavelist = [];
|
3053
|
-
this.__current = null;
|
3054
|
-
this.__state = null;
|
3055
|
-
this.__fallback = null;
|
3056
|
-
if (visitor.fallback === 'iteration') {
|
3057
|
-
this.__fallback = Object.keys;
|
3058
|
-
} else if (typeof visitor.fallback === 'function') {
|
3059
|
-
this.__fallback = visitor.fallback;
|
3060
|
-
}
|
3061
|
-
|
3062
|
-
this.__keys = VisitorKeys;
|
3063
|
-
if (visitor.keys) {
|
3064
|
-
this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);
|
3065
|
-
}
|
3066
|
-
};
|
3067
|
-
|
3068
|
-
function isNode(node) {
|
3069
|
-
if (node == null) {
|
3070
|
-
return false;
|
3071
|
-
}
|
3072
|
-
return typeof node === 'object' && typeof node.type === 'string';
|
3073
|
-
}
|
3074
|
-
|
3075
|
-
function isProperty(nodeType, key) {
|
3076
|
-
return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;
|
3077
|
-
}
|
3078
|
-
|
3079
|
-
function candidateExistsInLeaveList(leavelist, candidate) {
|
3080
|
-
for (var i = leavelist.length - 1; i >= 0; --i) {
|
3081
|
-
if (leavelist[i].node === candidate) {
|
3082
|
-
return true;
|
3083
|
-
}
|
3084
|
-
}
|
3085
|
-
return false;
|
3086
|
-
}
|
3087
|
-
|
3088
|
-
Controller.prototype.traverse = function traverse(root, visitor) {
|
3089
|
-
var worklist,
|
3090
|
-
leavelist,
|
3091
|
-
element,
|
3092
|
-
node,
|
3093
|
-
nodeType,
|
3094
|
-
ret,
|
3095
|
-
key,
|
3096
|
-
current,
|
3097
|
-
current2,
|
3098
|
-
candidates,
|
3099
|
-
candidate,
|
3100
|
-
sentinel;
|
3101
|
-
|
3102
|
-
this.__initialize(root, visitor);
|
3103
|
-
|
3104
|
-
sentinel = {};
|
3105
|
-
|
3106
|
-
// reference
|
3107
|
-
worklist = this.__worklist;
|
3108
|
-
leavelist = this.__leavelist;
|
3109
|
-
|
3110
|
-
// initialize
|
3111
|
-
worklist.push(new Element(root, null, null, null));
|
3112
|
-
leavelist.push(new Element(null, null, null, null));
|
3113
|
-
|
3114
|
-
while (worklist.length) {
|
3115
|
-
element = worklist.pop();
|
3116
|
-
|
3117
|
-
if (element === sentinel) {
|
3118
|
-
element = leavelist.pop();
|
3119
|
-
|
3120
|
-
ret = this.__execute(visitor.leave, element);
|
3121
|
-
|
3122
|
-
if (this.__state === BREAK || ret === BREAK) {
|
3123
|
-
return;
|
3124
|
-
}
|
3125
|
-
continue;
|
3126
|
-
}
|
3127
|
-
|
3128
|
-
if (element.node) {
|
3129
|
-
|
3130
|
-
ret = this.__execute(visitor.enter, element);
|
3131
|
-
|
3132
|
-
if (this.__state === BREAK || ret === BREAK) {
|
3133
|
-
return;
|
3134
|
-
}
|
3135
|
-
|
3136
|
-
worklist.push(sentinel);
|
3137
|
-
leavelist.push(element);
|
3138
|
-
|
3139
|
-
if (this.__state === SKIP || ret === SKIP) {
|
3140
|
-
continue;
|
3141
|
-
}
|
3142
|
-
|
3143
|
-
node = element.node;
|
3144
|
-
nodeType = node.type || element.wrap;
|
3145
|
-
candidates = this.__keys[nodeType];
|
3146
|
-
if (!candidates) {
|
3147
|
-
if (this.__fallback) {
|
3148
|
-
candidates = this.__fallback(node);
|
3149
|
-
} else {
|
3150
|
-
throw new Error('Unknown node type ' + nodeType + '.');
|
3151
|
-
}
|
3152
|
-
}
|
3153
|
-
|
3154
|
-
current = candidates.length;
|
3155
|
-
while ((current -= 1) >= 0) {
|
3156
|
-
key = candidates[current];
|
3157
|
-
candidate = node[key];
|
3158
|
-
if (!candidate) {
|
3159
|
-
continue;
|
3160
|
-
}
|
3161
|
-
|
3162
|
-
if (Array.isArray(candidate)) {
|
3163
|
-
current2 = candidate.length;
|
3164
|
-
while ((current2 -= 1) >= 0) {
|
3165
|
-
if (!candidate[current2]) {
|
3166
|
-
continue;
|
3167
|
-
}
|
3168
|
-
|
3169
|
-
if (candidateExistsInLeaveList(leavelist, candidate[current2])) {
|
3170
|
-
continue;
|
3171
|
-
}
|
3172
|
-
|
3173
|
-
if (isProperty(nodeType, candidates[current])) {
|
3174
|
-
element = new Element(candidate[current2], [key, current2], 'Property', null);
|
3175
|
-
} else if (isNode(candidate[current2])) {
|
3176
|
-
element = new Element(candidate[current2], [key, current2], null, null);
|
3177
|
-
} else {
|
3178
|
-
continue;
|
3179
|
-
}
|
3180
|
-
worklist.push(element);
|
3181
|
-
}
|
3182
|
-
} else if (isNode(candidate)) {
|
3183
|
-
if (candidateExistsInLeaveList(leavelist, candidate)) {
|
3184
|
-
continue;
|
3185
|
-
}
|
3186
|
-
|
3187
|
-
worklist.push(new Element(candidate, key, null, null));
|
3188
|
-
}
|
3189
|
-
}
|
3190
|
-
}
|
3191
|
-
}
|
3192
|
-
};
|
3193
|
-
|
3194
|
-
Controller.prototype.replace = function replace(root, visitor) {
|
3195
|
-
var worklist,
|
3196
|
-
leavelist,
|
3197
|
-
node,
|
3198
|
-
nodeType,
|
3199
|
-
target,
|
3200
|
-
element,
|
3201
|
-
current,
|
3202
|
-
current2,
|
3203
|
-
candidates,
|
3204
|
-
candidate,
|
3205
|
-
sentinel,
|
3206
|
-
outer,
|
3207
|
-
key;
|
3208
|
-
|
3209
|
-
function removeElem(element) {
|
3210
|
-
var i,
|
3211
|
-
key,
|
3212
|
-
nextElem,
|
3213
|
-
parent;
|
3214
|
-
|
3215
|
-
if (element.ref.remove()) {
|
3216
|
-
// When the reference is an element of an array.
|
3217
|
-
key = element.ref.key;
|
3218
|
-
parent = element.ref.parent;
|
3219
|
-
|
3220
|
-
// If removed from array, then decrease following items' keys.
|
3221
|
-
i = worklist.length;
|
3222
|
-
while (i--) {
|
3223
|
-
nextElem = worklist[i];
|
3224
|
-
if (nextElem.ref && nextElem.ref.parent === parent) {
|
3225
|
-
if (nextElem.ref.key < key) {
|
3226
|
-
break;
|
3227
|
-
}
|
3228
|
-
--nextElem.ref.key;
|
3229
|
-
}
|
3230
|
-
}
|
3231
|
-
}
|
3232
|
-
}
|
3233
|
-
|
3234
|
-
this.__initialize(root, visitor);
|
3235
|
-
|
3236
|
-
sentinel = {};
|
3237
|
-
|
3238
|
-
// reference
|
3239
|
-
worklist = this.__worklist;
|
3240
|
-
leavelist = this.__leavelist;
|
3241
|
-
|
3242
|
-
// initialize
|
3243
|
-
outer = {
|
3244
|
-
root: root
|
3245
|
-
};
|
3246
|
-
element = new Element(root, null, null, new Reference(outer, 'root'));
|
3247
|
-
worklist.push(element);
|
3248
|
-
leavelist.push(element);
|
3249
|
-
|
3250
|
-
while (worklist.length) {
|
3251
|
-
element = worklist.pop();
|
3252
|
-
|
3253
|
-
if (element === sentinel) {
|
3254
|
-
element = leavelist.pop();
|
3255
|
-
|
3256
|
-
target = this.__execute(visitor.leave, element);
|
3257
|
-
|
3258
|
-
// node may be replaced with null,
|
3259
|
-
// so distinguish between undefined and null in this place
|
3260
|
-
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
|
3261
|
-
// replace
|
3262
|
-
element.ref.replace(target);
|
3263
|
-
}
|
3264
|
-
|
3265
|
-
if (this.__state === REMOVE || target === REMOVE) {
|
3266
|
-
removeElem(element);
|
3267
|
-
}
|
3268
|
-
|
3269
|
-
if (this.__state === BREAK || target === BREAK) {
|
3270
|
-
return outer.root;
|
3271
|
-
}
|
3272
|
-
continue;
|
3273
|
-
}
|
3274
|
-
|
3275
|
-
target = this.__execute(visitor.enter, element);
|
3276
|
-
|
3277
|
-
// node may be replaced with null,
|
3278
|
-
// so distinguish between undefined and null in this place
|
3279
|
-
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
|
3280
|
-
// replace
|
3281
|
-
element.ref.replace(target);
|
3282
|
-
element.node = target;
|
3283
|
-
}
|
3284
|
-
|
3285
|
-
if (this.__state === REMOVE || target === REMOVE) {
|
3286
|
-
removeElem(element);
|
3287
|
-
element.node = null;
|
3288
|
-
}
|
3289
|
-
|
3290
|
-
if (this.__state === BREAK || target === BREAK) {
|
3291
|
-
return outer.root;
|
3292
|
-
}
|
3293
|
-
|
3294
|
-
// node may be null
|
3295
|
-
node = element.node;
|
3296
|
-
if (!node) {
|
3297
|
-
continue;
|
3298
|
-
}
|
3299
|
-
|
3300
|
-
worklist.push(sentinel);
|
3301
|
-
leavelist.push(element);
|
3302
|
-
|
3303
|
-
if (this.__state === SKIP || target === SKIP) {
|
3304
|
-
continue;
|
3305
|
-
}
|
3306
|
-
|
3307
|
-
nodeType = node.type || element.wrap;
|
3308
|
-
candidates = this.__keys[nodeType];
|
3309
|
-
if (!candidates) {
|
3310
|
-
if (this.__fallback) {
|
3311
|
-
candidates = this.__fallback(node);
|
3312
|
-
} else {
|
3313
|
-
throw new Error('Unknown node type ' + nodeType + '.');
|
3314
|
-
}
|
3315
|
-
}
|
3316
|
-
|
3317
|
-
current = candidates.length;
|
3318
|
-
while ((current -= 1) >= 0) {
|
3319
|
-
key = candidates[current];
|
3320
|
-
candidate = node[key];
|
3321
|
-
if (!candidate) {
|
3322
|
-
continue;
|
3323
|
-
}
|
3324
|
-
|
3325
|
-
if (Array.isArray(candidate)) {
|
3326
|
-
current2 = candidate.length;
|
3327
|
-
while ((current2 -= 1) >= 0) {
|
3328
|
-
if (!candidate[current2]) {
|
3329
|
-
continue;
|
3330
|
-
}
|
3331
|
-
if (isProperty(nodeType, candidates[current])) {
|
3332
|
-
element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));
|
3333
|
-
} else if (isNode(candidate[current2])) {
|
3334
|
-
element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));
|
3335
|
-
} else {
|
3336
|
-
continue;
|
3337
|
-
}
|
3338
|
-
worklist.push(element);
|
3339
|
-
}
|
3340
|
-
} else if (isNode(candidate)) {
|
3341
|
-
worklist.push(new Element(candidate, key, null, new Reference(node, key)));
|
3342
|
-
}
|
3343
|
-
}
|
3344
|
-
}
|
3345
|
-
|
3346
|
-
return outer.root;
|
3347
|
-
};
|
3348
|
-
|
3349
|
-
function traverse(root, visitor) {
|
3350
|
-
var controller = new Controller();
|
3351
|
-
return controller.traverse(root, visitor);
|
3352
|
-
}
|
3353
|
-
|
3354
|
-
function replace(root, visitor) {
|
3355
|
-
var controller = new Controller();
|
3356
|
-
return controller.replace(root, visitor);
|
3357
|
-
}
|
3358
|
-
|
3359
|
-
function extendCommentRange(comment, tokens) {
|
3360
|
-
var target;
|
3361
|
-
|
3362
|
-
target = upperBound(tokens, function search(token) {
|
3363
|
-
return token.range[0] > comment.range[0];
|
3364
|
-
});
|
3365
|
-
|
3366
|
-
comment.extendedRange = [comment.range[0], comment.range[1]];
|
3367
|
-
|
3368
|
-
if (target !== tokens.length) {
|
3369
|
-
comment.extendedRange[1] = tokens[target].range[0];
|
3370
|
-
}
|
3371
|
-
|
3372
|
-
target -= 1;
|
3373
|
-
if (target >= 0) {
|
3374
|
-
comment.extendedRange[0] = tokens[target].range[1];
|
3375
|
-
}
|
3376
|
-
|
3377
|
-
return comment;
|
3378
|
-
}
|
3379
|
-
|
3380
|
-
function attachComments(tree, providedComments, tokens) {
|
3381
|
-
// At first, we should calculate extended comment ranges.
|
3382
|
-
var comments = [], comment, len, i, cursor;
|
3383
|
-
|
3384
|
-
if (!tree.range) {
|
3385
|
-
throw new Error('attachComments needs range information');
|
3386
|
-
}
|
3387
|
-
|
3388
|
-
// tokens array is empty, we attach comments to tree as 'leadingComments'
|
3389
|
-
if (!tokens.length) {
|
3390
|
-
if (providedComments.length) {
|
3391
|
-
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
3392
|
-
comment = deepCopy(providedComments[i]);
|
3393
|
-
comment.extendedRange = [0, tree.range[0]];
|
3394
|
-
comments.push(comment);
|
3395
|
-
}
|
3396
|
-
tree.leadingComments = comments;
|
3397
|
-
}
|
3398
|
-
return tree;
|
3399
|
-
}
|
3400
|
-
|
3401
|
-
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
3402
|
-
comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));
|
3403
|
-
}
|
3404
|
-
|
3405
|
-
// This is based on John Freeman's implementation.
|
3406
|
-
cursor = 0;
|
3407
|
-
traverse(tree, {
|
3408
|
-
enter: function (node) {
|
3409
|
-
var comment;
|
3410
|
-
|
3411
|
-
while (cursor < comments.length) {
|
3412
|
-
comment = comments[cursor];
|
3413
|
-
if (comment.extendedRange[1] > node.range[0]) {
|
3414
|
-
break;
|
3415
|
-
}
|
3416
|
-
|
3417
|
-
if (comment.extendedRange[1] === node.range[0]) {
|
3418
|
-
if (!node.leadingComments) {
|
3419
|
-
node.leadingComments = [];
|
3420
|
-
}
|
3421
|
-
node.leadingComments.push(comment);
|
3422
|
-
comments.splice(cursor, 1);
|
3423
|
-
} else {
|
3424
|
-
cursor += 1;
|
3425
|
-
}
|
3426
|
-
}
|
3427
|
-
|
3428
|
-
// already out of owned node
|
3429
|
-
if (cursor === comments.length) {
|
3430
|
-
return VisitorOption.Break;
|
3431
|
-
}
|
3432
|
-
|
3433
|
-
if (comments[cursor].extendedRange[0] > node.range[1]) {
|
3434
|
-
return VisitorOption.Skip;
|
3435
|
-
}
|
3436
|
-
}
|
3437
|
-
});
|
3438
|
-
|
3439
|
-
cursor = 0;
|
3440
|
-
traverse(tree, {
|
3441
|
-
leave: function (node) {
|
3442
|
-
var comment;
|
3443
|
-
|
3444
|
-
while (cursor < comments.length) {
|
3445
|
-
comment = comments[cursor];
|
3446
|
-
if (node.range[1] < comment.extendedRange[0]) {
|
3447
|
-
break;
|
3448
|
-
}
|
3449
|
-
|
3450
|
-
if (node.range[1] === comment.extendedRange[0]) {
|
3451
|
-
if (!node.trailingComments) {
|
3452
|
-
node.trailingComments = [];
|
3453
|
-
}
|
3454
|
-
node.trailingComments.push(comment);
|
3455
|
-
comments.splice(cursor, 1);
|
3456
|
-
} else {
|
3457
|
-
cursor += 1;
|
3458
|
-
}
|
3459
|
-
}
|
3460
|
-
|
3461
|
-
// already out of owned node
|
3462
|
-
if (cursor === comments.length) {
|
3463
|
-
return VisitorOption.Break;
|
3464
|
-
}
|
3465
|
-
|
3466
|
-
if (comments[cursor].extendedRange[0] > node.range[1]) {
|
3467
|
-
return VisitorOption.Skip;
|
3468
|
-
}
|
3469
|
-
}
|
3470
|
-
});
|
3471
|
-
|
3472
|
-
return tree;
|
3473
|
-
}
|
3474
|
-
|
3475
|
-
exports.Syntax = Syntax;
|
3476
|
-
exports.traverse = traverse;
|
3477
|
-
exports.replace = replace;
|
3478
|
-
exports.attachComments = attachComments;
|
3479
|
-
exports.VisitorKeys = VisitorKeys;
|
3480
|
-
exports.VisitorOption = VisitorOption;
|
3481
|
-
exports.Controller = Controller;
|
3482
|
-
exports.cloneEnvironment = function () { return clone({}); };
|
3483
|
-
|
3484
|
-
return exports;
|
3485
|
-
}(exports));
|
3486
|
-
/* vim: set sw=4 ts=4 et tw=80 : */
|
3487
|
-
|
3488
2684
|
function parser(code) {
|
3489
2685
|
const node = acor.parse(code, { ecmaVersion: 'latest' });
|
3490
|
-
|
2686
|
+
estraverse.traverse(node, {
|
3491
2687
|
enter: (child, parent) => {
|
3492
2688
|
if (child.type === 'Identifier') {
|
3493
2689
|
const identifierName = child['name'];
|
@@ -3497,7 +2693,7 @@ function parser(code) {
|
|
3497
2693
|
}
|
3498
2694
|
}
|
3499
2695
|
});
|
3500
|
-
|
2696
|
+
estraverse.replace(node, {
|
3501
2697
|
leave: (child) => {
|
3502
2698
|
//函数调用
|
3503
2699
|
if (child.type == 'CallExpression') {
|
@@ -3552,6 +2748,173 @@ function getCalleeName(node) {
|
|
3552
2748
|
return node['name'];
|
3553
2749
|
}
|
3554
2750
|
|
2751
|
+
class ParagraphElement extends BlockContentElement {
|
2752
|
+
constructor() {
|
2753
|
+
super('p');
|
2754
|
+
this.props = new ParagraphProps();
|
2755
|
+
this.addEvent('BackspaceKey', (evt) => {
|
2756
|
+
if (evt.selectionState.collapsed) {
|
2757
|
+
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
2758
|
+
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
2759
|
+
if (this.props.numberType >= 0) {
|
2760
|
+
this.props.numberType = -1;
|
2761
|
+
evt.isCancel = true;
|
2762
|
+
}
|
2763
|
+
else if (this.props.indent) {
|
2764
|
+
this.props.indent = 0;
|
2765
|
+
evt.isCancel = true;
|
2766
|
+
}
|
2767
|
+
}
|
2768
|
+
}
|
2769
|
+
}, true);
|
2770
|
+
this.addEvent('ElementKeyDown', evt => {
|
2771
|
+
//当前存在缩进,点击tab
|
2772
|
+
if (evt.sourceEvent.keyCode === 9) {
|
2773
|
+
const { startControl, startOffset } = evt.selectionState;
|
2774
|
+
if (startOffset === 0 && startControl === this.getChild(0)) {
|
2775
|
+
const defaultIndent = evt.ctx.viewOptions.defaultIndent;
|
2776
|
+
let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
|
2777
|
+
this.props.indent += increaseValue;
|
2778
|
+
evt.isCancel = true;
|
2779
|
+
evt.sourceEvent.preventDefault();
|
2780
|
+
}
|
2781
|
+
}
|
2782
|
+
}, true);
|
2783
|
+
}
|
2784
|
+
/**
|
2785
|
+
* 设置样式
|
2786
|
+
* @param format
|
2787
|
+
*/
|
2788
|
+
setFormat(format) {
|
2789
|
+
formatEle(this, format);
|
2790
|
+
Object.keys(format).forEach(key => {
|
2791
|
+
this.props[key] = format[key];
|
2792
|
+
});
|
2793
|
+
}
|
2794
|
+
createRenderObject() {
|
2795
|
+
return new ParagraphRenderObject(this);
|
2796
|
+
}
|
2797
|
+
createLineRect() {
|
2798
|
+
return new ParagraphLineRectRenderObject(null);
|
2799
|
+
}
|
2800
|
+
serialize(viewOptions) {
|
2801
|
+
return {
|
2802
|
+
type: 'p',
|
2803
|
+
props: {
|
2804
|
+
...this.props.getSerializeProps(viewOptions)
|
2805
|
+
}
|
2806
|
+
};
|
2807
|
+
}
|
2808
|
+
clone(data) {
|
2809
|
+
const clone = new ParagraphElement();
|
2810
|
+
this.props.clone(clone.props);
|
2811
|
+
if (data) {
|
2812
|
+
for (let i = 0; i < this.length; i++) {
|
2813
|
+
clone.addChild(this.getChild(i).clone(true));
|
2814
|
+
}
|
2815
|
+
}
|
2816
|
+
return clone;
|
2817
|
+
}
|
2818
|
+
static createElement() {
|
2819
|
+
return new ParagraphElement();
|
2820
|
+
}
|
2821
|
+
}
|
2822
|
+
class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
2823
|
+
render(e) {
|
2824
|
+
e.nextRender();
|
2825
|
+
this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
|
2826
|
+
}
|
2827
|
+
/**
|
2828
|
+
* 绘制项目符号
|
2829
|
+
*/
|
2830
|
+
drawProjectNumber(ctx, viewOptions, e) {
|
2831
|
+
const paraElement = this.element;
|
2832
|
+
if (paraElement.props.numberType !== ParagraphNumberType.none) {
|
2833
|
+
if (paraElement.paintRenders.indexOf(this) > 0) {
|
2834
|
+
return;
|
2835
|
+
}
|
2836
|
+
const line = this.getChild(0);
|
2837
|
+
// const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
2838
|
+
// x: 0,
|
2839
|
+
// y: -viewOptions.translateY
|
2840
|
+
// });
|
2841
|
+
const firstInlinePaintPos = {
|
2842
|
+
x: e.position.x + line.rect.x,
|
2843
|
+
y: e.position.y + line.rect.y
|
2844
|
+
};
|
2845
|
+
if (paraElement.props.numberType === ParagraphNumberType.ul) {
|
2846
|
+
const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
|
2847
|
+
ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
|
2848
|
+
}
|
2849
|
+
else if (paraElement.props.numberType === ParagraphNumberType.ol) {
|
2850
|
+
const parent = paraElement.parent;
|
2851
|
+
let i = paraElement.getIndex() - 1;
|
2852
|
+
for (; i >= 0; i--) {
|
2853
|
+
if (parent.getChild(i) instanceof ParagraphElement) {
|
2854
|
+
//紧挨上面的段落
|
2855
|
+
const prevSiblingPara = parent.getChild(i);
|
2856
|
+
if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
|
2857
|
+
break;
|
2858
|
+
}
|
2859
|
+
}
|
2860
|
+
}
|
2861
|
+
const olText = (paraElement.getIndex() - i) + '.';
|
2862
|
+
const textProps = new TextProps();
|
2863
|
+
textProps.color = '#000';
|
2864
|
+
textProps.fontSize = line.baseBottomLine - line.baseTopLine;
|
2865
|
+
textProps.fontName = '宋体';
|
2866
|
+
ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
|
2867
|
+
}
|
2868
|
+
}
|
2869
|
+
}
|
2870
|
+
clone() {
|
2871
|
+
const cloneRender = new ParagraphRenderObject(this.element);
|
2872
|
+
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
2873
|
+
for (let i = 0; i < this.length; i++) {
|
2874
|
+
cloneRender.addChild(this.getChild(i).clone());
|
2875
|
+
}
|
2876
|
+
return cloneRender;
|
2877
|
+
}
|
2878
|
+
}
|
2879
|
+
class ParagraphFactory extends ElementFactory {
|
2880
|
+
match(type) {
|
2881
|
+
return type === 'p';
|
2882
|
+
}
|
2883
|
+
createElement(data) {
|
2884
|
+
const paraElement = new ParagraphElement();
|
2885
|
+
const props = data.props;
|
2886
|
+
paraElement.props.indent = props?.indent ?? 0;
|
2887
|
+
paraElement.props.hanging = props?.hanging ?? 0;
|
2888
|
+
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
2889
|
+
paraElement.props.numberType = props?.numberType ?? -1;
|
2890
|
+
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
2891
|
+
paraElement.props.marginTop = props?.marginTop ?? 0;
|
2892
|
+
paraElement.props.marginBottom = props?.marginBottom ?? 0;
|
2893
|
+
paraElement.props.tabs = props?.tabs ?? [];
|
2894
|
+
return paraElement;
|
2895
|
+
}
|
2896
|
+
}
|
2897
|
+
/**
|
2898
|
+
* 段落行框
|
2899
|
+
*/
|
2900
|
+
class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
2901
|
+
baseTopLine = 0;
|
2902
|
+
baseBottomLine = 0;
|
2903
|
+
startX = 0;
|
2904
|
+
render(e) {
|
2905
|
+
}
|
2906
|
+
clone() {
|
2907
|
+
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
2908
|
+
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
2909
|
+
cloneRender.baseTopLine = this.baseTopLine;
|
2910
|
+
cloneRender.baseBottomLine = this.baseBottomLine;
|
2911
|
+
for (let i = 0; i < this.length; i++) {
|
2912
|
+
cloneRender.addChild(this.getChild(i).clone());
|
2913
|
+
}
|
2914
|
+
return cloneRender;
|
2915
|
+
}
|
2916
|
+
}
|
2917
|
+
|
3555
2918
|
/**
|
3556
2919
|
* 所有的数据元继承上述两个抽象类
|
3557
2920
|
*/
|
@@ -3755,6 +3118,7 @@ function getCurrOptions(ele) {
|
|
3755
3118
|
class DataElementRenderObject extends InlineGroupRenderObject {
|
3756
3119
|
render(e) {
|
3757
3120
|
const { render, position, docCtx: { viewOptions } } = e;
|
3121
|
+
this.paintPos = e.position;
|
3758
3122
|
//数据元不打印
|
3759
3123
|
if (!this.element.props.printable && render.drawMode === 'print') {
|
3760
3124
|
return;
|
@@ -3787,6 +3151,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3787
3151
|
e.nextRender();
|
3788
3152
|
this.drawCaption(e);
|
3789
3153
|
});
|
3154
|
+
e.render.onRenderCompleted.subscribe(() => {
|
3155
|
+
drawDecorator(e, this);
|
3156
|
+
});
|
3790
3157
|
}
|
3791
3158
|
/**
|
3792
3159
|
* 绘制数据元标题
|
@@ -3867,6 +3234,57 @@ class DataElementBaseFactory extends ElementFactory {
|
|
3867
3234
|
}
|
3868
3235
|
}
|
3869
3236
|
}
|
3237
|
+
function drawDecorator(e, r) {
|
3238
|
+
const { render, docCtx: { viewOptions } } = e;
|
3239
|
+
const canPaint = r.element.isMouseenter || r.element.isFocused;
|
3240
|
+
if (canPaint && r.element.paintRenders.indexOf(r) === 0) {
|
3241
|
+
const currParaRenders = getCurrentParaGroupRenders(r);
|
3242
|
+
const verOffset = 3;
|
3243
|
+
if (currParaRenders.length > 1) {
|
3244
|
+
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
3245
|
+
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > r.paintPos.x) {
|
3246
|
+
const leftPoints = [];
|
3247
|
+
const rightPoints = [];
|
3248
|
+
for (let i = 0; i < currParaRenders.length; i++) {
|
3249
|
+
const groupRender = currParaRenders[i];
|
3250
|
+
const groupRenderPos = groupRender.paintPos;
|
3251
|
+
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
3252
|
+
rightPoints.push({
|
3253
|
+
x: groupRenderPos.x + groupRender.rect.width,
|
3254
|
+
y: groupRenderPos.y - verOffset
|
3255
|
+
});
|
3256
|
+
leftPoints.push({
|
3257
|
+
x: groupRenderPos.x,
|
3258
|
+
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
3259
|
+
});
|
3260
|
+
rightPoints.push({
|
3261
|
+
x: groupRenderPos.x + groupRender.rect.width,
|
3262
|
+
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
3263
|
+
});
|
3264
|
+
}
|
3265
|
+
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
3266
|
+
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
3267
|
+
render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
|
3268
|
+
return;
|
3269
|
+
}
|
3270
|
+
}
|
3271
|
+
for (let i = 0; i < currParaRenders.length; i++) {
|
3272
|
+
const currRen = currParaRenders[i];
|
3273
|
+
render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
|
3274
|
+
}
|
3275
|
+
}
|
3276
|
+
}
|
3277
|
+
function getCurrentParaGroupRenders(r) {
|
3278
|
+
const renders = [];
|
3279
|
+
const currParaRender = ElementUtil.getParentRender(r, ParagraphRenderObject);
|
3280
|
+
for (let i = 0; i < r.element.paintRenders.length; i++) {
|
3281
|
+
const paraRender = ElementUtil.getParentRender(r.element.paintRenders[i], ParagraphRenderObject);
|
3282
|
+
if (paraRender === currParaRender) {
|
3283
|
+
renders.push(r.element.paintRenders[i]);
|
3284
|
+
}
|
3285
|
+
}
|
3286
|
+
return renders;
|
3287
|
+
}
|
3870
3288
|
|
3871
3289
|
class DocumentElement extends BlockContainerElement {
|
3872
3290
|
//props: DocumentProps;
|
@@ -4328,173 +3746,6 @@ class DocumentHeaderFactory extends ElementFactory {
|
|
4328
3746
|
}
|
4329
3747
|
}
|
4330
3748
|
|
4331
|
-
class ParagraphElement extends BlockContentElement {
|
4332
|
-
constructor() {
|
4333
|
-
super('p');
|
4334
|
-
this.props = new ParagraphProps();
|
4335
|
-
this.addEvent('BackspaceKey', (evt) => {
|
4336
|
-
if (evt.selectionState.collapsed) {
|
4337
|
-
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
4338
|
-
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
4339
|
-
if (this.props.numberType >= 0) {
|
4340
|
-
this.props.numberType = -1;
|
4341
|
-
evt.isCancel = true;
|
4342
|
-
}
|
4343
|
-
else if (this.props.indent) {
|
4344
|
-
this.props.indent = 0;
|
4345
|
-
evt.isCancel = true;
|
4346
|
-
}
|
4347
|
-
}
|
4348
|
-
}
|
4349
|
-
}, true);
|
4350
|
-
this.addEvent('ElementKeyDown', evt => {
|
4351
|
-
//当前存在缩进,点击tab
|
4352
|
-
if (evt.sourceEvent.keyCode === 9) {
|
4353
|
-
const { startControl, startOffset } = evt.selectionState;
|
4354
|
-
if (startOffset === 0 && startControl === this.getChild(0)) {
|
4355
|
-
const defaultIndent = evt.ctx.viewOptions.defaultIndent;
|
4356
|
-
let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
|
4357
|
-
this.props.indent += increaseValue;
|
4358
|
-
evt.isCancel = true;
|
4359
|
-
evt.sourceEvent.preventDefault();
|
4360
|
-
}
|
4361
|
-
}
|
4362
|
-
}, true);
|
4363
|
-
}
|
4364
|
-
/**
|
4365
|
-
* 设置样式
|
4366
|
-
* @param format
|
4367
|
-
*/
|
4368
|
-
setFormat(format) {
|
4369
|
-
formatEle(this, format);
|
4370
|
-
Object.keys(format).forEach(key => {
|
4371
|
-
this.props[key] = format[key];
|
4372
|
-
});
|
4373
|
-
}
|
4374
|
-
createRenderObject() {
|
4375
|
-
return new ParagraphRenderObject(this);
|
4376
|
-
}
|
4377
|
-
createLineRect() {
|
4378
|
-
return new ParagraphLineRectRenderObject(null);
|
4379
|
-
}
|
4380
|
-
serialize(viewOptions) {
|
4381
|
-
return {
|
4382
|
-
type: 'p',
|
4383
|
-
props: {
|
4384
|
-
...this.props.getSerializeProps(viewOptions)
|
4385
|
-
}
|
4386
|
-
};
|
4387
|
-
}
|
4388
|
-
clone(data) {
|
4389
|
-
const clone = new ParagraphElement();
|
4390
|
-
this.props.clone(clone.props);
|
4391
|
-
if (data) {
|
4392
|
-
for (let i = 0; i < this.length; i++) {
|
4393
|
-
clone.addChild(this.getChild(i).clone(true));
|
4394
|
-
}
|
4395
|
-
}
|
4396
|
-
return clone;
|
4397
|
-
}
|
4398
|
-
static createElement() {
|
4399
|
-
return new ParagraphElement();
|
4400
|
-
}
|
4401
|
-
}
|
4402
|
-
class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
4403
|
-
render(e) {
|
4404
|
-
e.nextRender();
|
4405
|
-
this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
|
4406
|
-
}
|
4407
|
-
/**
|
4408
|
-
* 绘制项目符号
|
4409
|
-
*/
|
4410
|
-
drawProjectNumber(ctx, viewOptions, e) {
|
4411
|
-
const paraElement = this.element;
|
4412
|
-
if (paraElement.props.numberType !== ParagraphNumberType.none) {
|
4413
|
-
if (paraElement.paintRenders.indexOf(this) > 0) {
|
4414
|
-
return;
|
4415
|
-
}
|
4416
|
-
const line = this.getChild(0);
|
4417
|
-
// const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
4418
|
-
// x: 0,
|
4419
|
-
// y: -viewOptions.translateY
|
4420
|
-
// });
|
4421
|
-
const firstInlinePaintPos = {
|
4422
|
-
x: e.position.x + line.rect.x,
|
4423
|
-
y: e.position.y + line.rect.y
|
4424
|
-
};
|
4425
|
-
if (paraElement.props.numberType === ParagraphNumberType.ul) {
|
4426
|
-
const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
|
4427
|
-
ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
|
4428
|
-
}
|
4429
|
-
else if (paraElement.props.numberType === ParagraphNumberType.ol) {
|
4430
|
-
const parent = paraElement.parent;
|
4431
|
-
let i = paraElement.getIndex() - 1;
|
4432
|
-
for (; i >= 0; i--) {
|
4433
|
-
if (parent.getChild(i) instanceof ParagraphElement) {
|
4434
|
-
//紧挨上面的段落
|
4435
|
-
const prevSiblingPara = parent.getChild(i);
|
4436
|
-
if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
|
4437
|
-
break;
|
4438
|
-
}
|
4439
|
-
}
|
4440
|
-
}
|
4441
|
-
const olText = (paraElement.getIndex() - i) + '.';
|
4442
|
-
const textProps = new TextProps();
|
4443
|
-
textProps.color = '#000';
|
4444
|
-
textProps.fontSize = line.baseBottomLine - line.baseTopLine;
|
4445
|
-
textProps.fontName = '宋体';
|
4446
|
-
ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
|
4447
|
-
}
|
4448
|
-
}
|
4449
|
-
}
|
4450
|
-
clone() {
|
4451
|
-
const cloneRender = new ParagraphRenderObject(this.element);
|
4452
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4453
|
-
for (let i = 0; i < this.length; i++) {
|
4454
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4455
|
-
}
|
4456
|
-
return cloneRender;
|
4457
|
-
}
|
4458
|
-
}
|
4459
|
-
class ParagraphFactory extends ElementFactory {
|
4460
|
-
match(type) {
|
4461
|
-
return type === 'p';
|
4462
|
-
}
|
4463
|
-
createElement(data) {
|
4464
|
-
const paraElement = new ParagraphElement();
|
4465
|
-
const props = data.props;
|
4466
|
-
paraElement.props.indent = props?.indent ?? 0;
|
4467
|
-
paraElement.props.hanging = props?.hanging ?? 0;
|
4468
|
-
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
4469
|
-
paraElement.props.numberType = props?.numberType ?? -1;
|
4470
|
-
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
4471
|
-
paraElement.props.marginTop = props?.marginTop ?? 0;
|
4472
|
-
paraElement.props.marginBottom = props?.marginBottom ?? 0;
|
4473
|
-
paraElement.props.tabs = props?.tabs ?? [];
|
4474
|
-
return paraElement;
|
4475
|
-
}
|
4476
|
-
}
|
4477
|
-
/**
|
4478
|
-
* 段落行框
|
4479
|
-
*/
|
4480
|
-
class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
4481
|
-
baseTopLine = 0;
|
4482
|
-
baseBottomLine = 0;
|
4483
|
-
startX = 0;
|
4484
|
-
render(e) {
|
4485
|
-
}
|
4486
|
-
clone() {
|
4487
|
-
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
4488
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4489
|
-
cloneRender.baseTopLine = this.baseTopLine;
|
4490
|
-
cloneRender.baseBottomLine = this.baseBottomLine;
|
4491
|
-
for (let i = 0; i < this.length; i++) {
|
4492
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4493
|
-
}
|
4494
|
-
return cloneRender;
|
4495
|
-
}
|
4496
|
-
}
|
4497
|
-
|
4498
3749
|
class PSymbolElement extends LeafElement {
|
4499
3750
|
textProps;
|
4500
3751
|
defaultHeight = 14;
|
@@ -5660,8 +4911,8 @@ class TableFactory extends ElementFactory {
|
|
5660
4911
|
/**
|
5661
4912
|
* 行-表格渲染模式
|
5662
4913
|
*/
|
5663
|
-
function textLineRenderMode(
|
5664
|
-
const tb =
|
4914
|
+
function textLineRenderMode(tbRender, data) {
|
4915
|
+
const tb = tbRender;
|
5665
4916
|
const rows = [];
|
5666
4917
|
for (let i = 0; i < tb.length; i++) {
|
5667
4918
|
const row = tb.getChild(i);
|
@@ -8797,60 +8048,9 @@ class DataElementGroupElement extends InlineGroupInputElement {
|
|
8797
8048
|
class DataElementGroupRenderObject extends InlineGroupRenderObject {
|
8798
8049
|
render(e) {
|
8799
8050
|
this.paintPos = e.position;
|
8800
|
-
e.render.onRenderCompleted.subscribe(() => {
|
8801
|
-
|
8802
|
-
|
8803
|
-
const renders = [];
|
8804
|
-
const currParaRender = ElementUtil.getParentRender(this, ParagraphRenderObject);
|
8805
|
-
for (let i = 0; i < this.element.paintRenders.length; i++) {
|
8806
|
-
const paraRender = ElementUtil.getParentRender(this.element.paintRenders[i], ParagraphRenderObject);
|
8807
|
-
if (paraRender === currParaRender) {
|
8808
|
-
renders.push(this.element.paintRenders[i]);
|
8809
|
-
}
|
8810
|
-
}
|
8811
|
-
return renders;
|
8812
|
-
}
|
8813
|
-
paintDecorate(e) {
|
8814
|
-
const { render, docCtx: { viewOptions } } = e;
|
8815
|
-
const canPaint = this.element.isMouseenter || this.element.isFocused;
|
8816
|
-
if (canPaint && this.element.paintRenders.indexOf(this) === 0) {
|
8817
|
-
const currParaRenders = this.getCurrentParaGroupRenders();
|
8818
|
-
const verOffset = 3;
|
8819
|
-
if (currParaRenders.length > 1) {
|
8820
|
-
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
8821
|
-
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > this.paintPos.x) {
|
8822
|
-
const leftPoints = [];
|
8823
|
-
const rightPoints = [];
|
8824
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8825
|
-
const groupRender = currParaRenders[i];
|
8826
|
-
const groupRenderPos = groupRender.paintPos;
|
8827
|
-
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
8828
|
-
rightPoints.push({
|
8829
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8830
|
-
y: groupRenderPos.y - verOffset
|
8831
|
-
});
|
8832
|
-
leftPoints.push({
|
8833
|
-
x: groupRenderPos.x,
|
8834
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8835
|
-
});
|
8836
|
-
rightPoints.push({
|
8837
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8838
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8839
|
-
});
|
8840
|
-
}
|
8841
|
-
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
8842
|
-
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
8843
|
-
render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
|
8844
|
-
return;
|
8845
|
-
}
|
8846
|
-
}
|
8847
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8848
|
-
const currRen = currParaRenders[i];
|
8849
|
-
render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
|
8850
|
-
}
|
8851
|
-
}
|
8852
|
-
}
|
8853
|
-
endRender(ctx, position) {
|
8051
|
+
e.render.onRenderCompleted.subscribe(() => {
|
8052
|
+
drawDecorator(e, this);
|
8053
|
+
});
|
8854
8054
|
}
|
8855
8055
|
clone() {
|
8856
8056
|
const cloneRender = new DataElementGroupRenderObject(this.element);
|
@@ -11903,33 +11103,6 @@ class DynamicContextParser {
|
|
11903
11103
|
}
|
11904
11104
|
}
|
11905
11105
|
|
11906
|
-
/**
|
11907
|
-
* 文字行渲染模式
|
11908
|
-
用于医嘱打印模式
|
11909
|
-
*/
|
11910
|
-
function runTextLineRender(ele, data) {
|
11911
|
-
if (!data.options.textRowLineMode) {
|
11912
|
-
return;
|
11913
|
-
}
|
11914
|
-
if (ele instanceof TableElement) {
|
11915
|
-
textLineRenderMode(ele, data);
|
11916
|
-
remeasureParentRenders(ele.cacheRender);
|
11917
|
-
return;
|
11918
|
-
}
|
11919
|
-
if (ele instanceof BranchElement) {
|
11920
|
-
for (let i = 0; i < ele.length; i++) {
|
11921
|
-
runTextLineRender(ele.getChild(i), data);
|
11922
|
-
}
|
11923
|
-
}
|
11924
|
-
}
|
11925
|
-
function remeasureParentRenders(render) {
|
11926
|
-
if (!render) {
|
11927
|
-
return;
|
11928
|
-
}
|
11929
|
-
ElementUtil.remeasure(render);
|
11930
|
-
remeasureParentRenders(render.parent);
|
11931
|
-
}
|
11932
|
-
|
11933
11106
|
class TabElement extends LeafElement {
|
11934
11107
|
constructor() {
|
11935
11108
|
super('tab');
|
@@ -12499,7 +11672,6 @@ class DocumentArrange {
|
|
12499
11672
|
this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
|
12500
11673
|
const docRenders = this.arrangeDoc();
|
12501
11674
|
this.setMeasureCompletedModifyFlag(doc);
|
12502
|
-
runTextLineRender(doc, { options: this.options, renderCtx: this.renderCtx });
|
12503
11675
|
this.cacheDocRenders(docRenders);
|
12504
11676
|
return docRenders;
|
12505
11677
|
});
|
@@ -12671,12 +11843,20 @@ class DocumentArrange {
|
|
12671
11843
|
}
|
12672
11844
|
}
|
12673
11845
|
renders.forEach(item => ElementUtil.remeasure(item));
|
11846
|
+
this.processTableTextLineMode(element);
|
12674
11847
|
return renders.length > 1 ? renders : renders[0];
|
12675
11848
|
}
|
12676
11849
|
else {
|
12677
11850
|
throw new Error('未实现');
|
12678
11851
|
}
|
12679
11852
|
}
|
11853
|
+
processTableTextLineMode(ele) {
|
11854
|
+
if (this.options.textRowLineMode && ele instanceof TableElement && ele.cacheRender) {
|
11855
|
+
const cacheRender = ele.cacheRender;
|
11856
|
+
clearChildrenRenderCache(ele);
|
11857
|
+
textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
|
11858
|
+
}
|
11859
|
+
}
|
12680
11860
|
createRenderObject(element) {
|
12681
11861
|
return element.createRenderObject({
|
12682
11862
|
options: this.options,
|
@@ -13081,6 +12261,26 @@ class DocumentArrange {
|
|
13081
12261
|
}
|
13082
12262
|
}
|
13083
12263
|
|
12264
|
+
/**
|
12265
|
+
* 文字行渲染模式
|
12266
|
+
用于医嘱打印模式
|
12267
|
+
*/
|
12268
|
+
function runTextLineRender(ele, data) {
|
12269
|
+
if (!data.options.textRowLineMode) {
|
12270
|
+
return;
|
12271
|
+
}
|
12272
|
+
if (ele instanceof TableElement) {
|
12273
|
+
// textLineRenderMode(ele, data);
|
12274
|
+
// remeasureParentRenders(ele.cacheRender)
|
12275
|
+
return;
|
12276
|
+
}
|
12277
|
+
if (ele instanceof BranchElement) {
|
12278
|
+
for (let i = 0; i < ele.length; i++) {
|
12279
|
+
runTextLineRender(ele.getChild(i), data);
|
12280
|
+
}
|
12281
|
+
}
|
12282
|
+
}
|
12283
|
+
|
13084
12284
|
/**
|
13085
12285
|
* 测量阶段,生成Render-UI
|
13086
12286
|
*/
|
@@ -14373,6 +13573,7 @@ class ElementReader {
|
|
14373
13573
|
const type = data.type;
|
14374
13574
|
for (const factory of this.factories) {
|
14375
13575
|
if (factory.match(type)) {
|
13576
|
+
data.props = data.props ?? {};
|
14376
13577
|
const element = factory.createElement(data);
|
14377
13578
|
this.readExtendsProps(data, element);
|
14378
13579
|
const childArr = [];
|
@@ -18829,7 +18030,6 @@ class NodeEvent {
|
|
18829
18030
|
this.setActiveAppContext(() => this.onMousemoveHandler(evt));
|
18830
18031
|
});
|
18831
18032
|
canvas.addEventListener('mouseup', evt => {
|
18832
|
-
console.log('##松开了');
|
18833
18033
|
this.setActiveAppContext(() => this.onMouseupHandler(evt));
|
18834
18034
|
});
|
18835
18035
|
canvas.addEventListener('mouseleave', evt => {
|
@@ -18924,7 +18124,6 @@ class NodeEvent {
|
|
18924
18124
|
}
|
18925
18125
|
//按下鼠标并进行拖动时,mousemove在按下的元素上处理
|
18926
18126
|
if (this.appState.mousedown) {
|
18927
|
-
console.log("offsetY:", evt.offsetY);
|
18928
18127
|
if (this.appState.sourceNode && this.appState.sourceNode.parent) {
|
18929
18128
|
const currNodePos = getNodePosition(this.appState.sourceNode, { x: 0, y: 0 });
|
18930
18129
|
this.appState.pos = { x: evt.offsetX, y: evt.offsetY };
|
@@ -22162,5 +21361,5 @@ function removeDuplicatesEvent(events) {
|
|
22162
21361
|
return arr;
|
22163
21362
|
}
|
22164
21363
|
|
22165
|
-
export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CanvasTextEditor, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, DOMEventSource, DOMSubscription, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentImagesBaseLoader, DocumentImagesLoader, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, documentPrint, elementTypeEventHandler, fontMapFunc, fromEvent, getFocusTextSegment, invokeTypeHandler, isDate, objectToString, onTableContextmenu, onceTask$1 as onceTask, printDocOnContextmenu, printNodes, reactiveMap, runTextLineRender, setDataElementProps, setNotifyChangedCallback, targetMaps, textLineRenderMode, toRawType, toTypeString, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
|
21364
|
+
export { BlockContainerElement, BlockContainerRenderObject, BlockContentElement, BlockContentRenderObject, BlockLineRectRenderObject, BodyPartProps, BooleanEnum, BorderProps, BranchElement, BranchRenderObject, BreakElement, BreakFactory, BreakRenderObject, CanvasTextEditor, CheckBoxElement, CheckBoxFactory, CheckBoxProps, CheckBoxRenderObject, ColumnPatchUtil, CommContentBaseElement, CommContentBaseRenderObject, CommContentElement, CommContentProps, CommContentRenderObject, CommProps, CommentContentFactory, CommentElement, CommentFactory, CommentRenderObject, CommentsFactory, CommentsUtil, CommonUtil, CommsContainerElement, CommsContainerRenderObject, ContentMenuItem, ContextMenuElementEvent, DOMEventSource, DOMSubscription, DataDecorateElement, DataDecorateProps, DataDecorateRenderObject, DataEleBaseProps, DataEleBaseTextProps, DataEleCheckProps, DataEleDateProps, DataEleImageProps, DataEleListProps, DataEleMHProps, DataElementBarcode, DataElementBarcodeFactory, DataElementBarcodeProps, DataElementBarcodeRenderObject, DataElementBaseFactory, DataElementCheck, DataElementCheckFactory, DataElementCheckRenderObject, DataElementDate, DataElementDateFactory, DataElementDateRenderObject, DataElementGroupElement, DataElementGroupFactory, DataElementGroupProps, DataElementGroupRenderObject, DataElementImage, DataElementImgFactory, DataElementInlineGroup, DataElementLeaf, DataElementList, DataElementListFactory, DataElementListRenderObject, DataElementMH, DataElementMHFactory, DataElementRenderObject, DataElementText, DataElementTextFactory, DataElementTextRenderObject, DataImageRenderObject, DataRenderMH, DocMode, DocumentBodyElement, DocumentBodyFactory, DocumentBodyPartElement, DocumentBodyPartFactory, DocumentBodyPartRenderObject, DocumentBodyRenderObject, DocumentChange, DocumentCombine, DocumentComment, DocumentContainerRender, DocumentContext, DocumentCursor, DocumentElement, DocumentEvalFunc, DocumentEvent, DocumentFactory, DocumentFooterElement, DocumentFooterFactory, DocumentFooterRenderObject, DocumentHeaderElement, DocumentHeaderFactory, DocumentHeaderRenderObject, DocumentImagesBaseLoader, DocumentImagesLoader, DocumentInput, DocumentPaint, DocumentPrintOffscreen, DocumentPrintOffscreenBase, DocumentProps, DocumentRenderObject, DocumentSelection, DocumentTemplate, DropElementEvent, EditMode, EditorContext, Element, ElementEvent, ElementFactory, ElementPaint, ElementReader, ElementSerialize, ElementUtil, EventMap, EventSourceCore$1 as EventSourceCore, FillNullSpaceElement, FillNullSpaceRenderObject, GetTrackTipsEvent, GotCursorEvent, IDispose, INotifyPropertyChanged, InlineBlockContainer, InlineGroupElement, InlineGroupInputElement, InlineGroupRenderObject, InlineMuiltBlockLineRenderObject, IsInSideDataElement, IsInSideInlineGroupInputElement, KeyboradElementEvent, LeafElement, LeafRenderObject, LostCursorEvent, MarginProps, ModifyFlag$1 as ModifyFlag, MouseElementEvent, MousedownElementEvent, MuiltBlockLineRenderObject, OnceSubject, PSymbolElement, PSymbolRenderObject, PaddingProps, PageOptions, PaintContent, ParagraphElement, ParagraphFactory, ParagraphLineRectRenderObject, ParagraphNumberType, ParagraphProps, ParagraphRenderObject, PictureElement, PictureFactory, PictureProps, PictureRenderObject, RadioBoxElement, RadioBoxFactory, RadioBoxProps, RadioBoxRenderObject, RangeUtil, Rect, RenderContext, RenderObject, RenderObjectType, ResizeLeafRenderObject, RunElementFactory, SelectionOverlays, SelectionRange, SelectionState, Subject$1 as Subject, SubjectSubscription$1 as SubjectSubscription, Subscription$1 as Subscription, TableCellElement, TableCellFactory, TableCellProps, TableCellRenderObject, TableElement, TableFactory, TableProps, TableRenderObject, TableRowElement, TableRowFactory, TableRowProps, TableRowRenderObject, TableSplitCell, TableUtil, TextGroupElement, TextGroupFactory, TextGroupRenderObject, TextProps, TrackRunElement, TrackRunProps, TrackRunRenderObject, TrackRunTypeEnum, ValidateCondition, ValidateElement, ValidateProps, ValidateRenderObject, ViewOptions, clearChildrenRenderCache, createPrintTemplate, defaultParaHanging, deleteCurrentParagraph, documentPrint, drawDecorator, elementTypeEventHandler, fontMapFunc, fromEvent, getCalleeName, getFocusTextSegment, invokeTypeHandler, isDate, objectToString, onTableContextmenu, onceTask$1 as onceTask, parser, printDocOnContextmenu, printNodes, reactiveMap, runTextLineRender, setDataElementProps, setNotifyChangedCallback, targetMaps, textLineRenderMode, toRawType, toTypeString, validateDataEle, validateDataEleRenderObj, validateInlineInputRenderObj, watchChanged };
|
22166
21365
|
//# sourceMappingURL=index.js.map
|