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
1894d064
Commit
1894d064
authored
Mar 17, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improved performance of a paste function.
parent
d7fb3e2b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
124 additions
and
37 deletions
+124
-37
word/Editor/History.js
word/Editor/History.js
+86
-11
word/Editor/Numbering.js
word/Editor/Numbering.js
+8
-2
word/Editor/Styles.js
word/Editor/Styles.js
+30
-24
No files found.
word/Editor/History.js
View file @
1894d064
...
...
@@ -467,12 +467,11 @@ CHistory.prototype =
}
},
Internal_RecalcData_Clear
:
function
()
{
// NumPr здесь не обнуляем
var
NumPr
=
this
.
RecalculateData
.
NumPr
;
this
.
RecalculateData
=
{
Internal_RecalcData_Clear
:
function
()
{
// NumPr здесь не обнуляем
var
NumPr
=
this
.
RecalculateData
.
NumPr
;
this
.
RecalculateData
=
{
Inline
:
{
Pos
:
-
1
,
PageNum
:
0
...
...
@@ -485,11 +484,14 @@ CHistory.prototype =
ThemeInfo
:
null
},
Tables
:
[],
NumPr
:
NumPr
,
NotesEnd
:
false
,
NotesEndPage
:
0
,
Update
:
true
Tables
:
[],
NumPr
:
NumPr
,
NotesEnd
:
false
,
NotesEndPage
:
0
,
Update
:
true
,
ChangedStyles
:
{},
ChangedNums
:
{},
AllParagraphs
:
null
};
},
...
...
@@ -596,6 +598,33 @@ CHistory.prototype =
}
},
AddChangedStyleToRecalculateData
:
function
(
sId
,
oStyle
)
{
if
(
!
this
.
RecalculateData
.
ChangedStyles
)
this
.
RecalculateData
.
ChangedStyles
=
{};
if
(
this
.
RecalculateData
.
ChangedStyles
[
sId
]
===
oStyle
)
return
false
;
this
.
RecalculateData
.
ChangedStyles
[
sId
]
=
oStyle
;
return
true
;
},
AddChangedNumberingToRecalculateData
:
function
(
NumId
,
Lvl
,
oNum
)
{
if
(
!
this
.
RecalculateData
.
ChangedNums
)
this
.
RecalculateData
.
ChangedNums
=
{};
if
(
!
this
.
RecalculateData
.
ChangedNums
[
NumId
])
this
.
RecalculateData
.
ChangedNums
[
NumId
]
=
{};
if
(
this
.
RecalculateData
.
ChangedNums
[
NumId
][
Lvl
]
===
oNum
)
return
false
;
this
.
RecalculateData
.
ChangedNums
[
NumId
][
Lvl
]
=
oNum
;
return
true
;
},
Add_RecalcNumPr
:
function
(
NumPr
)
{
if
(
undefined
!==
NumPr
&&
null
!==
NumPr
&&
undefined
!==
NumPr
.
NumId
)
...
...
@@ -1119,6 +1148,52 @@ CHistory.prototype.private_GetItemsCountInContentChange = function(Class, Data)
return
1
;
};
CHistory
.
prototype
.
GetAllParagraphsForRecalcData
=
function
(
Props
)
{
if
(
!
this
.
RecalculateData
.
AllParagraphs
)
{
if
(
this
.
Document
)
this
.
RecalculateData
.
AllParagraphs
=
this
.
Document
.
Get_AllParagraphs
({
All
:
true
});
else
this
.
RecalculateData
.
AllParagraphs
=
[];
}
var
arrParagraphs
=
[];
if
(
!
Props
||
true
===
Props
.
All
)
{
return
this
.
RecalculateData
.
AllParagraphs
;
}
else
if
(
true
===
Props
.
Style
)
{
var
arrStylesId
=
Props
.
StylesId
;
for
(
var
nParaIndex
=
0
,
nParasCount
=
this
.
RecalculateData
.
AllParagraphs
.
length
;
nParaIndex
<
nParasCount
;
++
nParaIndex
)
{
var
oPara
=
this
.
RecalculateData
.
AllParagraphs
[
nParaIndex
];
for
(
var
nStyleIndex
=
0
,
nStylesCount
=
arrStylesId
.
length
;
nStyleIndex
<
nStylesCount
;
++
nStyleIndex
)
{
if
(
oPara
.
Pr
.
PStyle
===
arrStylesId
[
nStyleIndex
])
{
arrParagraphs
.
push
(
oPara
);
break
;
}
}
}
}
else
if
(
true
===
Props
.
Numbering
)
{
for
(
var
nParaIndex
=
0
,
nParasCount
=
this
.
RecalculateData
.
AllParagraphs
.
length
;
nParaIndex
<
nParasCount
;
++
nParaIndex
)
{
var
oPara
=
this
.
RecalculateData
.
AllParagraphs
[
nParaIndex
];
var
NumPr
=
Props
.
NumPr
;
var
_NumPr
=
oPara
.
Numbering_Get
();
if
(
undefined
!=
_NumPr
&&
_NumPr
.
NumId
===
NumPr
.
NumId
&&
(
_NumPr
.
Lvl
===
NumPr
.
Lvl
||
undefined
===
NumPr
.
Lvl
))
arrParagraphs
.
push
(
oPara
);
}
}
return
arrParagraphs
;
};
function
CRC32
()
{
...
...
word/Editor/Numbering.js
View file @
1894d064
...
...
@@ -1605,12 +1605,18 @@ CAbstractNum.prototype =
Refresh_RecalcData
:
function
(
Data
)
{
var
oHistory
=
History
;
if
(
!
oHistory
)
return
;
if
(
!
oHistory
.
AddChangedNumberingToRecalculateData
(
this
.
Get_Id
(),
Data
.
Index
,
this
))
return
;
var
NumPr
=
new
CNumPr
();
NumPr
.
NumId
=
this
.
Id
;
NumPr
.
Lvl
=
Data
.
Index
;
var
LogicDocument
=
editor
.
WordControl
.
m_oLogicDocument
;
var
AllParagraphs
=
LogicDocument
.
Get_AllParagraphsByNumbering
(
NumPr
);
var
AllParagraphs
=
oHistory
.
GetAllParagraphsForRecalcData
({
Numbering
:
true
,
NumPr
:
NumPr
});
var
Count
=
AllParagraphs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
...
...
word/Editor/Styles.js
View file @
1894d064
...
...
@@ -2826,33 +2826,39 @@ CStyle.prototype =
}
},
Refresh_RecalcData2
:
function
()
{
// TODO: Надо сделать механизм, чтобы данное действие не вызывалось много раз подряд, а только 1.
var
LogicDocument
=
editor
.
WordControl
.
m_oLogicDocument
;
var
Styles
=
LogicDocument
.
Get_Styles
()
;
Refresh_RecalcData2
:
function
()
{
var
oHistory
=
History
;
if
(
!
oHistory
)
return
;
var
AllParagraphs
=
[];
if
(
!
oHistory
.
AddChangedStyleToRecalculateData
(
this
.
Get_Id
(),
this
))
return
;
if
(
this
.
Id
!=
Styles
.
Default
.
Paragraph
)
{
var
AllStylesId
=
Styles
.
private_GetAllBasedStylesId
(
this
.
Id
);
AllParagraphs
=
LogicDocument
.
Get_AllParagraphsByStyle
(
AllStylesId
);
LogicDocument
.
Add_ChangedStyle
(
AllStylesId
);
}
else
{
AllParagraphs
=
LogicDocument
.
Get_AllParagraphs
({
All
:
true
});
LogicDocument
.
Add_ChangedStyle
([
this
.
Id
]);
}
var
LogicDocument
=
editor
.
WordControl
.
m_oLogicDocument
;
var
Styles
=
LogicDocument
.
Get_Styles
();
var
Count
=
AllParagraphs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
var
Para
=
AllParagraphs
[
Index
];
Para
.
Refresh_RecalcData
(
{
Type
:
AscDFH
.
historyitem_Paragraph_PStyle
}
);
}
},
var
AllParagraphs
=
[];
if
(
this
.
Id
!=
Styles
.
Default
.
Paragraph
)
{
var
AllStylesId
=
Styles
.
private_GetAllBasedStylesId
(
this
.
Id
);
AllParagraphs
=
oHistory
.
GetAllParagraphsForRecalcData
({
Style
:
true
,
StylesId
:
AllStylesId
});
LogicDocument
.
Add_ChangedStyle
(
AllStylesId
);
}
else
{
AllParagraphs
=
oHistory
.
GetAllParagraphsForRecalcData
({
All
:
true
});
LogicDocument
.
Add_ChangedStyle
([
this
.
Id
]);
}
var
Count
=
AllParagraphs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
var
Para
=
AllParagraphs
[
Index
];
Para
.
Refresh_RecalcData
({
Type
:
AscDFH
.
historyitem_Paragraph_PStyle
});
}
},
//-----------------------------------------------------------------------------------
// Функции для совместного редактирования
//-----------------------------------------------------------------------------------
...
...
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