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
c29c2e79
Commit
c29c2e79
authored
Aug 11, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added ability to insert inline content to the document.
parent
ee5e8b67
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
10 deletions
+47
-10
word/Editor/ParagraphContentBase.js
word/Editor/ParagraphContentBase.js
+4
-0
word/Editor/StructuredDocumentTags/InlineLevel.js
word/Editor/StructuredDocumentTags/InlineLevel.js
+5
-0
word/api.js
word/api.js
+32
-8
word/apiBuilder.js
word/apiBuilder.js
+6
-2
No files found.
word/Editor/ParagraphContentBase.js
View file @
c29c2e79
...
@@ -2946,6 +2946,10 @@ CParagraphContentWithParagraphLikeContent.prototype.AddContentControl = function
...
@@ -2946,6 +2946,10 @@ CParagraphContentWithParagraphLikeContent.prototype.AddContentControl = function
return
oContentControl
;
return
oContentControl
;
}
}
};
};
CParagraphContentWithParagraphLikeContent
.
prototype
.
GetElementsCount
=
function
()
{
return
this
.
Content
.
length
;
};
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// Функции, которые должны быть реализованы в классах наследниках
// Функции, которые должны быть реализованы в классах наследниках
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/StructuredDocumentTags/InlineLevel.js
View file @
c29c2e79
...
@@ -339,6 +339,11 @@ CInlineLevelSdt.prototype.FindNextFillingForm = function(isNext, isCurrent, isSt
...
@@ -339,6 +339,11 @@ CInlineLevelSdt.prototype.FindNextFillingForm = function(isNext, isCurrent, isSt
return
null
;
return
null
;
};
};
CInlineLevelSdt
.
prototype
.
GetAllContentControls
=
function
(
arrContentControls
)
{
arrContentControls
.
push
(
this
);
CParagraphContentWithParagraphLikeContent
.
prototype
.
GetAllContentControls
.
apply
(
this
,
arguments
);
};
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// Выставление настроек
// Выставление настроек
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
...
...
word/api.js
View file @
c29c2e79
...
@@ -520,21 +520,45 @@
...
@@ -520,21 +520,45 @@
var
_script
=
"
(function(){ var Api = window.g_asc_plugins.api;
\n
"
+
_current
[
"
Script
"
]
+
"
\n
})();
"
;
var
_script
=
"
(function(){ var Api = window.g_asc_plugins.api;
\n
"
+
_current
[
"
Script
"
]
+
"
\n
})();
"
;
eval
(
_script
);
eval
(
_script
);
if
(
_isReplaced
)
if
(
AscCommonWord
.
sdttype_BlockLevel
===
_blockStd
.
GetContentControlType
()
)
{
{
if
(
_blockStd
.
Content
.
Get_ElementsCount
()
>
1
)
if
(
_isReplaced
)
_blockStd
.
Content
.
Remove_FromContent
(
_blockStd
.
Content
.
Get_ElementsCount
()
-
1
,
1
);
{
if
(
_blockStd
.
Content
.
Get_ElementsCount
()
>
1
)
_blockStd
.
Content
.
Remove_FromContent
(
_blockStd
.
Content
.
Get_ElementsCount
()
-
1
,
1
);
_blockStd
.
MoveCursorToStartPos
(
false
);
_blockStd
.
MoveCursorToStartPos
(
false
);
}
else
{
if
(
_blockStd
.
Content
.
Get_ElementsCount
()
>
1
)
{
_blockStd
.
Content
.
Remove_FromContent
(
_blockStd
.
Content
.
Get_ElementsCount
()
-
1
,
1
);
_blockStd
.
MoveCursorToEndPos
(
false
,
false
);
}
LogicDocument
.
MoveCursorRight
(
false
,
false
,
true
);
}
}
}
else
else
{
{
if
(
_
blockStd
.
Content
.
Get_ElementsCount
()
>
1
)
if
(
_
isReplaced
)
{
{
_blockStd
.
Content
.
Remove_FromContent
(
_blockStd
.
Content
.
Get_ElementsCount
()
-
1
,
1
);
if
(
_blockStd
.
GetElementsCount
()
>
1
)
_blockStd
.
MoveCursorToEndPos
(
false
,
false
);
_blockStd
.
Remove_FromContent
(
_blockStd
.
GetElementsCount
()
-
1
,
1
);
_blockStd
.
MoveCursorToStartPos
();
_blockStd
.
SetThisElementCurrent
();
}
else
{
if
(
_blockStd
.
Content
.
GetElementsCount
()
>
1
)
{
_blockStd
.
Remove_FromContent
(
_blockStd
.
GetElementsCount
()
-
1
,
1
);
_blockStd
.
MoveCursorToEndPos
();
_blockStd
.
SetThisElementCurrent
();
}
LogicDocument
.
MoveCursorRight
(
false
,
false
,
true
);
}
}
LogicDocument
.
MoveCursorRight
(
false
,
false
,
true
);
}
}
var
_worker
=
_api
.
__content_control_worker
;
var
_worker
=
_api
.
__content_control_worker
;
...
...
word/apiBuilder.js
View file @
c29c2e79
...
@@ -1340,9 +1340,10 @@
...
@@ -1340,9 +1340,10 @@
/**
/**
* Insert an array of elements in the current position of the document.
* Insert an array of elements in the current position of the document.
* @param {DocumentElement[]} arrContent - An array of elements to insert.
* @param {DocumentElement[]} arrContent - An array of elements to insert.
* @param {boolean} [isInline=false] - Inline insert on not (works only when the length of arrContent = 1 and it's a paragraph)
* @returns {boolean} Success?
* @returns {boolean} Success?
*/
*/
ApiDocument
.
prototype
.
InsertContent
=
function
(
arrContent
)
ApiDocument
.
prototype
.
InsertContent
=
function
(
arrContent
,
isInline
)
{
{
var
oSelectedContent
=
new
CSelectedContent
();
var
oSelectedContent
=
new
CSelectedContent
();
for
(
var
nIndex
=
0
,
nCount
=
arrContent
.
length
;
nIndex
<
nCount
;
++
nIndex
)
for
(
var
nIndex
=
0
,
nCount
=
arrContent
.
length
;
nIndex
<
nCount
;
++
nIndex
)
...
@@ -1350,7 +1351,10 @@
...
@@ -1350,7 +1351,10 @@
var
oElement
=
arrContent
[
nIndex
];
var
oElement
=
arrContent
[
nIndex
];
if
(
oElement
instanceof
ApiParagraph
||
oElement
instanceof
ApiTable
)
if
(
oElement
instanceof
ApiParagraph
||
oElement
instanceof
ApiTable
)
{
{
oSelectedContent
.
Add
(
new
CSelectedElement
(
oElement
.
private_GetImpl
(),
true
));
if
(
true
===
isInline
&&
1
===
nCount
&&
oElement
instanceof
ApiParagraph
)
oSelectedContent
.
Add
(
new
CSelectedElement
(
oElement
.
private_GetImpl
(),
false
));
else
oSelectedContent
.
Add
(
new
CSelectedElement
(
oElement
.
private_GetImpl
(),
true
));
}
}
}
}
oSelectedContent
.
On_EndCollectElements
(
this
.
Document
,
true
);
oSelectedContent
.
On_EndCollectElements
(
this
.
Document
,
true
);
...
...
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