Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
sdkjs
Commits
b9c1e1ec
Commit
b9c1e1ec
authored
May 04, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ previous revision
parent
a3994c6d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
175 additions
and
168 deletions
+175
-168
common/wordcopypaste.js
common/wordcopypaste.js
+1
-1
word/Math/mathContent.js
word/Math/mathContent.js
+174
-167
No files found.
common/wordcopypaste.js
View file @
b9c1e1ec
...
...
@@ -2504,7 +2504,7 @@ PasteProcessor.prototype =
{
//TODO пока добавляю функцию здесь. должна она находиться в Math.js
var
res
=
paraMath
.
Root
.
GetTextContent
();
console
.
log
(
res
);
console
.
log
(
res
.
str
);
return
res
;
},
...
...
word/Math/mathContent.js
View file @
b9c1e1ec
...
...
@@ -7239,22 +7239,14 @@ CMathContent.prototype.ReplaceAutoCorrect = function(AutoCorrectEngine, bCursorS
}
};
CMathContent
.
prototype
.
GetTextContent
=
function
(
arr
,
str
)
CMathContent
.
prototype
.
GetTextContent
=
function
()
{
var
arr
=
[],
str
=
""
,
bIsContainsOperator
=
false
;
if
(
!
arr
)
{
arr
=
[];
}
if
(
!
str
)
{
str
=
""
;
}
var
addText
=
function
(
value
,
bIsAddParenthesis
)
{
if
(
bIsAddParenthesis
&&
value
.
length
>
1
)
if
(
bIsAddParenthesis
&&
value
.
length
>
1
&&
value
.
match
()
)
{
arr
.
push
(
"
(
"
);
str
+=
"
(
"
;
...
...
@@ -7284,7 +7276,6 @@ CMathContent.prototype.GetTextContent = function(arr, str)
if
(
elem
instanceof
CDegree
)
{
if
(
DEGREE_SUPERSCRIPT
===
elem
.
Pr
.
type
)
{
res
.
push
(
getVal
(
"
^
"
));
...
...
@@ -7331,7 +7322,7 @@ CMathContent.prototype.GetTextContent = function(arr, str)
}
else
if
(
elem
instanceof
CMathMatrix
)
{
res
.
push
(
getVal
(
"
■
"
,
true
)
);
res
[
-
1
]
=
getVal
(
"
■
"
,
true
);
for
(
var
row
=
0
;
row
<
elem
.
nRow
;
row
++
)
{
for
(
var
col
=
1
;
col
<
elem
.
nCol
;
col
++
)
...
...
@@ -7348,60 +7339,35 @@ CMathContent.prototype.GetTextContent = function(arr, str)
return
res
;
};
var
tempStr
;
for
(
var
i
=
0
;
i
<
this
.
Content
.
length
;
i
++
)
{
switch
(
this
.
Content
[
i
].
Type
)
{
case
para_Math_Run
:
{
if
(
this
.
Content
[
i
].
Content
.
length
)
{
var
string
=
""
;
for
(
var
j
=
0
;
j
<
this
.
Content
[
i
].
Content
.
length
;
j
++
)
{
if
(
para_Math_Text
===
this
.
Content
[
i
].
Content
[
j
].
Type
)
{
string
+=
String
.
fromCharCode
(
this
.
Content
[
i
].
Content
[
j
].
value
);
}
else
if
(
para_Math_BreakOperator
===
this
.
Content
[
i
].
Content
[
j
].
Type
)
{
string
+=
String
.
fromCharCode
(
this
.
Content
[
i
].
Content
[
j
].
value
);
}
}
addText
(
string
);
}
break
;
}
case
para_Math_Composition
:
var
parseMathComposition
=
function
(
elem
)
{
var
elem
=
this
.
Content
[
i
]
;
var
tempStr
;
var
symbol
=
getMathSymbol
(
elem
);
if
(
elem
instanceof
CDegree
)
//степень
{
//основание
tempStr
=
elem
.
Content
[
0
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
addText
(
symbol
[
0
].
value
);
//показатель
tempStr
=
elem
.
Content
[
1
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
else
if
(
elem
instanceof
CDelimiter
)
{
tempStr
=
elem
.
Content
[
0
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
else
if
(
elem
instanceof
CNary
)
//сумма
...
...
@@ -7414,48 +7380,48 @@ CMathContent.prototype.GetTextContent = function(arr, str)
addText
(
symbol
[
1
].
value
);
tempStr
=
elem
.
Content
[
0
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
//верхняя граница суммирования
if
(
null
!==
symbol
[
2
])
{
addText
(
symbol
[
2
].
value
);
//верхняя граница суммирования
tempStr
=
elem
.
Content
[
1
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
addText
(
symbol
[
3
].
value
);
tempStr
=
elem
.
Content
[
2
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
else
if
(
elem
instanceof
CFraction
)
//дробь
{
//числитель
tempStr
=
elem
.
Content
[
0
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
addText
(
symbol
[
0
].
value
);
//знаменатель
tempStr
=
elem
.
Content
[
1
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
else
if
(
elem
instanceof
CRadical
)
//корень
...
...
@@ -7463,9 +7429,9 @@ CMathContent.prototype.GetTextContent = function(arr, str)
addText
(
symbol
[
0
].
value
);
//степень корня
tempStr
=
elem
.
Content
[
0
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
if
(
tempStr
)
...
...
@@ -7475,35 +7441,29 @@ CMathContent.prototype.GetTextContent = function(arr, str)
//подкоренное выражение
tempStr
=
elem
.
Content
[
1
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
else
if
(
elem
instanceof
CMathMatrix
)
{
for
(
var
j
=
0
;
j
<
this
.
Content
[
i
].
Content
.
length
;
j
++
)
{
if
(
para_Math_Content
===
this
.
Content
[
i
].
Content
[
j
].
Type
)
addText
(
symbol
[
-
1
].
value
);
addText
(
"
(
"
);
for
(
var
j
=
0
;
j
<
elem
.
Content
.
length
;
j
++
)
{
if
(
j
===
0
&&
symbol
[
-
1
]
&&
symbol
[
-
1
].
prePosition
)
if
(
para_Math_Content
===
elem
.
Content
[
j
].
Type
)
{
addText
(
symbol
[
-
1
].
value
);
}
if
(
symbol
[
j
]
&&
symbol
[
j
].
prePosition
)
{
addText
(
symbol
[
j
].
value
);
}
var
tempStr
=
this
.
Content
[
i
]
.
Content
[
j
].
GetTextContent
();
tempStr
=
elem
.
Content
[
j
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
if
(
tempStr
.
length
>
1
)
addText
(
"
(
"
);
addText
(
tempStr
);
if
(
tempStr
.
length
>
1
)
addText
(
"
)
"
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
...
...
@@ -7513,8 +7473,25 @@ CMathContent.prototype.GetTextContent = function(arr, str)
}
}
}
addText
(
"
)
"
);
}
else
if
(
elem
instanceof
CMathFunc
)
{
//функция
tempStr
=
elem
.
Content
[
0
].
GetTextContent
();
if
(
tempStr
.
str
)
{
addText
(
tempStr
.
str
);
}
//аргумент
tempStr
=
elem
.
Content
[
1
].
GetTextContent
();
if
(
tempStr
.
str
)
{
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
else
if
(
elem
instanceof
CLimit
)
{
//функция
tempStr
=
elem
.
Content
[
0
].
GetTextContent
();
...
...
@@ -7525,19 +7502,49 @@ CMathContent.prototype.GetTextContent = function(arr, str)
//аргумент
tempStr
=
elem
.
Content
[
1
].
GetTextContent
();
if
(
tempS
tr
)
if
(
tempStr
.
s
tr
)
{
addText
(
tempStr
,
true
);
addText
(
tempStr
.
str
,
tempStr
.
bIsContainsOperator
);
}
}
};
for
(
var
i
=
0
;
i
<
this
.
Content
.
length
;
i
++
)
{
switch
(
this
.
Content
[
i
].
Type
)
{
case
para_Math_Run
:
{
if
(
this
.
Content
[
i
].
Content
.
length
)
{
var
string
=
""
;
for
(
var
j
=
0
;
j
<
this
.
Content
[
i
].
Content
.
length
;
j
++
)
{
if
(
para_Math_Text
===
this
.
Content
[
i
].
Content
[
j
].
Type
)
{
string
+=
String
.
fromCharCode
(
this
.
Content
[
i
].
Content
[
j
].
value
);
}
else
if
(
para_Math_BreakOperator
===
this
.
Content
[
i
].
Content
[
j
].
Type
)
{
string
+=
String
.
fromCharCode
(
this
.
Content
[
i
].
Content
[
j
].
value
);
bIsContainsOperator
=
true
;
}
}
addText
(
string
);
}
break
;
}
case
para_Math_Composition
:
{
parseMathComposition
(
this
.
Content
[
i
]);
break
;
}
}
}
return
str
;
return
{
str
:
str
,
bIsContainsOperator
:
bIsContainsOperator
};
};
CMathContent
.
prototype
.
GetTextContent3
=
function
(
arr
,
str
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment