-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtinymce.js
More file actions
27 lines (22 loc) · 847 Bytes
/
tinymce.js
File metadata and controls
27 lines (22 loc) · 847 Bytes
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
function init() {
tinyMCEPopup.resizeToInnerSize();
}
function escapeHtml(text) {
return text.replace(/&/g, "&").replace(/"/g, """).replace(/'/g, "'").replace(/</g, "<").replace(/>/g, ">");
}
function insertwpgcpcode() {
var tagtext;
var langname_ddb = document.getElementById('wpgcp_lang');
var langname = langname_ddb.value;
var linenumber = document.getElementById('wpgcp_linenumber').value;
var html = escapeHtml(document.getElementById('wpgcp_code').value);
if(langname_ddb=='123'){
tagtext = '<pre class="prettyprint lang-'+ langname + ' linenums:' + linenumber + '" >' + html + '</pre>';
}else{
tagtext = '<pre>' + html + '</pre>';
}
window.tinymce.activeEditor.insertContent(tagtext);
tinyMCEPopup.editor.execCommand('mceRepaint');
tinyMCEPopup.close();
return;
}