Skip to content

Commit

Permalink
refs #1543 : added - button injection to tinyMCE editor
Browse files Browse the repository at this point in the history
 -
  • Loading branch information
inureyes committed Mar 18, 2015
1 parent ee88e3d commit f4f0c1f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions plugins/WikiCube/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,28 @@ function WikiCube_FormatErrorPage($target) {
}

function WikiCube_AddButton($target) {
$result = '';
$context = Model_Context::getInstance();
if ($context->getProperty('suri.directive') == '/owner/entry/post' || $context->getProperty('suri.directive') == '/owner/entry/edit') {
ob_start();
?>
<script type="text/javascript">
editor.addCommand('wikicubeAddLink', function () {
insertTag(t.textarea,"[[","]]");
return true;
selectedContent = editor.selection.getContent();
editor.execCommand('mceInsertContent', false, "[[" + selectedContent + "]]");
});
editor.addButton('wikicubeAddWikiLink', {
title: 'Add Wiki Link',
cmd: 'wikicubeAddLink',
icon: 'save'
});
editor.settings.toolbar1 = editor.settings.toolbar1 + ' wikicubeAddWikiLink';
editor.render();
editor.settings.toolbar2 = editor.settings.toolbar2 + ' wikicubeAddWikiLink';
//editor.render();
</script>
<?php
$result = ob_get_contents();
ob_end_clean();
ob_end_clean();
}
return $target.$result;
}

Expand Down

0 comments on commit f4f0c1f

Please sign in to comment.