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
b472fa37
Commit
b472fa37
authored
Aug 29, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug 35717
parent
9af902a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
98 additions
and
5 deletions
+98
-5
cell/model/clipboard.js
cell/model/clipboard.js
+98
-5
No files found.
cell/model/clipboard.js
View file @
b472fa37
...
...
@@ -405,11 +405,26 @@
{
if
(
ws
.
getCellEditMode
()
===
true
)
{
var
text
=
data1
.
innerText
;
if
(
text
)
{
window
[
"
Asc
"
][
"
editor
"
].
wb
.
cellEditor
.
pasteText
(
text
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
Paste_Process_End
();
//fragments = пока только для плагина вставка символов
var
fragments
;
if
(
window
[
'
AscCommon
'
].
g_clipboardBase
.
bSaveFormat
){
fragments
=
this
.
pasteProcessor
.
_getFragmentsFromHtml
(
data1
);
}
if
(
fragments
){
var
pasteFragments
=
fragments
.
fragments
;
var
newFonts
=
fragments
.
fonts
;
ws
.
_loadFonts
(
newFonts
,
function
()
{
window
[
"
Asc
"
][
"
editor
"
].
wb
.
cellEditor
.
paste
(
pasteFragments
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
Paste_Process_End
();
});
}
else
{
var
text
=
data1
.
innerText
;
if
(
text
)
{
window
[
"
Asc
"
][
"
editor
"
].
wb
.
cellEditor
.
pasteText
(
text
);
window
[
'
AscCommon
'
].
g_clipboardBase
.
Paste_Process_End
();
}
}
}
else
...
...
@@ -2854,6 +2869,84 @@
aResult
.
props
.
rowSpanSpCount
=
0
;
return
aResult
;
},
_getFragmentsFromHtml
:
function
(
html
){
//даная функция рассчитана только на вставку символа из плагина
//TODO для вставки полноценной html нужно писать обработку
var
res
=
null
;
if
(
html
&&
html
.
children
){
for
(
var
i
=
0
;
i
<
html
.
children
.
length
;
i
++
){
if
(
!
res
){
res
=
{
fragments
:
[],
fonts
:
{}};
}
var
children
=
html
.
children
[
i
];
var
computedStyle
=
this
.
_getComputedStyle
(
children
);
var
fragment
=
new
AscCommonExcel
.
Fragment
();
var
format
=
new
AscCommonExcel
.
Font
();
if
(
computedStyle
){
var
bold
=
computedStyle
.
getPropertyValue
(
"
font-weight
"
);
if
(
"
bold
"
===
bold
){
format
.
setBold
(
true
);
}
/*var color = computedStyle.getPropertyValue("color");
if(color){
format.setColor(color);
}*/
var
italic
=
computedStyle
.
getPropertyValue
(
"
font-style
"
);
if
(
"
italic
"
===
italic
){
format
.
setItalic
(
true
);
}
var
fontFamily
=
computedStyle
.
getPropertyValue
(
"
font-family
"
);
if
(
fontFamily
){
format
.
setName
(
fontFamily
);
res
.
fonts
[
fontFamily
]
=
1
;
}
/*var fontSize = computedStyle.getPropertyValue("font-size");
if(fontSize){
format.setSize(fontSize);
}*/
var
text_decoration
=
computedStyle
.
getPropertyValue
(
"
text-decoration
"
);
if
(
text_decoration
){
var
underline
,
Strikeout
;
if
(
-
1
!==
text_decoration
.
indexOf
(
"
underline
"
)){
underline
=
true
;
}
else
if
(
-
1
!==
text_decoration
.
indexOf
(
"
none
"
)){
underline
=
false
;
}
if
(
-
1
!==
text_decoration
.
indexOf
(
"
line-through
"
)){
Strikeout
=
true
;
}
if
(
underline
){
format
.
setUnderline
(
true
);
}
if
(
Strikeout
){
format
.
setUnderline
(
true
);
}
}
}
fragment
.
text
=
children
.
innerText
;
fragment
.
format
=
format
;
res
.
fragments
.
push
(
fragment
);
}
}
return
res
;
},
_getComputedStyle
:
function
(
node
){
var
computedStyle
=
null
;
if
(
null
!=
node
&&
Node
.
ELEMENT_NODE
===
node
.
nodeType
)
{
var
defaultView
=
node
.
ownerDocument
.
defaultView
;
computedStyle
=
defaultView
.
getComputedStyle
(
node
,
null
);
}
return
computedStyle
;
}
};
...
...
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