-
Notifications
You must be signed in to change notification settings - Fork 0
/
_WP_Editors.php
62 lines (54 loc) · 1.84 KB
/
_WP_Editors.php
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
54
55
56
57
58
59
60
61
62
<?php
//overwrites the internal WordPress Editors
class _WP_Editors
{
public static function editor($content, $editor_id, $settings)
{
$wysiwygParser = new WikiLingoWYSIWYG\Parser(null);
$wysiwygContent = $wysiwygParser->parse($content);
$siteUrl = get_site_url();
$scripts = $wysiwygParser->scripts->renderCss() . $wysiwygParser->scripts->renderScript();
echo <<<HTML
<div id="$editor_id-container" class="wp-editor-container">
<div>
<div id="$editor_id-wysiwyg" style="min-height: 300px;" class="poststuff">$wysiwygContent</div>
</div>
<div>
<textarea id="$editor_id" name="content">$content</textarea>
</div>
<input type="button" class="button" value="Toggle Editor" id="$editor_id-button"/>
<script>
var $ = jQuery;
(function($, document) {
$(function() {
var visual = document.getElementById('$editor_id-wysiwyg'),
source = document.getElementById('$editor_id'),
button = document.getElementById('$editor_id-button'),
reflectUrl = '$siteUrl/wp-content/plugins/wikiLingo/wikiLingoReflect.php',
folderUrl = '$siteUrl/wp-content/plugins/wikiLingo/vendor/wikilingo/wikilingo/',
editor = wikiLingoEditor(reflectUrl, folderUrl, visual, source),
visualParentStyle = visual.parentNode.style,
sourceParentStyle = source.parentNode.style,
wikiLingoBubbles = $('nav.wikiLingo-bubble');
sourceParentStyle.display = 'none';
button.onclick = function() {
if (sourceParentStyle.display === 'none') {
sourceParentStyle.display = '';
visualParentStyle.display = 'none';
wikiLingoBubbles.hide();
} else {
sourceParentStyle.display = 'none';
visualParentStyle.display = '';
wikiLingoBubbles.show();
}
};
});
})(jQuery, document);
</script>
$scripts
</div>
HTML;
}
}
global $_updated_user_settings;
$_updated_user_settings['editor_expand'] = 'off';