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
3d9f5096
Commit
3d9f5096
authored
Sep 27, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add _pasteText function for paste into document editor
parent
cd51d194
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
6 deletions
+63
-6
common/wordcopypaste.js
common/wordcopypaste.js
+60
-6
word/api.js
word/api.js
+3
-0
No files found.
common/wordcopypaste.js
View file @
3d9f5096
...
...
@@ -1786,7 +1786,7 @@ function CopyPasteCorrectString(str)
return
res
;
}
function
Editor_Paste_Exec
(
api
,
pastebin
,
nodeDisplay
,
onlyBinary
,
specialPasteProps
)
function
Editor_Paste_Exec
(
api
,
pastebin
,
nodeDisplay
,
onlyBinary
,
specialPasteProps
,
text
)
{
var
oPasteProcessor
=
new
PasteProcessor
(
api
,
true
,
true
,
false
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
endRecalcDocument
=
false
;
...
...
@@ -1796,7 +1796,7 @@ function Editor_Paste_Exec(api, pastebin, nodeDisplay, onlyBinary, specialPasteP
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
nodeDisplay
=
nodeDisplay
;
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
onlyBinary
=
onlyBinary
;
oPasteProcessor
.
Start
(
pastebin
,
nodeDisplay
,
null
,
onlyBinary
);
oPasteProcessor
.
Start
(
pastebin
,
nodeDisplay
,
null
,
onlyBinary
,
null
,
text
);
}
else
{
...
...
@@ -1805,7 +1805,7 @@ function Editor_Paste_Exec(api, pastebin, nodeDisplay, onlyBinary, specialPasteP
pastebin
=
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
pastebin
;
nodeDisplay
=
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
nodeDisplay
;
onlyBinary
=
window
[
'
AscCommon
'
].
g_clipboardBase
.
specialPasteData
.
onlyBinary
;
oPasteProcessor
.
Start
(
pastebin
,
nodeDisplay
,
null
,
onlyBinary
,
specialPasteProps
);
oPasteProcessor
.
Start
(
pastebin
,
nodeDisplay
,
null
,
onlyBinary
,
specialPasteProps
,
text
);
}
}
function
trimString
(
str
){
...
...
@@ -3050,11 +3050,16 @@ PasteProcessor.prototype =
}
},
Start
:
function
(
node
,
nodeDisplay
,
bDuplicate
,
fromBinary
)
Start
:
function
(
node
,
nodeDisplay
,
bDuplicate
,
fromBinary
,
text
)
{
//PASTE
if
(
text
){
this
.
_pasteText
(
text
);
return
;
}
var
bInsertFromBinary
=
false
;
if
(
!
node
&&
""
===
fromBinary
)
{
return
;
...
...
@@ -4393,7 +4398,56 @@ PasteProcessor.prototype =
return
{
base64FromExcel
:
base64FromExcel
,
base64FromWord
:
base64FromWord
,
base64FromPresentation
:
base64FromPresentation
};
},
_pasteText
:
function
(
text
)
{
var
oThis
=
this
;
var
fPasteTextWordCallback
=
function
()
{
oThis
.
aContent
=
[];
if
(
bTurnOffTrackRevisions
){
oThis
.
api
.
WordControl
.
m_oLogicDocument
.
TrackRevisions
=
false
;
}
oThis
.
_getContentFromText
(
text
);
oThis
.
_AddNextPrevToContent
(
oThis
.
oDocument
);
if
(
false
===
oThis
.
bNested
)
{
oThis
.
InsertInDocument
();
}
if
(
bTurnOffTrackRevisions
){
oThis
.
api
.
WordControl
.
m_oLogicDocument
.
TrackRevisions
=
true
;
}
};
fPasteTextWordCallback
();
},
_getContentFromText
:
function
(
text
){
var
Count
=
text
.
length
;
var
newParagraph
=
new
Paragraph
(
this
.
oDocument
.
DrawingDocument
,
this
.
oDocument
);
var
insertText
=
""
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
var
_char
=
text
.
charAt
(
Index
);
var
_charCode
=
text
.
charCodeAt
(
Index
);
if
(
_charCode
===
10
||
Index
===
Count
-
1
){
var
newParaRun
=
new
ParaRun
();
this
.
_addTextIntoRun
(
newParaRun
,
insertText
);
newParagraph
.
Internal_Content_Add
(
newParagraph
.
Content
.
length
-
1
,
newParaRun
,
false
);
this
.
aContent
.
push
(
newParagraph
);
insertText
=
""
;
newParagraph
=
new
Paragraph
(
this
.
oDocument
.
DrawingDocument
,
this
.
oDocument
);
}
else
{
insertText
+=
_char
;
}
}
},
_isParagraphContainsOnlyDrawing
:
function
(
par
)
{
var
res
=
true
;
...
...
word/api.js
View file @
3d9f5096
...
...
@@ -2089,6 +2089,9 @@ background-repeat: no-repeat;\
case
AscCommon
.
c_oAscClipboardDataFormat
.
Internal
:
AscCommon
.
Editor_Paste_Exec
(
this
,
null
,
null
,
data1
);
break
;
case
AscCommon
.
c_oAscClipboardDataFormat
.
Text
:
AscCommon
.
Editor_Paste_Exec
(
this
,
null
,
null
,
null
,
null
,
data1
);
break
;
default
:
break
;
}
...
...
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