-
Notifications
You must be signed in to change notification settings - Fork 4
/
issuu.js
53 lines (37 loc) · 1.29 KB
/
issuu.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
SirTrevor.Blocks.Issuu = (function(){
return SirTrevor.Block.extend({
provider: {
regex: /issuu.com\/(?:.+)e=(.+)/,
html: "<div data-configid=\"{{remote_id}}\" style=\"width: 525px; height: 353px;\" class=\"issuuembed\"></div><script type=\"text/javascript\" src=\"//e.issuu.com/embed.js\" async=\"true\"></script>"
},
type: "issuu",
title: "Issuu",
pastable: true,
paste_options: {
html: "<div style=\"text-align:center; padding:20px;\">Enter <b>Issuu</b> link for embed code<br /><input type=\"text\" class=\"st-paste-block\" style=\"width: 100%\"></div>"
},
icon_name: "image",
loadData: function(data) {
var embed_string = this.provider.html
.replace("{{remote_id}}", data.remote_id);
this.$editor.html(embed_string);
},
onContentPasted: function(event){
this.handleDropPaste($(event.target).val());
},
handleDropPaste: function(url){
var match, data;
match = this.provider.regex.exec(url);
if (match !== null && !_.isUndefined(match[1])) {
data = {
remote_id: match[1]
};
this.setAndLoadData(data);
}
},
onDrop: function(transferData){
var url = transferData.getData("text/plain");
this.handleDropPaste(url);
}
});
})();