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
9e07e76b
Commit
9e07e76b
authored
Jan 17, 2017
by
GoshaZotov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add SpecialPasteProps
parent
8ba9ad44
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
188 additions
and
12 deletions
+188
-12
cell/model/clipboard.js
cell/model/clipboard.js
+134
-3
cell/view/WorksheetView.js
cell/view/WorksheetView.js
+54
-9
No files found.
cell/model/clipboard.js
View file @
9e07e76b
...
@@ -56,6 +56,127 @@
...
@@ -56,6 +56,127 @@
return
"
rgb(
"
+
(
n
>>
16
&
0xFF
)
+
"
,
"
+
(
n
>>
8
&
0xFF
)
+
"
,
"
+
(
n
&
0xFF
)
+
"
)
"
;
return
"
rgb(
"
+
(
n
>>
16
&
0xFF
)
+
"
,
"
+
(
n
>>
8
&
0xFF
)
+
"
,
"
+
(
n
&
0xFF
)
+
"
)
"
;
}
}
function
SpecialPasteProps
()
{
this
.
cellStyle
=
true
;
this
.
val
=
true
;
this
.
numFormat
=
true
;
this
.
formula
=
true
;
this
.
font
=
true
;
this
.
alignVertical
=
true
;
this
.
alignHorizontal
=
true
;
this
.
fontSize
=
true
;
this
.
merge
=
true
;
this
.
borders
=
true
;
this
.
wrap
=
true
;
this
.
fill
=
true
;
this
.
angle
=
true
;
}
SpecialPasteProps
.
prototype
=
{
constructor
:
SpecialPasteProps
,
clean
:
function
()
{
this
.
cellStyle
=
true
;
this
.
val
=
true
;
this
.
numFormat
=
true
;
this
.
formula
=
true
;
this
.
font
=
true
;
this
.
alignVertical
=
true
;
this
.
alignHorizontal
=
true
;
this
.
fontSize
=
true
;
this
.
merge
=
true
;
this
.
borders
=
true
;
this
.
wrap
=
true
;
this
.
fill
=
true
;
this
.
angle
=
true
;
},
revert
:
function
()
{
this
.
cellStyle
=
null
;
this
.
val
=
null
;
this
.
numFormat
=
null
;
this
.
formula
=
null
;
this
.
font
=
null
;
this
.
alignVertical
=
null
;
this
.
alignHorizontal
=
null
;
this
.
fontSize
=
null
;
this
.
merge
=
null
;
this
.
borders
=
null
;
this
.
wrap
=
null
;
this
.
fill
=
null
;
this
.
angle
=
null
;
},
setProps
:
function
(
props
)
{
switch
(
props
)
{
case
"
formulas
"
:
{
}
case
"
formulasNumberFormating
"
:
{
}
case
"
keepSourceFormating
"
:
{
}
case
"
noBorders
"
:
{
this
.
borders
=
null
;
}
case
"
keepSourceColumnWidth
"
:
{
}
case
"
keepSourceColumnWidths
"
:
{
}
case
"
transpose
"
:
{
}
case
"
values
"
:
{
this
.
revert
();
this
.
val
=
true
;
}
case
"
valuesSourceFormating
"
:
{
}
case
"
valuesNumberFormating
"
:
{
}
case
"
formating
"
:
{
}
case
"
pasteLink
"
:
{
}
case
"
picture
"
:
{
}
case
"
linkedPicture
"
:
{
}
}
},
}
/** @constructor */
/** @constructor */
function
Clipboard
()
function
Clipboard
()
...
@@ -63,6 +184,8 @@
...
@@ -63,6 +184,8 @@
this
.
copyProcessor
=
new
CopyProcessorExcel
();
this
.
copyProcessor
=
new
CopyProcessorExcel
();
this
.
pasteProcessor
=
new
PasteProcessorExcel
();
this
.
pasteProcessor
=
new
PasteProcessorExcel
();
this
.
specialPasteProps
=
null
;
return
this
;
return
this
;
}
}
...
@@ -207,6 +330,11 @@
...
@@ -207,6 +330,11 @@
break
;
break
;
}
}
}
}
if
(
null
===
this
.
specialPasteProps
)
{
this
.
pasteProcessor
.
oSpecialPaste
.
oPreSpecialPasteData
=
{
_format
:
_format
,
data1
:
data1
,
data2
:
data2
,
text_data
:
text_data
};
}
}
}
};
};
...
@@ -757,6 +885,8 @@
...
@@ -757,6 +885,8 @@
this
.
activeRange
=
null
;
this
.
activeRange
=
null
;
this
.
alreadyLoadImagesOnServer
=
false
;
this
.
alreadyLoadImagesOnServer
=
false
;
this
.
oSpecialPaste
=
{};
this
.
Api
=
window
[
"
Asc
"
][
"
editor
"
];
this
.
Api
=
window
[
"
Asc
"
][
"
editor
"
];
this
.
fontsNew
=
{};
this
.
fontsNew
=
{};
...
@@ -4064,5 +4194,6 @@
...
@@ -4064,5 +4194,6 @@
//---------------------------------------------------------export---------------------------------------------------
//---------------------------------------------------------export---------------------------------------------------
window
[
'
AscCommonExcel
'
]
=
window
[
'
AscCommonExcel
'
]
||
{};
window
[
'
AscCommonExcel
'
]
=
window
[
'
AscCommonExcel
'
]
||
{};
window
[
"
AscCommonExcel
"
].
Clipboard
=
Clipboard
;
window
[
"
AscCommonExcel
"
].
Clipboard
=
Clipboard
;
window
[
"
AscCommonExcel
"
].
SpecialPasteProps
=
SpecialPasteProps
;
}
}
)(
jQuery
,
window
);
)(
jQuery
,
window
);
cell/view/WorksheetView.js
View file @
9e07e76b
...
@@ -8633,10 +8633,16 @@
...
@@ -8633,10 +8633,16 @@
break
;
break
;
break
;
break
;
case
"
paste
"
:
case
"
paste
"
:
// Вставляем текст из локального буфера или нет
var
_clipboard
=
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
;
fromBinary
?
t
.
_pasteData
(
isLargeRange
,
fromBinary
,
val
,
bIsUpdate
,
canChangeColWidth
)
:
_clipboard
.
specialPasteProps
=
_clipboard
.
specialPasteProps
?
_clipboard
.
specialPasteProps
:
new
AscCommonExcel
.
SpecialPasteProps
();
t
.
_loadDataBeforePaste
(
isLargeRange
,
fromBinary
,
val
,
bIsUpdate
,
canChangeColWidth
);
t
.
_loadDataBeforePaste
(
isLargeRange
,
fromBinary
,
val
,
bIsUpdate
,
canChangeColWidth
);
bIsUpdate
=
false
;
bIsUpdate
=
false
;
break
;
case
"
specialPaste
"
:
// Вставляем текст из локального буфера или нет
t
.
specialPaste
();
bIsUpdate
=
false
;
break
;
break
;
case
"
hyperlink
"
:
case
"
hyperlink
"
:
if
(
val
&&
val
.
hyperlinkModel
)
{
if
(
val
&&
val
.
hyperlinkModel
)
{
...
@@ -8689,14 +8695,19 @@
...
@@ -8689,14 +8695,19 @@
History
.
EndTransaction
();
History
.
EndTransaction
();
}
}
};
};
//получаем диапазон вставки
if
(
"
paste
"
===
prop
&&
val
.
onlyImages
!==
true
)
{
if
(
"
paste
"
===
prop
&&
val
.
onlyImages
!==
true
)
{
// Для past свой диапазон
var
newRange
;
var
newRange
;
if
(
fromBinary
)
{
if
(
fromBinary
)
{
newRange
=
this
.
_pasteFromBinary
(
val
,
true
);
newRange
=
this
.
_pasteFromBinary
(
val
,
true
);
}
else
{
}
else
{
newRange
=
this
.
_pasteFromHTML
(
val
,
true
);
newRange
=
this
.
_pasteFromHTML
(
val
,
true
);
}
}
var
sBinary
=
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
.
copyProcessor
.
getBinaryForCopy
(
this
);
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
.
pasteProcessor
.
oSpecialPaste
.
undoBinary
=
sBinary
;
//this.oSpecialPaste.undoImgsId;
checkRange
=
[
newRange
];
checkRange
=
[
newRange
];
}
}
if
(
"
paste
"
===
prop
&&
val
.
onlyImages
===
true
)
{
if
(
"
paste
"
===
prop
&&
val
.
onlyImages
===
true
)
{
...
@@ -8706,8 +8717,34 @@
...
@@ -8706,8 +8717,34 @@
}
}
};
};
WorksheetView
.
prototype
.
specialPaste
=
function
(
props
)
{
var
api
=
window
[
"
Asc
"
][
"
editor
"
];
//откатываемся до того, что было до вставки
if
(
api
.
wb
.
clipboard
.
pasteProcessor
.
oSpecialPaste
.
undoBinary
)
{
//откатываем данные в ячейках
api
.
wb
.
clipboard
.
pasteProcessor
.
pasteFromBinary
(
this
,
api
.
wb
.
clipboard
.
pasteProcessor
.
oSpecialPaste
.
undoBinary
);
//удаляем вставленные изображения
}
//далее специальная вставка
var
tempProps
=
new
SpecialPasteProps
();
tempProps
.
setProps
(
"
values
"
);
api
.
wb
.
clipboard
.
specialPasteProps
=
tempProps
;
if
(
api
.
wb
.
clipboard
.
pasteProcessor
.
oSpecialPaste
.
oPreSpecialPasteData
)
{
var
oPreSpecialPasteData
=
api
.
wb
.
clipboard
.
pasteProcessor
.
oSpecialPaste
.
oPreSpecialPasteData
;
api
.
wb
.
clipboard
.
pasteData
(
this
,
oPreSpecialPasteData
.
_format
,
oPreSpecialPasteData
.
data1
,
oPreSpecialPasteData
.
data2
,
oPreSpecialPasteData
.
text_data
);
}
};
WorksheetView
.
prototype
.
_pasteData
=
function
(
isLargeRange
,
fromBinary
,
val
,
bIsUpdate
,
canChangeColWidth
)
{
WorksheetView
.
prototype
.
_pasteData
=
function
(
isLargeRange
,
fromBinary
,
val
,
bIsUpdate
,
canChangeColWidth
)
{
var
t
=
this
;
var
t
=
this
;
var
_clipboard
=
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
;
var
specialPasteProps
=
_clipboard
.
specialPasteProps
;
var
callTrigger
=
false
;
var
callTrigger
=
false
;
if
(
isLargeRange
)
{
if
(
isLargeRange
)
{
callTrigger
=
true
;
callTrigger
=
true
;
...
@@ -8783,9 +8820,9 @@
...
@@ -8783,9 +8820,9 @@
t
.
model
.
workbook
.
dependencyFormulas
.
lockRecal
();
t
.
model
.
workbook
.
dependencyFormulas
.
lockRecal
();
var
selectData
;
var
selectData
;
if
(
fromBinary
)
{
if
(
fromBinary
)
{
selectData
=
t
.
_pasteFromBinary
(
val
,
null
,
tablesMap
);
selectData
=
t
.
_pasteFromBinary
(
val
,
null
,
tablesMap
,
specialPasteProps
);
}
else
{
}
else
{
selectData
=
t
.
_pasteFromHTML
(
val
);
selectData
=
t
.
_pasteFromHTML
(
val
,
null
,
specialPasteProps
);
}
}
t
.
model
.
autoFilters
.
renameTableColumn
(
t
.
model
.
selectionRange
.
getLast
());
t
.
model
.
autoFilters
.
renameTableColumn
(
t
.
model
.
selectionRange
.
getLast
());
...
@@ -8837,6 +8874,14 @@
...
@@ -8837,6 +8874,14 @@
WorksheetView
.
prototype
.
_loadDataBeforePaste
=
function
(
isLargeRange
,
fromBinary
,
pasteContent
,
bIsUpdate
,
canChangeColWidth
)
{
WorksheetView
.
prototype
.
_loadDataBeforePaste
=
function
(
isLargeRange
,
fromBinary
,
pasteContent
,
bIsUpdate
,
canChangeColWidth
)
{
var
t
=
this
;
var
t
=
this
;
var
_clipboard
=
window
[
"
Asc
"
][
"
editor
"
].
wb
.
clipboard
;
var
specialPasteProps
=
_clipboard
.
specialPasteProps
;
if
(
fromBinary
)
{
t
.
_pasteData
(
isLargeRange
,
fromBinary
,
pasteContent
,
bIsUpdate
,
canChangeColWidth
);
return
;
}
//загрузка шрифтов, в случае удачи на callback вставляем текст
//загрузка шрифтов, в случае удачи на callback вставляем текст
t
.
_loadFonts
(
pasteContent
.
props
.
fontsNew
,
function
()
{
t
.
_loadFonts
(
pasteContent
.
props
.
fontsNew
,
function
()
{
...
@@ -8928,7 +8973,7 @@
...
@@ -8928,7 +8973,7 @@
}
);
}
);
};
};
WorksheetView
.
prototype
.
_pasteFromHTML
=
function
(
pasteContent
,
isCheckSelection
)
{
WorksheetView
.
prototype
.
_pasteFromHTML
=
function
(
pasteContent
,
isCheckSelection
,
specialPasteProps
)
{
var
t
=
this
;
var
t
=
this
;
var
wb
=
window
[
"
Asc
"
][
"
editor
"
].
wb
;
var
wb
=
window
[
"
Asc
"
][
"
editor
"
].
wb
;
var
lastSelection
=
this
.
model
.
selectionRange
.
getLast
();
var
lastSelection
=
this
.
model
.
selectionRange
.
getLast
();
...
@@ -9120,7 +9165,7 @@
...
@@ -9120,7 +9165,7 @@
return
arnFor
;
return
arnFor
;
};
};
WorksheetView
.
prototype
.
_pasteFromBinary
=
function
(
val
,
isCheckSelection
,
tablesMap
)
{
WorksheetView
.
prototype
.
_pasteFromBinary
=
function
(
val
,
isCheckSelection
,
tablesMap
,
specialPasteProps
)
{
var
t
=
this
;
var
t
=
this
;
var
arn
=
t
.
model
.
selectionRange
.
getLast
();
var
arn
=
t
.
model
.
selectionRange
.
getLast
();
var
arrFormula
=
[];
var
arrFormula
=
[];
...
...
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