@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-cjs.js
CHANGED
@@ -6,6 +6,7 @@ var nanoid = require('nanoid');
|
|
6
6
|
var moment = require('moment');
|
7
7
|
var acor = require('acorn');
|
8
8
|
var astring = require('astring');
|
9
|
+
var estraverse = require('estraverse');
|
9
10
|
var bwipjs = require('bwip-js');
|
10
11
|
|
11
12
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
@@ -30,6 +31,7 @@ function _interopNamespace(e) {
|
|
30
31
|
|
31
32
|
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
32
33
|
var acor__namespace = /*#__PURE__*/_interopNamespace(acor);
|
34
|
+
var estraverse__namespace = /*#__PURE__*/_interopNamespace(estraverse);
|
33
35
|
var bwipjs__default = /*#__PURE__*/_interopDefaultLegacy(bwipjs);
|
34
36
|
|
35
37
|
/**
|
@@ -2708,814 +2710,9 @@ class DataDecorateRenderObject extends LeafRenderObject {
|
|
2708
2710
|
}
|
2709
2711
|
}
|
2710
2712
|
|
2711
|
-
/*
|
2712
|
-
Copyright (C) 2012-2013 Yusuke Suzuki <utatane.tea@gmail.com>
|
2713
|
-
Copyright (C) 2012 Ariya Hidayat <ariya.hidayat@gmail.com>
|
2714
|
-
|
2715
|
-
Redistribution and use in source and binary forms, with or without
|
2716
|
-
modification, are permitted provided that the following conditions are met:
|
2717
|
-
|
2718
|
-
* Redistributions of source code must retain the above copyright
|
2719
|
-
notice, this list of conditions and the following disclaimer.
|
2720
|
-
* Redistributions in binary form must reproduce the above copyright
|
2721
|
-
notice, this list of conditions and the following disclaimer in the
|
2722
|
-
documentation and/or other materials provided with the distribution.
|
2723
|
-
|
2724
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
2725
|
-
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
2726
|
-
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
2727
|
-
ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
|
2728
|
-
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
2729
|
-
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
2730
|
-
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
2731
|
-
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
2732
|
-
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
2733
|
-
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2734
|
-
*/
|
2735
|
-
/*jslint vars:false, bitwise:true*/
|
2736
|
-
/*jshint indent:4*/
|
2737
|
-
/*global exports:true*/
|
2738
|
-
(function clone(exports) {
|
2739
|
-
|
2740
|
-
var Syntax,
|
2741
|
-
VisitorOption,
|
2742
|
-
VisitorKeys,
|
2743
|
-
BREAK,
|
2744
|
-
SKIP,
|
2745
|
-
REMOVE;
|
2746
|
-
|
2747
|
-
function deepCopy(obj) {
|
2748
|
-
var ret = {}, key, val;
|
2749
|
-
for (key in obj) {
|
2750
|
-
if (obj.hasOwnProperty(key)) {
|
2751
|
-
val = obj[key];
|
2752
|
-
if (typeof val === 'object' && val !== null) {
|
2753
|
-
ret[key] = deepCopy(val);
|
2754
|
-
} else {
|
2755
|
-
ret[key] = val;
|
2756
|
-
}
|
2757
|
-
}
|
2758
|
-
}
|
2759
|
-
return ret;
|
2760
|
-
}
|
2761
|
-
|
2762
|
-
// based on LLVM libc++ upper_bound / lower_bound
|
2763
|
-
// MIT License
|
2764
|
-
|
2765
|
-
function upperBound(array, func) {
|
2766
|
-
var diff, len, i, current;
|
2767
|
-
|
2768
|
-
len = array.length;
|
2769
|
-
i = 0;
|
2770
|
-
|
2771
|
-
while (len) {
|
2772
|
-
diff = len >>> 1;
|
2773
|
-
current = i + diff;
|
2774
|
-
if (func(array[current])) {
|
2775
|
-
len = diff;
|
2776
|
-
} else {
|
2777
|
-
i = current + 1;
|
2778
|
-
len -= diff + 1;
|
2779
|
-
}
|
2780
|
-
}
|
2781
|
-
return i;
|
2782
|
-
}
|
2783
|
-
|
2784
|
-
Syntax = {
|
2785
|
-
AssignmentExpression: 'AssignmentExpression',
|
2786
|
-
AssignmentPattern: 'AssignmentPattern',
|
2787
|
-
ArrayExpression: 'ArrayExpression',
|
2788
|
-
ArrayPattern: 'ArrayPattern',
|
2789
|
-
ArrowFunctionExpression: 'ArrowFunctionExpression',
|
2790
|
-
AwaitExpression: 'AwaitExpression', // CAUTION: It's deferred to ES7.
|
2791
|
-
BlockStatement: 'BlockStatement',
|
2792
|
-
BinaryExpression: 'BinaryExpression',
|
2793
|
-
BreakStatement: 'BreakStatement',
|
2794
|
-
CallExpression: 'CallExpression',
|
2795
|
-
CatchClause: 'CatchClause',
|
2796
|
-
ChainExpression: 'ChainExpression',
|
2797
|
-
ClassBody: 'ClassBody',
|
2798
|
-
ClassDeclaration: 'ClassDeclaration',
|
2799
|
-
ClassExpression: 'ClassExpression',
|
2800
|
-
ComprehensionBlock: 'ComprehensionBlock', // CAUTION: It's deferred to ES7.
|
2801
|
-
ComprehensionExpression: 'ComprehensionExpression', // CAUTION: It's deferred to ES7.
|
2802
|
-
ConditionalExpression: 'ConditionalExpression',
|
2803
|
-
ContinueStatement: 'ContinueStatement',
|
2804
|
-
DebuggerStatement: 'DebuggerStatement',
|
2805
|
-
DirectiveStatement: 'DirectiveStatement',
|
2806
|
-
DoWhileStatement: 'DoWhileStatement',
|
2807
|
-
EmptyStatement: 'EmptyStatement',
|
2808
|
-
ExportAllDeclaration: 'ExportAllDeclaration',
|
2809
|
-
ExportDefaultDeclaration: 'ExportDefaultDeclaration',
|
2810
|
-
ExportNamedDeclaration: 'ExportNamedDeclaration',
|
2811
|
-
ExportSpecifier: 'ExportSpecifier',
|
2812
|
-
ExpressionStatement: 'ExpressionStatement',
|
2813
|
-
ForStatement: 'ForStatement',
|
2814
|
-
ForInStatement: 'ForInStatement',
|
2815
|
-
ForOfStatement: 'ForOfStatement',
|
2816
|
-
FunctionDeclaration: 'FunctionDeclaration',
|
2817
|
-
FunctionExpression: 'FunctionExpression',
|
2818
|
-
GeneratorExpression: 'GeneratorExpression', // CAUTION: It's deferred to ES7.
|
2819
|
-
Identifier: 'Identifier',
|
2820
|
-
IfStatement: 'IfStatement',
|
2821
|
-
ImportExpression: 'ImportExpression',
|
2822
|
-
ImportDeclaration: 'ImportDeclaration',
|
2823
|
-
ImportDefaultSpecifier: 'ImportDefaultSpecifier',
|
2824
|
-
ImportNamespaceSpecifier: 'ImportNamespaceSpecifier',
|
2825
|
-
ImportSpecifier: 'ImportSpecifier',
|
2826
|
-
Literal: 'Literal',
|
2827
|
-
LabeledStatement: 'LabeledStatement',
|
2828
|
-
LogicalExpression: 'LogicalExpression',
|
2829
|
-
MemberExpression: 'MemberExpression',
|
2830
|
-
MetaProperty: 'MetaProperty',
|
2831
|
-
MethodDefinition: 'MethodDefinition',
|
2832
|
-
ModuleSpecifier: 'ModuleSpecifier',
|
2833
|
-
NewExpression: 'NewExpression',
|
2834
|
-
ObjectExpression: 'ObjectExpression',
|
2835
|
-
ObjectPattern: 'ObjectPattern',
|
2836
|
-
PrivateIdentifier: 'PrivateIdentifier',
|
2837
|
-
Program: 'Program',
|
2838
|
-
Property: 'Property',
|
2839
|
-
PropertyDefinition: 'PropertyDefinition',
|
2840
|
-
RestElement: 'RestElement',
|
2841
|
-
ReturnStatement: 'ReturnStatement',
|
2842
|
-
SequenceExpression: 'SequenceExpression',
|
2843
|
-
SpreadElement: 'SpreadElement',
|
2844
|
-
Super: 'Super',
|
2845
|
-
SwitchStatement: 'SwitchStatement',
|
2846
|
-
SwitchCase: 'SwitchCase',
|
2847
|
-
TaggedTemplateExpression: 'TaggedTemplateExpression',
|
2848
|
-
TemplateElement: 'TemplateElement',
|
2849
|
-
TemplateLiteral: 'TemplateLiteral',
|
2850
|
-
ThisExpression: 'ThisExpression',
|
2851
|
-
ThrowStatement: 'ThrowStatement',
|
2852
|
-
TryStatement: 'TryStatement',
|
2853
|
-
UnaryExpression: 'UnaryExpression',
|
2854
|
-
UpdateExpression: 'UpdateExpression',
|
2855
|
-
VariableDeclaration: 'VariableDeclaration',
|
2856
|
-
VariableDeclarator: 'VariableDeclarator',
|
2857
|
-
WhileStatement: 'WhileStatement',
|
2858
|
-
WithStatement: 'WithStatement',
|
2859
|
-
YieldExpression: 'YieldExpression'
|
2860
|
-
};
|
2861
|
-
|
2862
|
-
VisitorKeys = {
|
2863
|
-
AssignmentExpression: ['left', 'right'],
|
2864
|
-
AssignmentPattern: ['left', 'right'],
|
2865
|
-
ArrayExpression: ['elements'],
|
2866
|
-
ArrayPattern: ['elements'],
|
2867
|
-
ArrowFunctionExpression: ['params', 'body'],
|
2868
|
-
AwaitExpression: ['argument'], // CAUTION: It's deferred to ES7.
|
2869
|
-
BlockStatement: ['body'],
|
2870
|
-
BinaryExpression: ['left', 'right'],
|
2871
|
-
BreakStatement: ['label'],
|
2872
|
-
CallExpression: ['callee', 'arguments'],
|
2873
|
-
CatchClause: ['param', 'body'],
|
2874
|
-
ChainExpression: ['expression'],
|
2875
|
-
ClassBody: ['body'],
|
2876
|
-
ClassDeclaration: ['id', 'superClass', 'body'],
|
2877
|
-
ClassExpression: ['id', 'superClass', 'body'],
|
2878
|
-
ComprehensionBlock: ['left', 'right'], // CAUTION: It's deferred to ES7.
|
2879
|
-
ComprehensionExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
|
2880
|
-
ConditionalExpression: ['test', 'consequent', 'alternate'],
|
2881
|
-
ContinueStatement: ['label'],
|
2882
|
-
DebuggerStatement: [],
|
2883
|
-
DirectiveStatement: [],
|
2884
|
-
DoWhileStatement: ['body', 'test'],
|
2885
|
-
EmptyStatement: [],
|
2886
|
-
ExportAllDeclaration: ['source'],
|
2887
|
-
ExportDefaultDeclaration: ['declaration'],
|
2888
|
-
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
|
2889
|
-
ExportSpecifier: ['exported', 'local'],
|
2890
|
-
ExpressionStatement: ['expression'],
|
2891
|
-
ForStatement: ['init', 'test', 'update', 'body'],
|
2892
|
-
ForInStatement: ['left', 'right', 'body'],
|
2893
|
-
ForOfStatement: ['left', 'right', 'body'],
|
2894
|
-
FunctionDeclaration: ['id', 'params', 'body'],
|
2895
|
-
FunctionExpression: ['id', 'params', 'body'],
|
2896
|
-
GeneratorExpression: ['blocks', 'filter', 'body'], // CAUTION: It's deferred to ES7.
|
2897
|
-
Identifier: [],
|
2898
|
-
IfStatement: ['test', 'consequent', 'alternate'],
|
2899
|
-
ImportExpression: ['source'],
|
2900
|
-
ImportDeclaration: ['specifiers', 'source'],
|
2901
|
-
ImportDefaultSpecifier: ['local'],
|
2902
|
-
ImportNamespaceSpecifier: ['local'],
|
2903
|
-
ImportSpecifier: ['imported', 'local'],
|
2904
|
-
Literal: [],
|
2905
|
-
LabeledStatement: ['label', 'body'],
|
2906
|
-
LogicalExpression: ['left', 'right'],
|
2907
|
-
MemberExpression: ['object', 'property'],
|
2908
|
-
MetaProperty: ['meta', 'property'],
|
2909
|
-
MethodDefinition: ['key', 'value'],
|
2910
|
-
ModuleSpecifier: [],
|
2911
|
-
NewExpression: ['callee', 'arguments'],
|
2912
|
-
ObjectExpression: ['properties'],
|
2913
|
-
ObjectPattern: ['properties'],
|
2914
|
-
PrivateIdentifier: [],
|
2915
|
-
Program: ['body'],
|
2916
|
-
Property: ['key', 'value'],
|
2917
|
-
PropertyDefinition: ['key', 'value'],
|
2918
|
-
RestElement: [ 'argument' ],
|
2919
|
-
ReturnStatement: ['argument'],
|
2920
|
-
SequenceExpression: ['expressions'],
|
2921
|
-
SpreadElement: ['argument'],
|
2922
|
-
Super: [],
|
2923
|
-
SwitchStatement: ['discriminant', 'cases'],
|
2924
|
-
SwitchCase: ['test', 'consequent'],
|
2925
|
-
TaggedTemplateExpression: ['tag', 'quasi'],
|
2926
|
-
TemplateElement: [],
|
2927
|
-
TemplateLiteral: ['quasis', 'expressions'],
|
2928
|
-
ThisExpression: [],
|
2929
|
-
ThrowStatement: ['argument'],
|
2930
|
-
TryStatement: ['block', 'handler', 'finalizer'],
|
2931
|
-
UnaryExpression: ['argument'],
|
2932
|
-
UpdateExpression: ['argument'],
|
2933
|
-
VariableDeclaration: ['declarations'],
|
2934
|
-
VariableDeclarator: ['id', 'init'],
|
2935
|
-
WhileStatement: ['test', 'body'],
|
2936
|
-
WithStatement: ['object', 'body'],
|
2937
|
-
YieldExpression: ['argument']
|
2938
|
-
};
|
2939
|
-
|
2940
|
-
// unique id
|
2941
|
-
BREAK = {};
|
2942
|
-
SKIP = {};
|
2943
|
-
REMOVE = {};
|
2944
|
-
|
2945
|
-
VisitorOption = {
|
2946
|
-
Break: BREAK,
|
2947
|
-
Skip: SKIP,
|
2948
|
-
Remove: REMOVE
|
2949
|
-
};
|
2950
|
-
|
2951
|
-
function Reference(parent, key) {
|
2952
|
-
this.parent = parent;
|
2953
|
-
this.key = key;
|
2954
|
-
}
|
2955
|
-
|
2956
|
-
Reference.prototype.replace = function replace(node) {
|
2957
|
-
this.parent[this.key] = node;
|
2958
|
-
};
|
2959
|
-
|
2960
|
-
Reference.prototype.remove = function remove() {
|
2961
|
-
if (Array.isArray(this.parent)) {
|
2962
|
-
this.parent.splice(this.key, 1);
|
2963
|
-
return true;
|
2964
|
-
} else {
|
2965
|
-
this.replace(null);
|
2966
|
-
return false;
|
2967
|
-
}
|
2968
|
-
};
|
2969
|
-
|
2970
|
-
function Element(node, path, wrap, ref) {
|
2971
|
-
this.node = node;
|
2972
|
-
this.path = path;
|
2973
|
-
this.wrap = wrap;
|
2974
|
-
this.ref = ref;
|
2975
|
-
}
|
2976
|
-
|
2977
|
-
function Controller() { }
|
2978
|
-
|
2979
|
-
// API:
|
2980
|
-
// return property path array from root to current node
|
2981
|
-
Controller.prototype.path = function path() {
|
2982
|
-
var i, iz, j, jz, result, element;
|
2983
|
-
|
2984
|
-
function addToPath(result, path) {
|
2985
|
-
if (Array.isArray(path)) {
|
2986
|
-
for (j = 0, jz = path.length; j < jz; ++j) {
|
2987
|
-
result.push(path[j]);
|
2988
|
-
}
|
2989
|
-
} else {
|
2990
|
-
result.push(path);
|
2991
|
-
}
|
2992
|
-
}
|
2993
|
-
|
2994
|
-
// root node
|
2995
|
-
if (!this.__current.path) {
|
2996
|
-
return null;
|
2997
|
-
}
|
2998
|
-
|
2999
|
-
// first node is sentinel, second node is root element
|
3000
|
-
result = [];
|
3001
|
-
for (i = 2, iz = this.__leavelist.length; i < iz; ++i) {
|
3002
|
-
element = this.__leavelist[i];
|
3003
|
-
addToPath(result, element.path);
|
3004
|
-
}
|
3005
|
-
addToPath(result, this.__current.path);
|
3006
|
-
return result;
|
3007
|
-
};
|
3008
|
-
|
3009
|
-
// API:
|
3010
|
-
// return type of current node
|
3011
|
-
Controller.prototype.type = function () {
|
3012
|
-
var node = this.current();
|
3013
|
-
return node.type || this.__current.wrap;
|
3014
|
-
};
|
3015
|
-
|
3016
|
-
// API:
|
3017
|
-
// return array of parent elements
|
3018
|
-
Controller.prototype.parents = function parents() {
|
3019
|
-
var i, iz, result;
|
3020
|
-
|
3021
|
-
// first node is sentinel
|
3022
|
-
result = [];
|
3023
|
-
for (i = 1, iz = this.__leavelist.length; i < iz; ++i) {
|
3024
|
-
result.push(this.__leavelist[i].node);
|
3025
|
-
}
|
3026
|
-
|
3027
|
-
return result;
|
3028
|
-
};
|
3029
|
-
|
3030
|
-
// API:
|
3031
|
-
// return current node
|
3032
|
-
Controller.prototype.current = function current() {
|
3033
|
-
return this.__current.node;
|
3034
|
-
};
|
3035
|
-
|
3036
|
-
Controller.prototype.__execute = function __execute(callback, element) {
|
3037
|
-
var previous, result;
|
3038
|
-
|
3039
|
-
result = undefined;
|
3040
|
-
|
3041
|
-
previous = this.__current;
|
3042
|
-
this.__current = element;
|
3043
|
-
this.__state = null;
|
3044
|
-
if (callback) {
|
3045
|
-
result = callback.call(this, element.node, this.__leavelist[this.__leavelist.length - 1].node);
|
3046
|
-
}
|
3047
|
-
this.__current = previous;
|
3048
|
-
|
3049
|
-
return result;
|
3050
|
-
};
|
3051
|
-
|
3052
|
-
// API:
|
3053
|
-
// notify control skip / break
|
3054
|
-
Controller.prototype.notify = function notify(flag) {
|
3055
|
-
this.__state = flag;
|
3056
|
-
};
|
3057
|
-
|
3058
|
-
// API:
|
3059
|
-
// skip child nodes of current node
|
3060
|
-
Controller.prototype.skip = function () {
|
3061
|
-
this.notify(SKIP);
|
3062
|
-
};
|
3063
|
-
|
3064
|
-
// API:
|
3065
|
-
// break traversals
|
3066
|
-
Controller.prototype['break'] = function () {
|
3067
|
-
this.notify(BREAK);
|
3068
|
-
};
|
3069
|
-
|
3070
|
-
// API:
|
3071
|
-
// remove node
|
3072
|
-
Controller.prototype.remove = function () {
|
3073
|
-
this.notify(REMOVE);
|
3074
|
-
};
|
3075
|
-
|
3076
|
-
Controller.prototype.__initialize = function(root, visitor) {
|
3077
|
-
this.visitor = visitor;
|
3078
|
-
this.root = root;
|
3079
|
-
this.__worklist = [];
|
3080
|
-
this.__leavelist = [];
|
3081
|
-
this.__current = null;
|
3082
|
-
this.__state = null;
|
3083
|
-
this.__fallback = null;
|
3084
|
-
if (visitor.fallback === 'iteration') {
|
3085
|
-
this.__fallback = Object.keys;
|
3086
|
-
} else if (typeof visitor.fallback === 'function') {
|
3087
|
-
this.__fallback = visitor.fallback;
|
3088
|
-
}
|
3089
|
-
|
3090
|
-
this.__keys = VisitorKeys;
|
3091
|
-
if (visitor.keys) {
|
3092
|
-
this.__keys = Object.assign(Object.create(this.__keys), visitor.keys);
|
3093
|
-
}
|
3094
|
-
};
|
3095
|
-
|
3096
|
-
function isNode(node) {
|
3097
|
-
if (node == null) {
|
3098
|
-
return false;
|
3099
|
-
}
|
3100
|
-
return typeof node === 'object' && typeof node.type === 'string';
|
3101
|
-
}
|
3102
|
-
|
3103
|
-
function isProperty(nodeType, key) {
|
3104
|
-
return (nodeType === Syntax.ObjectExpression || nodeType === Syntax.ObjectPattern) && 'properties' === key;
|
3105
|
-
}
|
3106
|
-
|
3107
|
-
function candidateExistsInLeaveList(leavelist, candidate) {
|
3108
|
-
for (var i = leavelist.length - 1; i >= 0; --i) {
|
3109
|
-
if (leavelist[i].node === candidate) {
|
3110
|
-
return true;
|
3111
|
-
}
|
3112
|
-
}
|
3113
|
-
return false;
|
3114
|
-
}
|
3115
|
-
|
3116
|
-
Controller.prototype.traverse = function traverse(root, visitor) {
|
3117
|
-
var worklist,
|
3118
|
-
leavelist,
|
3119
|
-
element,
|
3120
|
-
node,
|
3121
|
-
nodeType,
|
3122
|
-
ret,
|
3123
|
-
key,
|
3124
|
-
current,
|
3125
|
-
current2,
|
3126
|
-
candidates,
|
3127
|
-
candidate,
|
3128
|
-
sentinel;
|
3129
|
-
|
3130
|
-
this.__initialize(root, visitor);
|
3131
|
-
|
3132
|
-
sentinel = {};
|
3133
|
-
|
3134
|
-
// reference
|
3135
|
-
worklist = this.__worklist;
|
3136
|
-
leavelist = this.__leavelist;
|
3137
|
-
|
3138
|
-
// initialize
|
3139
|
-
worklist.push(new Element(root, null, null, null));
|
3140
|
-
leavelist.push(new Element(null, null, null, null));
|
3141
|
-
|
3142
|
-
while (worklist.length) {
|
3143
|
-
element = worklist.pop();
|
3144
|
-
|
3145
|
-
if (element === sentinel) {
|
3146
|
-
element = leavelist.pop();
|
3147
|
-
|
3148
|
-
ret = this.__execute(visitor.leave, element);
|
3149
|
-
|
3150
|
-
if (this.__state === BREAK || ret === BREAK) {
|
3151
|
-
return;
|
3152
|
-
}
|
3153
|
-
continue;
|
3154
|
-
}
|
3155
|
-
|
3156
|
-
if (element.node) {
|
3157
|
-
|
3158
|
-
ret = this.__execute(visitor.enter, element);
|
3159
|
-
|
3160
|
-
if (this.__state === BREAK || ret === BREAK) {
|
3161
|
-
return;
|
3162
|
-
}
|
3163
|
-
|
3164
|
-
worklist.push(sentinel);
|
3165
|
-
leavelist.push(element);
|
3166
|
-
|
3167
|
-
if (this.__state === SKIP || ret === SKIP) {
|
3168
|
-
continue;
|
3169
|
-
}
|
3170
|
-
|
3171
|
-
node = element.node;
|
3172
|
-
nodeType = node.type || element.wrap;
|
3173
|
-
candidates = this.__keys[nodeType];
|
3174
|
-
if (!candidates) {
|
3175
|
-
if (this.__fallback) {
|
3176
|
-
candidates = this.__fallback(node);
|
3177
|
-
} else {
|
3178
|
-
throw new Error('Unknown node type ' + nodeType + '.');
|
3179
|
-
}
|
3180
|
-
}
|
3181
|
-
|
3182
|
-
current = candidates.length;
|
3183
|
-
while ((current -= 1) >= 0) {
|
3184
|
-
key = candidates[current];
|
3185
|
-
candidate = node[key];
|
3186
|
-
if (!candidate) {
|
3187
|
-
continue;
|
3188
|
-
}
|
3189
|
-
|
3190
|
-
if (Array.isArray(candidate)) {
|
3191
|
-
current2 = candidate.length;
|
3192
|
-
while ((current2 -= 1) >= 0) {
|
3193
|
-
if (!candidate[current2]) {
|
3194
|
-
continue;
|
3195
|
-
}
|
3196
|
-
|
3197
|
-
if (candidateExistsInLeaveList(leavelist, candidate[current2])) {
|
3198
|
-
continue;
|
3199
|
-
}
|
3200
|
-
|
3201
|
-
if (isProperty(nodeType, candidates[current])) {
|
3202
|
-
element = new Element(candidate[current2], [key, current2], 'Property', null);
|
3203
|
-
} else if (isNode(candidate[current2])) {
|
3204
|
-
element = new Element(candidate[current2], [key, current2], null, null);
|
3205
|
-
} else {
|
3206
|
-
continue;
|
3207
|
-
}
|
3208
|
-
worklist.push(element);
|
3209
|
-
}
|
3210
|
-
} else if (isNode(candidate)) {
|
3211
|
-
if (candidateExistsInLeaveList(leavelist, candidate)) {
|
3212
|
-
continue;
|
3213
|
-
}
|
3214
|
-
|
3215
|
-
worklist.push(new Element(candidate, key, null, null));
|
3216
|
-
}
|
3217
|
-
}
|
3218
|
-
}
|
3219
|
-
}
|
3220
|
-
};
|
3221
|
-
|
3222
|
-
Controller.prototype.replace = function replace(root, visitor) {
|
3223
|
-
var worklist,
|
3224
|
-
leavelist,
|
3225
|
-
node,
|
3226
|
-
nodeType,
|
3227
|
-
target,
|
3228
|
-
element,
|
3229
|
-
current,
|
3230
|
-
current2,
|
3231
|
-
candidates,
|
3232
|
-
candidate,
|
3233
|
-
sentinel,
|
3234
|
-
outer,
|
3235
|
-
key;
|
3236
|
-
|
3237
|
-
function removeElem(element) {
|
3238
|
-
var i,
|
3239
|
-
key,
|
3240
|
-
nextElem,
|
3241
|
-
parent;
|
3242
|
-
|
3243
|
-
if (element.ref.remove()) {
|
3244
|
-
// When the reference is an element of an array.
|
3245
|
-
key = element.ref.key;
|
3246
|
-
parent = element.ref.parent;
|
3247
|
-
|
3248
|
-
// If removed from array, then decrease following items' keys.
|
3249
|
-
i = worklist.length;
|
3250
|
-
while (i--) {
|
3251
|
-
nextElem = worklist[i];
|
3252
|
-
if (nextElem.ref && nextElem.ref.parent === parent) {
|
3253
|
-
if (nextElem.ref.key < key) {
|
3254
|
-
break;
|
3255
|
-
}
|
3256
|
-
--nextElem.ref.key;
|
3257
|
-
}
|
3258
|
-
}
|
3259
|
-
}
|
3260
|
-
}
|
3261
|
-
|
3262
|
-
this.__initialize(root, visitor);
|
3263
|
-
|
3264
|
-
sentinel = {};
|
3265
|
-
|
3266
|
-
// reference
|
3267
|
-
worklist = this.__worklist;
|
3268
|
-
leavelist = this.__leavelist;
|
3269
|
-
|
3270
|
-
// initialize
|
3271
|
-
outer = {
|
3272
|
-
root: root
|
3273
|
-
};
|
3274
|
-
element = new Element(root, null, null, new Reference(outer, 'root'));
|
3275
|
-
worklist.push(element);
|
3276
|
-
leavelist.push(element);
|
3277
|
-
|
3278
|
-
while (worklist.length) {
|
3279
|
-
element = worklist.pop();
|
3280
|
-
|
3281
|
-
if (element === sentinel) {
|
3282
|
-
element = leavelist.pop();
|
3283
|
-
|
3284
|
-
target = this.__execute(visitor.leave, element);
|
3285
|
-
|
3286
|
-
// node may be replaced with null,
|
3287
|
-
// so distinguish between undefined and null in this place
|
3288
|
-
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
|
3289
|
-
// replace
|
3290
|
-
element.ref.replace(target);
|
3291
|
-
}
|
3292
|
-
|
3293
|
-
if (this.__state === REMOVE || target === REMOVE) {
|
3294
|
-
removeElem(element);
|
3295
|
-
}
|
3296
|
-
|
3297
|
-
if (this.__state === BREAK || target === BREAK) {
|
3298
|
-
return outer.root;
|
3299
|
-
}
|
3300
|
-
continue;
|
3301
|
-
}
|
3302
|
-
|
3303
|
-
target = this.__execute(visitor.enter, element);
|
3304
|
-
|
3305
|
-
// node may be replaced with null,
|
3306
|
-
// so distinguish between undefined and null in this place
|
3307
|
-
if (target !== undefined && target !== BREAK && target !== SKIP && target !== REMOVE) {
|
3308
|
-
// replace
|
3309
|
-
element.ref.replace(target);
|
3310
|
-
element.node = target;
|
3311
|
-
}
|
3312
|
-
|
3313
|
-
if (this.__state === REMOVE || target === REMOVE) {
|
3314
|
-
removeElem(element);
|
3315
|
-
element.node = null;
|
3316
|
-
}
|
3317
|
-
|
3318
|
-
if (this.__state === BREAK || target === BREAK) {
|
3319
|
-
return outer.root;
|
3320
|
-
}
|
3321
|
-
|
3322
|
-
// node may be null
|
3323
|
-
node = element.node;
|
3324
|
-
if (!node) {
|
3325
|
-
continue;
|
3326
|
-
}
|
3327
|
-
|
3328
|
-
worklist.push(sentinel);
|
3329
|
-
leavelist.push(element);
|
3330
|
-
|
3331
|
-
if (this.__state === SKIP || target === SKIP) {
|
3332
|
-
continue;
|
3333
|
-
}
|
3334
|
-
|
3335
|
-
nodeType = node.type || element.wrap;
|
3336
|
-
candidates = this.__keys[nodeType];
|
3337
|
-
if (!candidates) {
|
3338
|
-
if (this.__fallback) {
|
3339
|
-
candidates = this.__fallback(node);
|
3340
|
-
} else {
|
3341
|
-
throw new Error('Unknown node type ' + nodeType + '.');
|
3342
|
-
}
|
3343
|
-
}
|
3344
|
-
|
3345
|
-
current = candidates.length;
|
3346
|
-
while ((current -= 1) >= 0) {
|
3347
|
-
key = candidates[current];
|
3348
|
-
candidate = node[key];
|
3349
|
-
if (!candidate) {
|
3350
|
-
continue;
|
3351
|
-
}
|
3352
|
-
|
3353
|
-
if (Array.isArray(candidate)) {
|
3354
|
-
current2 = candidate.length;
|
3355
|
-
while ((current2 -= 1) >= 0) {
|
3356
|
-
if (!candidate[current2]) {
|
3357
|
-
continue;
|
3358
|
-
}
|
3359
|
-
if (isProperty(nodeType, candidates[current])) {
|
3360
|
-
element = new Element(candidate[current2], [key, current2], 'Property', new Reference(candidate, current2));
|
3361
|
-
} else if (isNode(candidate[current2])) {
|
3362
|
-
element = new Element(candidate[current2], [key, current2], null, new Reference(candidate, current2));
|
3363
|
-
} else {
|
3364
|
-
continue;
|
3365
|
-
}
|
3366
|
-
worklist.push(element);
|
3367
|
-
}
|
3368
|
-
} else if (isNode(candidate)) {
|
3369
|
-
worklist.push(new Element(candidate, key, null, new Reference(node, key)));
|
3370
|
-
}
|
3371
|
-
}
|
3372
|
-
}
|
3373
|
-
|
3374
|
-
return outer.root;
|
3375
|
-
};
|
3376
|
-
|
3377
|
-
function traverse(root, visitor) {
|
3378
|
-
var controller = new Controller();
|
3379
|
-
return controller.traverse(root, visitor);
|
3380
|
-
}
|
3381
|
-
|
3382
|
-
function replace(root, visitor) {
|
3383
|
-
var controller = new Controller();
|
3384
|
-
return controller.replace(root, visitor);
|
3385
|
-
}
|
3386
|
-
|
3387
|
-
function extendCommentRange(comment, tokens) {
|
3388
|
-
var target;
|
3389
|
-
|
3390
|
-
target = upperBound(tokens, function search(token) {
|
3391
|
-
return token.range[0] > comment.range[0];
|
3392
|
-
});
|
3393
|
-
|
3394
|
-
comment.extendedRange = [comment.range[0], comment.range[1]];
|
3395
|
-
|
3396
|
-
if (target !== tokens.length) {
|
3397
|
-
comment.extendedRange[1] = tokens[target].range[0];
|
3398
|
-
}
|
3399
|
-
|
3400
|
-
target -= 1;
|
3401
|
-
if (target >= 0) {
|
3402
|
-
comment.extendedRange[0] = tokens[target].range[1];
|
3403
|
-
}
|
3404
|
-
|
3405
|
-
return comment;
|
3406
|
-
}
|
3407
|
-
|
3408
|
-
function attachComments(tree, providedComments, tokens) {
|
3409
|
-
// At first, we should calculate extended comment ranges.
|
3410
|
-
var comments = [], comment, len, i, cursor;
|
3411
|
-
|
3412
|
-
if (!tree.range) {
|
3413
|
-
throw new Error('attachComments needs range information');
|
3414
|
-
}
|
3415
|
-
|
3416
|
-
// tokens array is empty, we attach comments to tree as 'leadingComments'
|
3417
|
-
if (!tokens.length) {
|
3418
|
-
if (providedComments.length) {
|
3419
|
-
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
3420
|
-
comment = deepCopy(providedComments[i]);
|
3421
|
-
comment.extendedRange = [0, tree.range[0]];
|
3422
|
-
comments.push(comment);
|
3423
|
-
}
|
3424
|
-
tree.leadingComments = comments;
|
3425
|
-
}
|
3426
|
-
return tree;
|
3427
|
-
}
|
3428
|
-
|
3429
|
-
for (i = 0, len = providedComments.length; i < len; i += 1) {
|
3430
|
-
comments.push(extendCommentRange(deepCopy(providedComments[i]), tokens));
|
3431
|
-
}
|
3432
|
-
|
3433
|
-
// This is based on John Freeman's implementation.
|
3434
|
-
cursor = 0;
|
3435
|
-
traverse(tree, {
|
3436
|
-
enter: function (node) {
|
3437
|
-
var comment;
|
3438
|
-
|
3439
|
-
while (cursor < comments.length) {
|
3440
|
-
comment = comments[cursor];
|
3441
|
-
if (comment.extendedRange[1] > node.range[0]) {
|
3442
|
-
break;
|
3443
|
-
}
|
3444
|
-
|
3445
|
-
if (comment.extendedRange[1] === node.range[0]) {
|
3446
|
-
if (!node.leadingComments) {
|
3447
|
-
node.leadingComments = [];
|
3448
|
-
}
|
3449
|
-
node.leadingComments.push(comment);
|
3450
|
-
comments.splice(cursor, 1);
|
3451
|
-
} else {
|
3452
|
-
cursor += 1;
|
3453
|
-
}
|
3454
|
-
}
|
3455
|
-
|
3456
|
-
// already out of owned node
|
3457
|
-
if (cursor === comments.length) {
|
3458
|
-
return VisitorOption.Break;
|
3459
|
-
}
|
3460
|
-
|
3461
|
-
if (comments[cursor].extendedRange[0] > node.range[1]) {
|
3462
|
-
return VisitorOption.Skip;
|
3463
|
-
}
|
3464
|
-
}
|
3465
|
-
});
|
3466
|
-
|
3467
|
-
cursor = 0;
|
3468
|
-
traverse(tree, {
|
3469
|
-
leave: function (node) {
|
3470
|
-
var comment;
|
3471
|
-
|
3472
|
-
while (cursor < comments.length) {
|
3473
|
-
comment = comments[cursor];
|
3474
|
-
if (node.range[1] < comment.extendedRange[0]) {
|
3475
|
-
break;
|
3476
|
-
}
|
3477
|
-
|
3478
|
-
if (node.range[1] === comment.extendedRange[0]) {
|
3479
|
-
if (!node.trailingComments) {
|
3480
|
-
node.trailingComments = [];
|
3481
|
-
}
|
3482
|
-
node.trailingComments.push(comment);
|
3483
|
-
comments.splice(cursor, 1);
|
3484
|
-
} else {
|
3485
|
-
cursor += 1;
|
3486
|
-
}
|
3487
|
-
}
|
3488
|
-
|
3489
|
-
// already out of owned node
|
3490
|
-
if (cursor === comments.length) {
|
3491
|
-
return VisitorOption.Break;
|
3492
|
-
}
|
3493
|
-
|
3494
|
-
if (comments[cursor].extendedRange[0] > node.range[1]) {
|
3495
|
-
return VisitorOption.Skip;
|
3496
|
-
}
|
3497
|
-
}
|
3498
|
-
});
|
3499
|
-
|
3500
|
-
return tree;
|
3501
|
-
}
|
3502
|
-
|
3503
|
-
exports.Syntax = Syntax;
|
3504
|
-
exports.traverse = traverse;
|
3505
|
-
exports.replace = replace;
|
3506
|
-
exports.attachComments = attachComments;
|
3507
|
-
exports.VisitorKeys = VisitorKeys;
|
3508
|
-
exports.VisitorOption = VisitorOption;
|
3509
|
-
exports.Controller = Controller;
|
3510
|
-
exports.cloneEnvironment = function () { return clone({}); };
|
3511
|
-
|
3512
|
-
return exports;
|
3513
|
-
}(exports));
|
3514
|
-
/* vim: set sw=4 ts=4 et tw=80 : */
|
3515
|
-
|
3516
2713
|
function parser(code) {
|
3517
2714
|
const node = acor__namespace.parse(code, { ecmaVersion: 'latest' });
|
3518
|
-
|
2715
|
+
estraverse__namespace.traverse(node, {
|
3519
2716
|
enter: (child, parent) => {
|
3520
2717
|
if (child.type === 'Identifier') {
|
3521
2718
|
const identifierName = child['name'];
|
@@ -3525,7 +2722,7 @@ function parser(code) {
|
|
3525
2722
|
}
|
3526
2723
|
}
|
3527
2724
|
});
|
3528
|
-
|
2725
|
+
estraverse__namespace.replace(node, {
|
3529
2726
|
leave: (child) => {
|
3530
2727
|
//函数调用
|
3531
2728
|
if (child.type == 'CallExpression') {
|
@@ -3580,6 +2777,173 @@ function getCalleeName(node) {
|
|
3580
2777
|
return node['name'];
|
3581
2778
|
}
|
3582
2779
|
|
2780
|
+
class ParagraphElement extends BlockContentElement {
|
2781
|
+
constructor() {
|
2782
|
+
super('p');
|
2783
|
+
this.props = new ParagraphProps();
|
2784
|
+
this.addEvent('BackspaceKey', (evt) => {
|
2785
|
+
if (evt.selectionState.collapsed) {
|
2786
|
+
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
2787
|
+
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
2788
|
+
if (this.props.numberType >= 0) {
|
2789
|
+
this.props.numberType = -1;
|
2790
|
+
evt.isCancel = true;
|
2791
|
+
}
|
2792
|
+
else if (this.props.indent) {
|
2793
|
+
this.props.indent = 0;
|
2794
|
+
evt.isCancel = true;
|
2795
|
+
}
|
2796
|
+
}
|
2797
|
+
}
|
2798
|
+
}, true);
|
2799
|
+
this.addEvent('ElementKeyDown', evt => {
|
2800
|
+
//当前存在缩进,点击tab
|
2801
|
+
if (evt.sourceEvent.keyCode === 9) {
|
2802
|
+
const { startControl, startOffset } = evt.selectionState;
|
2803
|
+
if (startOffset === 0 && startControl === this.getChild(0)) {
|
2804
|
+
const defaultIndent = evt.ctx.viewOptions.defaultIndent;
|
2805
|
+
let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
|
2806
|
+
this.props.indent += increaseValue;
|
2807
|
+
evt.isCancel = true;
|
2808
|
+
evt.sourceEvent.preventDefault();
|
2809
|
+
}
|
2810
|
+
}
|
2811
|
+
}, true);
|
2812
|
+
}
|
2813
|
+
/**
|
2814
|
+
* 设置样式
|
2815
|
+
* @param format
|
2816
|
+
*/
|
2817
|
+
setFormat(format) {
|
2818
|
+
formatEle(this, format);
|
2819
|
+
Object.keys(format).forEach(key => {
|
2820
|
+
this.props[key] = format[key];
|
2821
|
+
});
|
2822
|
+
}
|
2823
|
+
createRenderObject() {
|
2824
|
+
return new ParagraphRenderObject(this);
|
2825
|
+
}
|
2826
|
+
createLineRect() {
|
2827
|
+
return new ParagraphLineRectRenderObject(null);
|
2828
|
+
}
|
2829
|
+
serialize(viewOptions) {
|
2830
|
+
return {
|
2831
|
+
type: 'p',
|
2832
|
+
props: {
|
2833
|
+
...this.props.getSerializeProps(viewOptions)
|
2834
|
+
}
|
2835
|
+
};
|
2836
|
+
}
|
2837
|
+
clone(data) {
|
2838
|
+
const clone = new ParagraphElement();
|
2839
|
+
this.props.clone(clone.props);
|
2840
|
+
if (data) {
|
2841
|
+
for (let i = 0; i < this.length; i++) {
|
2842
|
+
clone.addChild(this.getChild(i).clone(true));
|
2843
|
+
}
|
2844
|
+
}
|
2845
|
+
return clone;
|
2846
|
+
}
|
2847
|
+
static createElement() {
|
2848
|
+
return new ParagraphElement();
|
2849
|
+
}
|
2850
|
+
}
|
2851
|
+
class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
2852
|
+
render(e) {
|
2853
|
+
e.nextRender();
|
2854
|
+
this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
|
2855
|
+
}
|
2856
|
+
/**
|
2857
|
+
* 绘制项目符号
|
2858
|
+
*/
|
2859
|
+
drawProjectNumber(ctx, viewOptions, e) {
|
2860
|
+
const paraElement = this.element;
|
2861
|
+
if (paraElement.props.numberType !== exports.ParagraphNumberType.none) {
|
2862
|
+
if (paraElement.paintRenders.indexOf(this) > 0) {
|
2863
|
+
return;
|
2864
|
+
}
|
2865
|
+
const line = this.getChild(0);
|
2866
|
+
// const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
2867
|
+
// x: 0,
|
2868
|
+
// y: -viewOptions.translateY
|
2869
|
+
// });
|
2870
|
+
const firstInlinePaintPos = {
|
2871
|
+
x: e.position.x + line.rect.x,
|
2872
|
+
y: e.position.y + line.rect.y
|
2873
|
+
};
|
2874
|
+
if (paraElement.props.numberType === exports.ParagraphNumberType.ul) {
|
2875
|
+
const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
|
2876
|
+
ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
|
2877
|
+
}
|
2878
|
+
else if (paraElement.props.numberType === exports.ParagraphNumberType.ol) {
|
2879
|
+
const parent = paraElement.parent;
|
2880
|
+
let i = paraElement.getIndex() - 1;
|
2881
|
+
for (; i >= 0; i--) {
|
2882
|
+
if (parent.getChild(i) instanceof ParagraphElement) {
|
2883
|
+
//紧挨上面的段落
|
2884
|
+
const prevSiblingPara = parent.getChild(i);
|
2885
|
+
if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
|
2886
|
+
break;
|
2887
|
+
}
|
2888
|
+
}
|
2889
|
+
}
|
2890
|
+
const olText = (paraElement.getIndex() - i) + '.';
|
2891
|
+
const textProps = new TextProps();
|
2892
|
+
textProps.color = '#000';
|
2893
|
+
textProps.fontSize = line.baseBottomLine - line.baseTopLine;
|
2894
|
+
textProps.fontName = '宋体';
|
2895
|
+
ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
|
2896
|
+
}
|
2897
|
+
}
|
2898
|
+
}
|
2899
|
+
clone() {
|
2900
|
+
const cloneRender = new ParagraphRenderObject(this.element);
|
2901
|
+
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
2902
|
+
for (let i = 0; i < this.length; i++) {
|
2903
|
+
cloneRender.addChild(this.getChild(i).clone());
|
2904
|
+
}
|
2905
|
+
return cloneRender;
|
2906
|
+
}
|
2907
|
+
}
|
2908
|
+
class ParagraphFactory extends ElementFactory {
|
2909
|
+
match(type) {
|
2910
|
+
return type === 'p';
|
2911
|
+
}
|
2912
|
+
createElement(data) {
|
2913
|
+
const paraElement = new ParagraphElement();
|
2914
|
+
const props = data.props;
|
2915
|
+
paraElement.props.indent = props?.indent ?? 0;
|
2916
|
+
paraElement.props.hanging = props?.hanging ?? 0;
|
2917
|
+
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
2918
|
+
paraElement.props.numberType = props?.numberType ?? -1;
|
2919
|
+
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
2920
|
+
paraElement.props.marginTop = props?.marginTop ?? 0;
|
2921
|
+
paraElement.props.marginBottom = props?.marginBottom ?? 0;
|
2922
|
+
paraElement.props.tabs = props?.tabs ?? [];
|
2923
|
+
return paraElement;
|
2924
|
+
}
|
2925
|
+
}
|
2926
|
+
/**
|
2927
|
+
* 段落行框
|
2928
|
+
*/
|
2929
|
+
class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
2930
|
+
baseTopLine = 0;
|
2931
|
+
baseBottomLine = 0;
|
2932
|
+
startX = 0;
|
2933
|
+
render(e) {
|
2934
|
+
}
|
2935
|
+
clone() {
|
2936
|
+
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
2937
|
+
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
2938
|
+
cloneRender.baseTopLine = this.baseTopLine;
|
2939
|
+
cloneRender.baseBottomLine = this.baseBottomLine;
|
2940
|
+
for (let i = 0; i < this.length; i++) {
|
2941
|
+
cloneRender.addChild(this.getChild(i).clone());
|
2942
|
+
}
|
2943
|
+
return cloneRender;
|
2944
|
+
}
|
2945
|
+
}
|
2946
|
+
|
3583
2947
|
/**
|
3584
2948
|
* 所有的数据元继承上述两个抽象类
|
3585
2949
|
*/
|
@@ -3783,6 +3147,7 @@ function getCurrOptions(ele) {
|
|
3783
3147
|
class DataElementRenderObject extends InlineGroupRenderObject {
|
3784
3148
|
render(e) {
|
3785
3149
|
const { render, position, docCtx: { viewOptions } } = e;
|
3150
|
+
this.paintPos = e.position;
|
3786
3151
|
//数据元不打印
|
3787
3152
|
if (!this.element.props.printable && render.drawMode === 'print') {
|
3788
3153
|
return;
|
@@ -3815,6 +3180,9 @@ class DataElementRenderObject extends InlineGroupRenderObject {
|
|
3815
3180
|
e.nextRender();
|
3816
3181
|
this.drawCaption(e);
|
3817
3182
|
});
|
3183
|
+
e.render.onRenderCompleted.subscribe(() => {
|
3184
|
+
drawDecorator(e, this);
|
3185
|
+
});
|
3818
3186
|
}
|
3819
3187
|
/**
|
3820
3188
|
* 绘制数据元标题
|
@@ -3895,6 +3263,57 @@ class DataElementBaseFactory extends ElementFactory {
|
|
3895
3263
|
}
|
3896
3264
|
}
|
3897
3265
|
}
|
3266
|
+
function drawDecorator(e, r) {
|
3267
|
+
const { render, docCtx: { viewOptions } } = e;
|
3268
|
+
const canPaint = r.element.isMouseenter || r.element.isFocused;
|
3269
|
+
if (canPaint && r.element.paintRenders.indexOf(r) === 0) {
|
3270
|
+
const currParaRenders = getCurrentParaGroupRenders(r);
|
3271
|
+
const verOffset = 3;
|
3272
|
+
if (currParaRenders.length > 1) {
|
3273
|
+
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
3274
|
+
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > r.paintPos.x) {
|
3275
|
+
const leftPoints = [];
|
3276
|
+
const rightPoints = [];
|
3277
|
+
for (let i = 0; i < currParaRenders.length; i++) {
|
3278
|
+
const groupRender = currParaRenders[i];
|
3279
|
+
const groupRenderPos = groupRender.paintPos;
|
3280
|
+
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
3281
|
+
rightPoints.push({
|
3282
|
+
x: groupRenderPos.x + groupRender.rect.width,
|
3283
|
+
y: groupRenderPos.y - verOffset
|
3284
|
+
});
|
3285
|
+
leftPoints.push({
|
3286
|
+
x: groupRenderPos.x,
|
3287
|
+
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
3288
|
+
});
|
3289
|
+
rightPoints.push({
|
3290
|
+
x: groupRenderPos.x + groupRender.rect.width,
|
3291
|
+
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
3292
|
+
});
|
3293
|
+
}
|
3294
|
+
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
3295
|
+
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
3296
|
+
render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
|
3297
|
+
return;
|
3298
|
+
}
|
3299
|
+
}
|
3300
|
+
for (let i = 0; i < currParaRenders.length; i++) {
|
3301
|
+
const currRen = currParaRenders[i];
|
3302
|
+
render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
|
3303
|
+
}
|
3304
|
+
}
|
3305
|
+
}
|
3306
|
+
function getCurrentParaGroupRenders(r) {
|
3307
|
+
const renders = [];
|
3308
|
+
const currParaRender = ElementUtil.getParentRender(r, ParagraphRenderObject);
|
3309
|
+
for (let i = 0; i < r.element.paintRenders.length; i++) {
|
3310
|
+
const paraRender = ElementUtil.getParentRender(r.element.paintRenders[i], ParagraphRenderObject);
|
3311
|
+
if (paraRender === currParaRender) {
|
3312
|
+
renders.push(r.element.paintRenders[i]);
|
3313
|
+
}
|
3314
|
+
}
|
3315
|
+
return renders;
|
3316
|
+
}
|
3898
3317
|
|
3899
3318
|
class DocumentElement extends BlockContainerElement {
|
3900
3319
|
//props: DocumentProps;
|
@@ -4356,173 +3775,6 @@ class DocumentHeaderFactory extends ElementFactory {
|
|
4356
3775
|
}
|
4357
3776
|
}
|
4358
3777
|
|
4359
|
-
class ParagraphElement extends BlockContentElement {
|
4360
|
-
constructor() {
|
4361
|
-
super('p');
|
4362
|
-
this.props = new ParagraphProps();
|
4363
|
-
this.addEvent('BackspaceKey', (evt) => {
|
4364
|
-
if (evt.selectionState.collapsed) {
|
4365
|
-
const pFirstLeafElement = ElementUtil.getFirstLeafElement(this);
|
4366
|
-
if (pFirstLeafElement === evt.source && evt.sourceOffset === 0) {
|
4367
|
-
if (this.props.numberType >= 0) {
|
4368
|
-
this.props.numberType = -1;
|
4369
|
-
evt.isCancel = true;
|
4370
|
-
}
|
4371
|
-
else if (this.props.indent) {
|
4372
|
-
this.props.indent = 0;
|
4373
|
-
evt.isCancel = true;
|
4374
|
-
}
|
4375
|
-
}
|
4376
|
-
}
|
4377
|
-
}, true);
|
4378
|
-
this.addEvent('ElementKeyDown', evt => {
|
4379
|
-
//当前存在缩进,点击tab
|
4380
|
-
if (evt.sourceEvent.keyCode === 9) {
|
4381
|
-
const { startControl, startOffset } = evt.selectionState;
|
4382
|
-
if (startOffset === 0 && startControl === this.getChild(0)) {
|
4383
|
-
const defaultIndent = evt.ctx.viewOptions.defaultIndent;
|
4384
|
-
let increaseValue = evt.sourceEvent.shiftKey ? -defaultIndent : defaultIndent;
|
4385
|
-
this.props.indent += increaseValue;
|
4386
|
-
evt.isCancel = true;
|
4387
|
-
evt.sourceEvent.preventDefault();
|
4388
|
-
}
|
4389
|
-
}
|
4390
|
-
}, true);
|
4391
|
-
}
|
4392
|
-
/**
|
4393
|
-
* 设置样式
|
4394
|
-
* @param format
|
4395
|
-
*/
|
4396
|
-
setFormat(format) {
|
4397
|
-
formatEle(this, format);
|
4398
|
-
Object.keys(format).forEach(key => {
|
4399
|
-
this.props[key] = format[key];
|
4400
|
-
});
|
4401
|
-
}
|
4402
|
-
createRenderObject() {
|
4403
|
-
return new ParagraphRenderObject(this);
|
4404
|
-
}
|
4405
|
-
createLineRect() {
|
4406
|
-
return new ParagraphLineRectRenderObject(null);
|
4407
|
-
}
|
4408
|
-
serialize(viewOptions) {
|
4409
|
-
return {
|
4410
|
-
type: 'p',
|
4411
|
-
props: {
|
4412
|
-
...this.props.getSerializeProps(viewOptions)
|
4413
|
-
}
|
4414
|
-
};
|
4415
|
-
}
|
4416
|
-
clone(data) {
|
4417
|
-
const clone = new ParagraphElement();
|
4418
|
-
this.props.clone(clone.props);
|
4419
|
-
if (data) {
|
4420
|
-
for (let i = 0; i < this.length; i++) {
|
4421
|
-
clone.addChild(this.getChild(i).clone(true));
|
4422
|
-
}
|
4423
|
-
}
|
4424
|
-
return clone;
|
4425
|
-
}
|
4426
|
-
static createElement() {
|
4427
|
-
return new ParagraphElement();
|
4428
|
-
}
|
4429
|
-
}
|
4430
|
-
class ParagraphRenderObject extends MuiltBlockLineRenderObject {
|
4431
|
-
render(e) {
|
4432
|
-
e.nextRender();
|
4433
|
-
this.drawProjectNumber(e.render, e.docCtx.viewOptions, e);
|
4434
|
-
}
|
4435
|
-
/**
|
4436
|
-
* 绘制项目符号
|
4437
|
-
*/
|
4438
|
-
drawProjectNumber(ctx, viewOptions, e) {
|
4439
|
-
const paraElement = this.element;
|
4440
|
-
if (paraElement.props.numberType !== exports.ParagraphNumberType.none) {
|
4441
|
-
if (paraElement.paintRenders.indexOf(this) > 0) {
|
4442
|
-
return;
|
4443
|
-
}
|
4444
|
-
const line = this.getChild(0);
|
4445
|
-
// const firstInlinePaintPos = ElementUtil.getRenderAbsolutePaintPos(firstInline, {
|
4446
|
-
// x: 0,
|
4447
|
-
// y: -viewOptions.translateY
|
4448
|
-
// });
|
4449
|
-
const firstInlinePaintPos = {
|
4450
|
-
x: e.position.x + line.rect.x,
|
4451
|
-
y: e.position.y + line.rect.y
|
4452
|
-
};
|
4453
|
-
if (paraElement.props.numberType === exports.ParagraphNumberType.ul) {
|
4454
|
-
const numberSymbolY = firstInlinePaintPos.y + line.baseTopLine + Math.floor((line.baseBottomLine - line.baseTopLine) / 2);
|
4455
|
-
ctx.contentContext.fillCircular(firstInlinePaintPos.x + 4 + paraElement.props.indent, numberSymbolY, 4);
|
4456
|
-
}
|
4457
|
-
else if (paraElement.props.numberType === exports.ParagraphNumberType.ol) {
|
4458
|
-
const parent = paraElement.parent;
|
4459
|
-
let i = paraElement.getIndex() - 1;
|
4460
|
-
for (; i >= 0; i--) {
|
4461
|
-
if (parent.getChild(i) instanceof ParagraphElement) {
|
4462
|
-
//紧挨上面的段落
|
4463
|
-
const prevSiblingPara = parent.getChild(i);
|
4464
|
-
if (prevSiblingPara.props.numberType !== paraElement.props.numberType || prevSiblingPara.props.indent !== paraElement.props.indent) {
|
4465
|
-
break;
|
4466
|
-
}
|
4467
|
-
}
|
4468
|
-
}
|
4469
|
-
const olText = (paraElement.getIndex() - i) + '.';
|
4470
|
-
const textProps = new TextProps();
|
4471
|
-
textProps.color = '#000';
|
4472
|
-
textProps.fontSize = line.baseBottomLine - line.baseTopLine;
|
4473
|
-
textProps.fontName = '宋体';
|
4474
|
-
ctx.contentContext.drawText(olText, textProps, firstInlinePaintPos.x, firstInlinePaintPos.y + line.baseTopLine, 40, textProps.fontSize);
|
4475
|
-
}
|
4476
|
-
}
|
4477
|
-
}
|
4478
|
-
clone() {
|
4479
|
-
const cloneRender = new ParagraphRenderObject(this.element);
|
4480
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4481
|
-
for (let i = 0; i < this.length; i++) {
|
4482
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4483
|
-
}
|
4484
|
-
return cloneRender;
|
4485
|
-
}
|
4486
|
-
}
|
4487
|
-
class ParagraphFactory extends ElementFactory {
|
4488
|
-
match(type) {
|
4489
|
-
return type === 'p';
|
4490
|
-
}
|
4491
|
-
createElement(data) {
|
4492
|
-
const paraElement = new ParagraphElement();
|
4493
|
-
const props = data.props;
|
4494
|
-
paraElement.props.indent = props?.indent ?? 0;
|
4495
|
-
paraElement.props.hanging = props?.hanging ?? 0;
|
4496
|
-
paraElement.props.textAlign = props?.textAlign ?? 'left';
|
4497
|
-
paraElement.props.numberType = props?.numberType ?? -1;
|
4498
|
-
paraElement.props.lineHeight = props?.lineHeight ?? this.options.defaultLineHeight;
|
4499
|
-
paraElement.props.marginTop = props?.marginTop ?? 0;
|
4500
|
-
paraElement.props.marginBottom = props?.marginBottom ?? 0;
|
4501
|
-
paraElement.props.tabs = props?.tabs ?? [];
|
4502
|
-
return paraElement;
|
4503
|
-
}
|
4504
|
-
}
|
4505
|
-
/**
|
4506
|
-
* 段落行框
|
4507
|
-
*/
|
4508
|
-
class ParagraphLineRectRenderObject extends BlockLineRectRenderObject {
|
4509
|
-
baseTopLine = 0;
|
4510
|
-
baseBottomLine = 0;
|
4511
|
-
startX = 0;
|
4512
|
-
render(e) {
|
4513
|
-
}
|
4514
|
-
clone() {
|
4515
|
-
const cloneRender = new ParagraphLineRectRenderObject(this.element);
|
4516
|
-
cloneRender.rect = ElementUtil.cloneRect(this.rect);
|
4517
|
-
cloneRender.baseTopLine = this.baseTopLine;
|
4518
|
-
cloneRender.baseBottomLine = this.baseBottomLine;
|
4519
|
-
for (let i = 0; i < this.length; i++) {
|
4520
|
-
cloneRender.addChild(this.getChild(i).clone());
|
4521
|
-
}
|
4522
|
-
return cloneRender;
|
4523
|
-
}
|
4524
|
-
}
|
4525
|
-
|
4526
3778
|
class PSymbolElement extends LeafElement {
|
4527
3779
|
textProps;
|
4528
3780
|
defaultHeight = 14;
|
@@ -5688,8 +4940,8 @@ class TableFactory extends ElementFactory {
|
|
5688
4940
|
/**
|
5689
4941
|
* 行-表格渲染模式
|
5690
4942
|
*/
|
5691
|
-
function textLineRenderMode(
|
5692
|
-
const tb =
|
4943
|
+
function textLineRenderMode(tbRender, data) {
|
4944
|
+
const tb = tbRender;
|
5693
4945
|
const rows = [];
|
5694
4946
|
for (let i = 0; i < tb.length; i++) {
|
5695
4947
|
const row = tb.getChild(i);
|
@@ -8825,60 +8077,9 @@ class DataElementGroupElement extends InlineGroupInputElement {
|
|
8825
8077
|
class DataElementGroupRenderObject extends InlineGroupRenderObject {
|
8826
8078
|
render(e) {
|
8827
8079
|
this.paintPos = e.position;
|
8828
|
-
e.render.onRenderCompleted.subscribe(() => {
|
8829
|
-
|
8830
|
-
|
8831
|
-
const renders = [];
|
8832
|
-
const currParaRender = ElementUtil.getParentRender(this, ParagraphRenderObject);
|
8833
|
-
for (let i = 0; i < this.element.paintRenders.length; i++) {
|
8834
|
-
const paraRender = ElementUtil.getParentRender(this.element.paintRenders[i], ParagraphRenderObject);
|
8835
|
-
if (paraRender === currParaRender) {
|
8836
|
-
renders.push(this.element.paintRenders[i]);
|
8837
|
-
}
|
8838
|
-
}
|
8839
|
-
return renders;
|
8840
|
-
}
|
8841
|
-
paintDecorate(e) {
|
8842
|
-
const { render, docCtx: { viewOptions } } = e;
|
8843
|
-
const canPaint = this.element.isMouseenter || this.element.isFocused;
|
8844
|
-
if (canPaint && this.element.paintRenders.indexOf(this) === 0) {
|
8845
|
-
const currParaRenders = this.getCurrentParaGroupRenders();
|
8846
|
-
const verOffset = 3;
|
8847
|
-
if (currParaRenders.length > 1) {
|
8848
|
-
const secondGroupRenderPos = currParaRenders[1].paintPos;
|
8849
|
-
if (secondGroupRenderPos.x + currParaRenders[1].rect.width > this.paintPos.x) {
|
8850
|
-
const leftPoints = [];
|
8851
|
-
const rightPoints = [];
|
8852
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8853
|
-
const groupRender = currParaRenders[i];
|
8854
|
-
const groupRenderPos = groupRender.paintPos;
|
8855
|
-
leftPoints.push({ x: groupRenderPos.x, y: groupRenderPos.y - verOffset });
|
8856
|
-
rightPoints.push({
|
8857
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8858
|
-
y: groupRenderPos.y - verOffset
|
8859
|
-
});
|
8860
|
-
leftPoints.push({
|
8861
|
-
x: groupRenderPos.x,
|
8862
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8863
|
-
});
|
8864
|
-
rightPoints.push({
|
8865
|
-
x: groupRenderPos.x + groupRender.rect.width,
|
8866
|
-
y: groupRenderPos.y + groupRender.rect.height + verOffset * 2
|
8867
|
-
});
|
8868
|
-
}
|
8869
|
-
const sharpPoints1 = CommonUtil.resharpPoints(rightPoints);
|
8870
|
-
const sharpPoints = CommonUtil.resharpPoints([...leftPoints.reverse()]);
|
8871
|
-
render.overlaysContext.strokeLines([...sharpPoints, ...sharpPoints1, sharpPoints[0]], 1, viewOptions.dataGroupColor);
|
8872
|
-
return;
|
8873
|
-
}
|
8874
|
-
}
|
8875
|
-
for (let i = 0; i < currParaRenders.length; i++) {
|
8876
|
-
const currRen = currParaRenders[i];
|
8877
|
-
render.overlaysContext.strokeRect(currRen.paintPos.x, currRen.paintPos.y - verOffset, currRen.rect.width, currRen.rect.height + verOffset * 2, viewOptions.dataGroupColor);
|
8878
|
-
}
|
8879
|
-
}
|
8880
|
-
}
|
8881
|
-
endRender(ctx, position) {
|
8080
|
+
e.render.onRenderCompleted.subscribe(() => {
|
8081
|
+
drawDecorator(e, this);
|
8082
|
+
});
|
8882
8083
|
}
|
8883
8084
|
clone() {
|
8884
8085
|
const cloneRender = new DataElementGroupRenderObject(this.element);
|
@@ -11931,33 +11132,6 @@ class DynamicContextParser {
|
|
11931
11132
|
}
|
11932
11133
|
}
|
11933
11134
|
|
11934
|
-
/**
|
11935
|
-
* 文字行渲染模式
|
11936
|
-
用于医嘱打印模式
|
11937
|
-
*/
|
11938
|
-
function runTextLineRender(ele, data) {
|
11939
|
-
if (!data.options.textRowLineMode) {
|
11940
|
-
return;
|
11941
|
-
}
|
11942
|
-
if (ele instanceof TableElement) {
|
11943
|
-
textLineRenderMode(ele, data);
|
11944
|
-
remeasureParentRenders(ele.cacheRender);
|
11945
|
-
return;
|
11946
|
-
}
|
11947
|
-
if (ele instanceof BranchElement) {
|
11948
|
-
for (let i = 0; i < ele.length; i++) {
|
11949
|
-
runTextLineRender(ele.getChild(i), data);
|
11950
|
-
}
|
11951
|
-
}
|
11952
|
-
}
|
11953
|
-
function remeasureParentRenders(render) {
|
11954
|
-
if (!render) {
|
11955
|
-
return;
|
11956
|
-
}
|
11957
|
-
ElementUtil.remeasure(render);
|
11958
|
-
remeasureParentRenders(render.parent);
|
11959
|
-
}
|
11960
|
-
|
11961
11135
|
class TabElement extends LeafElement {
|
11962
11136
|
constructor() {
|
11963
11137
|
super('tab');
|
@@ -12527,7 +11701,6 @@ class DocumentArrange {
|
|
12527
11701
|
this.docCtx.viewOptions.showReviewWindow = this.docCtx.document.commentsContainerElement.markPairs.length > 0;
|
12528
11702
|
const docRenders = this.arrangeDoc();
|
12529
11703
|
this.setMeasureCompletedModifyFlag(doc);
|
12530
|
-
runTextLineRender(doc, { options: this.options, renderCtx: this.renderCtx });
|
12531
11704
|
this.cacheDocRenders(docRenders);
|
12532
11705
|
return docRenders;
|
12533
11706
|
});
|
@@ -12699,12 +11872,20 @@ class DocumentArrange {
|
|
12699
11872
|
}
|
12700
11873
|
}
|
12701
11874
|
renders.forEach(item => ElementUtil.remeasure(item));
|
11875
|
+
this.processTableTextLineMode(element);
|
12702
11876
|
return renders.length > 1 ? renders : renders[0];
|
12703
11877
|
}
|
12704
11878
|
else {
|
12705
11879
|
throw new Error('未实现');
|
12706
11880
|
}
|
12707
11881
|
}
|
11882
|
+
processTableTextLineMode(ele) {
|
11883
|
+
if (this.options.textRowLineMode && ele instanceof TableElement && ele.cacheRender) {
|
11884
|
+
const cacheRender = ele.cacheRender;
|
11885
|
+
clearChildrenRenderCache(ele);
|
11886
|
+
textLineRenderMode(cacheRender, { options: this.options, renderCtx: this.renderCtx });
|
11887
|
+
}
|
11888
|
+
}
|
12708
11889
|
createRenderObject(element) {
|
12709
11890
|
return element.createRenderObject({
|
12710
11891
|
options: this.options,
|
@@ -13109,6 +12290,26 @@ class DocumentArrange {
|
|
13109
12290
|
}
|
13110
12291
|
}
|
13111
12292
|
|
12293
|
+
/**
|
12294
|
+
* 文字行渲染模式
|
12295
|
+
用于医嘱打印模式
|
12296
|
+
*/
|
12297
|
+
function runTextLineRender(ele, data) {
|
12298
|
+
if (!data.options.textRowLineMode) {
|
12299
|
+
return;
|
12300
|
+
}
|
12301
|
+
if (ele instanceof TableElement) {
|
12302
|
+
// textLineRenderMode(ele, data);
|
12303
|
+
// remeasureParentRenders(ele.cacheRender)
|
12304
|
+
return;
|
12305
|
+
}
|
12306
|
+
if (ele instanceof BranchElement) {
|
12307
|
+
for (let i = 0; i < ele.length; i++) {
|
12308
|
+
runTextLineRender(ele.getChild(i), data);
|
12309
|
+
}
|
12310
|
+
}
|
12311
|
+
}
|
12312
|
+
|
13112
12313
|
/**
|
13113
12314
|
* 测量阶段,生成Render-UI
|
13114
12315
|
*/
|
@@ -14401,6 +13602,7 @@ class ElementReader {
|
|
14401
13602
|
const type = data.type;
|
14402
13603
|
for (const factory of this.factories) {
|
14403
13604
|
if (factory.match(type)) {
|
13605
|
+
data.props = data.props ?? {};
|
14404
13606
|
const element = factory.createElement(data);
|
14405
13607
|
this.readExtendsProps(data, element);
|
14406
13608
|
const childArr = [];
|
@@ -18857,7 +18059,6 @@ class NodeEvent {
|
|
18857
18059
|
this.setActiveAppContext(() => this.onMousemoveHandler(evt));
|
18858
18060
|
});
|
18859
18061
|
canvas.addEventListener('mouseup', evt => {
|
18860
|
-
console.log('##松开了');
|
18861
18062
|
this.setActiveAppContext(() => this.onMouseupHandler(evt));
|
18862
18063
|
});
|
18863
18064
|
canvas.addEventListener('mouseleave', evt => {
|
@@ -18952,7 +18153,6 @@ class NodeEvent {
|
|
18952
18153
|
}
|
18953
18154
|
//按下鼠标并进行拖动时,mousemove在按下的元素上处理
|
18954
18155
|
if (this.appState.mousedown) {
|
18955
|
-
console.log("offsetY:", evt.offsetY);
|
18956
18156
|
if (this.appState.sourceNode && this.appState.sourceNode.parent) {
|
18957
18157
|
const currNodePos = getNodePosition(this.appState.sourceNode, { x: 0, y: 0 });
|
18958
18158
|
this.appState.pos = { x: evt.offsetX, y: evt.offsetY };
|
@@ -22388,19 +21588,23 @@ exports.ValidateElement = ValidateElement;
|
|
22388
21588
|
exports.ValidateProps = ValidateProps;
|
22389
21589
|
exports.ValidateRenderObject = ValidateRenderObject;
|
22390
21590
|
exports.ViewOptions = ViewOptions;
|
21591
|
+
exports.clearChildrenRenderCache = clearChildrenRenderCache;
|
22391
21592
|
exports.createPrintTemplate = createPrintTemplate;
|
22392
21593
|
exports.defaultParaHanging = defaultParaHanging;
|
22393
21594
|
exports.deleteCurrentParagraph = deleteCurrentParagraph;
|
22394
21595
|
exports.documentPrint = documentPrint;
|
21596
|
+
exports.drawDecorator = drawDecorator;
|
22395
21597
|
exports.elementTypeEventHandler = elementTypeEventHandler;
|
22396
21598
|
exports.fontMapFunc = fontMapFunc;
|
22397
21599
|
exports.fromEvent = fromEvent;
|
21600
|
+
exports.getCalleeName = getCalleeName;
|
22398
21601
|
exports.getFocusTextSegment = getFocusTextSegment;
|
22399
21602
|
exports.invokeTypeHandler = invokeTypeHandler;
|
22400
21603
|
exports.isDate = isDate;
|
22401
21604
|
exports.objectToString = objectToString;
|
22402
21605
|
exports.onTableContextmenu = onTableContextmenu;
|
22403
21606
|
exports.onceTask = onceTask$1;
|
21607
|
+
exports.parser = parser;
|
22404
21608
|
exports.printDocOnContextmenu = printDocOnContextmenu;
|
22405
21609
|
exports.printNodes = printNodes;
|
22406
21610
|
exports.reactiveMap = reactiveMap;
|