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
ffe1a082
Commit
ffe1a082
authored
Jul 08, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented adding a footnote to document.
parent
cbe51d70
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
38 deletions
+52
-38
word/Editor/Document.js
word/Editor/Document.js
+38
-38
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+14
-0
No files found.
word/Editor/Document.js
View file @
ffe1a082
...
...
@@ -6503,6 +6503,15 @@ CDocument.prototype.OnKeyDown = function(e)
bRetValue
=
keydownresult_PreventAll
;
}
}
else
if
(
e
.
KeyCode
==
70
&&
false
===
editor
.
isViewMode
&&
true
===
e
.
CtrlKey
)
{
// TODO: Заменить хоткей для сноски, или проверить можно ли использовать Ctrl+Alt
if
(
true
===
e
.
AltKey
)
{
this
.
AddFootnote
();
bRetValue
=
keydownresult_PreventAll
;
}
}
else
if
(
e
.
KeyCode
==
73
&&
false
===
editor
.
isViewMode
&&
true
===
e
.
CtrlKey
)
// Ctrl + I - делаем текст наклонным
{
var
TextPr
=
this
.
Get_Paragraph_TextPr
();
...
...
@@ -6630,44 +6639,6 @@ CDocument.prototype.OnKeyDown = function(e)
bUpdateSelection
=
false
;
bRetValue
=
keydownresult_PreventAll
;
}
// --> TEST
// else if (113 === e.KeyCode)
// {
// this.History.Create_NewPoint();
// var oFootnote = this.Footnotes.Create_Footnote();
//
// oFootnote.Paragraph_Add(new ParaFootnoteRef(oFootnote));
// oFootnote.Paragraph_Add(new ParaSpace());
// oFootnote.Paragraph_Add(new ParaText("F"));
// oFootnote.Paragraph_Add(new ParaText("o"));
// oFootnote.Paragraph_Add(new ParaText("o"));
// oFootnote.Paragraph_Add(new ParaText("t"));
// oFootnote.Paragraph_Add(new ParaText("n"));
// oFootnote.Paragraph_Add(new ParaText("o"));
// oFootnote.Paragraph_Add(new ParaText("t"));
// oFootnote.Paragraph_Add(new ParaText("e"));
//
// this.Paragraph_Add(new ParaFootnoteReference(oFootnote));
// bRetValue = keydownresult_PreventAll;
// }
// else if (114 === e.KeyCode)
// {
// this.History.Create_NewPoint();
// this.Paragraph_Add(new ParaSeparator());
// bRetValue = keydownresult_PreventAll;
// }
// else if (115 === e.KeyCode)
// {
// this.History.Create_NewPoint();
// this.Paragraph_Add(new ParaContinuationSeparator());
// bRetValue = keydownresult_PreventAll;
// }
// else if (116 === e.KeyCode)
// {
// this.Goto_FootnotesOnPage(0);
// bRetValue = keydownresult_PreventAll;
// }
// TEST <--
else
if
(
e
.
KeyCode
==
121
&&
true
===
e
.
ShiftKey
)
// Shift + F10 - контекстное меню
{
var
X_abs
,
Y_abs
,
oPosition
,
ConvertedPos
;
...
...
@@ -11234,6 +11205,35 @@ CDocument.prototype.Get_FootnotesList = function(oFirstFootnote, oLastFootnote)
return
oEngine
.
GetRange
();
};
CDocument
.
prototype
.
AddFootnote
=
function
()
{
var
nDocPosType
=
this
.
Get_DocPosType
();
if
(
docpostype_Content
!==
nDocPosType
&&
docpostype_Footnotes
!==
nDocPosType
)
return
;
if
(
false
===
this
.
Document_Is_SelectionLocked
(
changestype_Paragraph_Content
))
{
this
.
History
.
Create_NewPoint
();
var
nDocPosType
=
this
.
Get_DocPosType
();
if
(
docpostype_Content
===
nDocPosType
)
{
var
oFootnote
=
this
.
Footnotes
.
Create_Footnote
();
oFootnote
.
Paragraph_Add
(
new
ParaFootnoteRef
(
oFootnote
));
oFootnote
.
Paragraph_Add
(
new
ParaSpace
());
oFootnote
.
Cursor_MoveToEndPos
(
false
);
this
.
Paragraph_Add
(
new
ParaFootnoteReference
(
oFootnote
));
this
.
Set_DocPosType
(
docpostype_Footnotes
);
this
.
Footnotes
.
Set_CurrentElement
(
true
,
0
,
oFootnote
);
}
else
if
(
docpostype_Footnotes
===
nDocPosType
)
{
this
.
Footnotes
.
AddFootnoteRef
();
this
.
Recalculate
();
}
}
};
//----------------------------------------------------------------------------------------------------------------------
// Функции, которые вызываются из CLogicDocumentController
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/Footnotes.js
View file @
ffe1a082
...
...
@@ -605,6 +605,20 @@ CFootnotesController.prototype.Set_CurrentElement = function(bUpdateStates, Page
}
}
};
CFootnotesController
.
prototype
.
AddFootnoteRef
=
function
()
{
if
(
true
!==
this
.
private_IsOnFootnoteSelected
()
||
null
===
this
.
CurFootnote
)
return
;
var
oFootnote
=
this
.
CurFootnote
;
var
oParagraph
=
oFootnote
.
Get_FirstParagraph
();
if
(
!
oParagraph
)
return
;
var
oRun
=
new
ParaRun
(
oParagraph
,
false
);
oRun
.
Add_ToContent
(
0
,
new
ParaFootnoteRef
(
oFootnote
),
false
);
oParagraph
.
Add_ToContent
(
0
,
oRun
);
};
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Private area
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
...
...
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