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
5c08aaf4
Commit
5c08aaf4
authored
Jun 14, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented functions for removing content control wrapping.
parent
aed39e23
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
116 additions
and
11 deletions
+116
-11
word/Editor/Document.js
word/Editor/Document.js
+25
-4
word/Editor/ParagraphContentBase.js
word/Editor/ParagraphContentBase.js
+4
-7
word/Editor/StructuredDocumentTags/BlockLevel.js
word/Editor/StructuredDocumentTags/BlockLevel.js
+38
-0
word/Editor/StructuredDocumentTags/InlineLevel.js
word/Editor/StructuredDocumentTags/InlineLevel.js
+49
-0
No files found.
word/Editor/Document.js
View file @
5c08aaf4
...
...
@@ -15229,16 +15229,37 @@ CDocument.prototype.GetAllContentControls = function()
};
CDocument
.
prototype
.
RemoveContentControl
=
function
(
Id
)
{
var
oBlockLevelSdt
=
this
.
TableId
.
Get_ById
(
Id
);
if
(
oBlockLevelSdt
&&
oBlockLevelSdt
.
Parent
)
var
oContentControl
=
this
.
TableId
.
Get_ById
(
Id
);
if
(
!
oContentControl
)
return
;
if
(
AscCommonWord
.
sdttype_BlockLevel
===
oContentControl
.
GetContentControlType
()
&&
oContentControl
.
Parent
)
{
this
.
RemoveSelection
();
var
oDocContent
=
o
BlockLevelSdt
.
Parent
;
var
oDocContent
=
o
ContentControl
.
Parent
;
oDocContent
.
Update_ContentIndexing
();
var
nIndex
=
o
BlockLevelSdt
.
GetIndex
();
var
nIndex
=
o
ContentControl
.
GetIndex
();
oDocContent
.
Remove_FromContent
(
nIndex
,
1
);
oDocContent
.
MoveCursorToStartPos
();
}
else
if
(
AscCommonWord
.
sdttype_InlineLevel
===
oContentControl
.
GetContentControlType
())
{
this
.
SelectContentControl
(
Id
);
this
.
RemoveBeforePaste
();
}
};
CDocument
.
prototype
.
RemoveContentControlWrapper
=
function
(
Id
)
{
var
oContentControl
=
this
.
TableId
.
Get_ById
(
Id
);
if
(
!
oContentControl
)
return
;
this
.
History
.
Create_NewPoint
();
oContentControl
.
RemoveContentControlWrapper
();
this
.
Recalculate
();
this
.
Document_UpdateInterfaceState
();
this
.
Document_UpdateSelectionState
();
};
CDocument
.
prototype
.
GetContentControl
=
function
(
Id
)
{
...
...
word/Editor/ParagraphContentBase.js
View file @
5c08aaf4
...
...
@@ -626,8 +626,8 @@ CParagraphContentWithParagraphLikeContent.prototype.Remove_FromContent = functio
this
.
State
.
Selection
.
EndPos
=
Pos
;
}
this
.
Selection
.
StartPos
=
Math
.
m
in
(
this
.
Content
.
length
-
1
,
Math
.
max
(
0
,
this
.
Selection
.
StartPos
));
this
.
Selection
.
EndPos
=
Math
.
m
in
(
this
.
Content
.
length
-
1
,
Math
.
max
(
0
,
this
.
Selection
.
EndPos
));
this
.
Selection
.
StartPos
=
Math
.
m
ax
(
0
,
Math
.
min
(
this
.
Content
.
length
-
1
,
this
.
Selection
.
StartPos
));
this
.
Selection
.
EndPos
=
Math
.
m
ax
(
0
,
Math
.
min
(
this
.
Content
.
length
-
1
,
this
.
Selection
.
EndPos
));
}
// Также передвинем всем метки переносов страниц и строк
...
...
@@ -1185,9 +1185,6 @@ CParagraphContentWithParagraphLikeContent.prototype.Get_ContentLength = function
};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Get_Parent
=
function
()
{
if
(
this
.
Parent
)
return
this
.
Parent
;
if
(
!
this
.
Paragraph
)
return
null
;
...
...
@@ -1969,7 +1966,7 @@ CParagraphContentWithParagraphLikeContent.prototype.Set_SelectionContentPos = fu
// Удалим отметки о старом селекте
if
(
OldStartPos
<
StartPos
&&
OldStartPos
<
EndPos
)
{
var
TempBegin
=
OldStartPos
;
var
TempBegin
=
Math
.
max
(
0
,
OldStartPos
)
;
var
TempEnd
=
Math
.
min
(
this
.
Content
.
length
-
1
,
Math
.
min
(
StartPos
,
EndPos
)
-
1
);
for
(
var
CurPos
=
TempBegin
;
CurPos
<=
TempEnd
;
++
CurPos
)
{
...
...
@@ -1979,7 +1976,7 @@ CParagraphContentWithParagraphLikeContent.prototype.Set_SelectionContentPos = fu
if
(
OldEndPos
>
StartPos
&&
OldEndPos
>
EndPos
)
{
var
TempBegin
=
Math
.
max
(
StartPos
,
EndPos
)
+
1
;
var
TempBegin
=
Math
.
max
(
0
,
Math
.
max
(
StartPos
,
EndPos
)
+
1
)
;
var
TempEnd
=
Math
.
min
(
OldEndPos
,
this
.
Content
.
length
-
1
);
for
(
var
CurPos
=
TempBegin
;
CurPos
<=
TempEnd
;
++
CurPos
)
{
...
...
word/Editor/StructuredDocumentTags/BlockLevel.js
View file @
5c08aaf4
...
...
@@ -868,6 +868,44 @@ CBlockLevelSdt.prototype.SelectContentControl = function()
this
.
SelectAll
(
1
);
this
.
Set_CurrentElement
(
false
,
0
,
this
.
Content
);
};
CBlockLevelSdt
.
prototype
.
RemoveContentControlWrapper
=
function
()
{
if
(
!
this
.
Parent
)
return
;
this
.
Parent
.
Update_ContentIndexing
();
var
nElementPos
=
this
.
GetIndex
();
if
(
this
.
Parent
.
Content
[
nElementPos
]
!==
this
)
return
;
var
nParentCurPos
=
this
.
Parent
.
CurPos
.
ContentPos
;
var
nParentSelectionStartPos
=
this
.
Parent
.
Selection
.
StartPos
;
var
nParentSelectionEndPos
=
this
.
Parent
.
Selection
.
EndPos
;
this
.
Parent
.
Remove_FromContent
(
nElementPos
,
1
);
for
(
var
nIndex
=
0
,
nCount
=
this
.
Content
.
Content
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
this
.
Parent
.
Add_ToContent
(
nElementPos
+
nIndex
,
this
.
Content
.
Content
[
nIndex
]);
}
if
(
nParentCurPos
===
nElementPos
)
this
.
Parent
.
CurPos
.
ContentPos
=
nParentCurPos
+
this
.
Content
.
CurPos
.
ContentPos
;
else
if
(
nParentCurPos
>
nElementPos
)
this
.
Parent
.
CurPos
.
ContentPos
=
nParentCurPos
+
nCount
-
1
;
if
(
nParentSelectionStartPos
===
nElementPos
)
this
.
Parent
.
Selection
.
StartPos
=
nParentSelectionStartPos
+
this
.
Content
.
Selection
.
StartPos
;
else
if
(
nParentSelectionStartPos
>
nElementPos
)
this
.
Parent
.
Selection
.
StartPos
=
nParentSelectionStartPos
+
nCount
-
1
;
if
(
nParentSelectionEndPos
===
nElementPos
)
this
.
Parent
.
Selection
.
EndPos
=
nParentSelectionEndPos
+
this
.
Content
.
Selection
.
EndPos
;
else
if
(
nParentSelectionEndPos
>
nElementPos
)
this
.
Parent
.
Selection
.
EndPos
=
nParentSelectionEndPos
+
nCount
-
1
;
this
.
Content
.
Remove_FromContent
(
0
,
this
.
Content
.
Content
.
length
-
1
);
};
//----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt
.
prototype
.
GetContentControlType
=
function
()
{
...
...
word/Editor/StructuredDocumentTags/InlineLevel.js
View file @
5c08aaf4
...
...
@@ -252,6 +252,55 @@ CInlineLevelSdt.prototype.SelectContentControl = function()
{
this
.
SelectThisElement
(
1
);
};
CInlineLevelSdt
.
prototype
.
RemoveContentControlWrapper
=
function
()
{
var
oParent
=
this
.
Get_Parent
();
if
(
!
oParent
)
return
;
var
nElementPos
=
this
.
Get_PosInParent
(
oParent
);
if
(
-
1
===
nElementPos
)
return
;
var
nParentCurPos
=
oParent
instanceof
Paragraph
?
oParent
.
CurPos
.
ContentPos
:
oParent
.
State
.
ContentPos
;
var
nParentSelectionStartPos
=
oParent
.
Selection
.
StartPos
;
var
nParentSelectionEndPos
=
oParent
.
Selection
.
EndPos
;
var
nCount
=
this
.
Content
.
length
;
oParent
.
Remove_FromContent
(
nElementPos
,
1
);
for
(
var
nIndex
=
0
;
nIndex
<
nCount
;
++
nIndex
)
{
oParent
.
Add_ToContent
(
nElementPos
+
nIndex
,
this
.
Content
[
nIndex
]);
}
if
(
nParentCurPos
===
nElementPos
)
{
if
(
oParent
instanceof
Paragraph
)
oParent
.
CurPos
.
ContentPos
=
nParentCurPos
+
this
.
State
.
ContentPos
;
else
oParent
.
State
.
ContentPos
=
nParentCurPos
+
this
.
State
.
ContentPos
;
}
else
if
(
nParentCurPos
>
nElementPos
)
{
if
(
oParent
instanceof
Paragraph
)
oParent
.
CurPos
.
ContentPos
=
nParentCurPos
+
nCount
-
1
;
else
oParent
.
State
.
ContentPos
=
nParentCurPos
+
nCount
-
1
;
}
if
(
nParentSelectionStartPos
===
nElementPos
)
oParent
.
Selection
.
StartPos
=
nParentSelectionStartPos
+
this
.
Selection
.
StartPos
;
else
if
(
nParentSelectionStartPos
>
nElementPos
)
oParent
.
Selection
.
StartPos
=
nParentSelectionStartPos
+
nCount
-
1
;
if
(
nParentSelectionEndPos
===
nElementPos
)
oParent
.
Selection
.
EndPos
=
nParentSelectionEndPos
+
this
.
Selection
.
EndPos
;
else
if
(
nParentSelectionEndPos
>
nElementPos
)
oParent
.
Selection
.
EndPos
=
nParentSelectionEndPos
+
nCount
-
1
;
this
.
Remove_FromContent
(
0
,
this
.
Content
.
length
);
};
//----------------------------------------------------------------------------------------------------------------------
// Выставление настроек
//----------------------------------------------------------------------------------------------------------------------
...
...
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