Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

tinyMCE 플러그인에 CodeMirror 소스코드 하이라이터 플러그인 추가 + 새 관리자 스킨 밑작업 #1698

Merged
merged 9 commits into from
Oct 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion interface/owner/entry/edit/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ function returnToList() {
</select></dd>
</dl>
<div id="formatbox-container" class="container"></div>
<textarea id="editWindow" name="content" cols="80" rows="20"><?php echo htmlspecialchars($entry['content']);?></textarea>
<div class="editor-inner"><textarea id="editWindow" name="content" cols="80" rows="20"><?php echo htmlspecialchars($entry['content']);?></textarea></div>
<div id="status-container" class="container"><span id="pathStr"><?php echo _t('path');?></span><span class="divider"> : </span><span id="pathContent"></span></div>
<?php
$view = fireEvent('AddPostEditorToolbox', '');
Expand Down
Binary file added plugins/ED_tinyMCE-EX/images/icon_plugin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/ED_tinyMCE-EX/images/icon_plugin_off.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added plugins/ED_tinyMCE-EX/images/icon_plugin_on.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
161 changes: 161 additions & 0 deletions plugins/ED_tinyMCE-EX/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<?php
function tinyMCE_handleconfig($configVal) {
$config = Setting::fetchConfigVal($configVal);
if (isset($config['editormode']) && $config['editormode'] != 'simple' && $config['editormode'] != 'advanced') return false;
return true;
}

function tinyMCE_editorinit($editor) {
global $configVal, $entry, $pluginURL, $pluginPath;
$context = Model_Context::getInstance();
$blogid = getBlogId();
$config = Setting::fetchConfigVal($configVal);
if(empty($config['editormode'])) $config['editormode'] = 'simple';
if(empty($config['width'])) $config['width'] = 'skin';
ob_start();
?>
var editor = new tinymce.Editor('editWindow', {
// General options
selector : "textarea#editWindow",
mode : 'exact',
theme : 'modern',
<?php
if (file_exists($pluginPath.'/tinymce/langs/'.$context->getProperty('blog.language').'.js')) {
?>
language : '<?php echo strtolower($context->getProperty('blog.language'));?>',
<?php
}
?>
popup_css_add: "<?php echo $pluginURL;?>/popup.css",
menubar: false,
resize: false,
//fixed_toolbar_container: "#formatbox-container",
toolbar_location : "external",
toolbar_items_size: 'small',
relative_urls: false,
convert_urls: false,
//schema: "html5",
extended_valid_elements : "div[class|style|align|width|height|id|more|less],img[class|src|border|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|longdesc|style],object",

<?php
if($config['editormode'] == 'simple') {
?>
plugins: [

"TTMLsupport advlist link image lists print hr anchor autoresize",
"code media visualblocks",
"table contextmenu directionality charmap textcolor",
"codemirror"

],
toolbar1: "tcsave print | undo redo | bold italic underline strikethrough | styleselect formatselect fontselect fontsizeselect forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent blockquote hr tcmoreless",
toolbar2: "image media charmap | hr link unlink anchor | table | removeformat | code visualblocks",
<?php
} else {
?>
plugins: [
"TTMLsupport advlist link image lists charmap print hr anchor pagebreak table",
"searchreplace wordcount visualblocks visualchars code insertdatetime media nonbreaking",
"table contextmenu directionality emoticons textcolor paste textcolor autoresize",
"codemirror"
],

toolbar1: "tcsave print | undo redo | bold italic underline strikethrough | styleselect formatselect fontselect fontsizeselect forecolor backcolor | alignleft aligncenter alignright alignjustify | bullist numlist | outdent indent blockquote hr tcmoreless",
toolbar2: "searchreplace | image media charmap insertdatetime | subscript superscript ltr rtl cite abbr acronym del ins | hr link unlink anchor | table | cut copy paste pastetext| removeformat code visualblocks",


<?php } ?>

// codemirror settings
codemirror: {
indentOnInit: true, // Whether or not to indent code on init.
path: 'codemirror-3.24', // Path to CodeMirror distribution
config: { // CodeMirror config object
mode: 'application/x-httpd-php',
lineNumbers: true,
tabSize: 4,
indentWithTabs: true,
theme: '<?php echo $config['srctheme'] ?>'

},
jsFiles: [ // Additional JS files to load
'mode/clike/clike.js',
'mode/php/php.js'
],
cssFiles: [
'theme/<?php echo $config['srctheme'] ?>.css'
]
},


// content CSS
content_css : "<?php echo (file_exists(__TEXTCUBE_SKIN_DIR__.'/'.$context->getProperty('skin.skin').'/wysiwyg.css') ? $context->getProperty('uri.service').'/skin/blog/'.$context->getProperty('skin.skin').'/wysiwyg.css' : $context->getProperty('uri.service').'/resources/style/default-wysiwyg.css');?>",

// Style formats
style_formats: [
{title: 'Headers', items: [
{title: 'h1', block: 'h1'},
{title: 'h2', block: 'h2'},
{title: 'h3', block: 'h3'},
{title: 'h4', block: 'h4'},
{title: 'h5', block: 'h5'},
{title: 'h6', block: 'h6'}
]},

{title: 'Blocks', items: [
{title: 'p', block: 'p'},
{title: 'div', block: 'div'},
{title: 'pre', block: 'pre'}
]},

{title: 'Containers', items: [
{title: 'section', block: 'section', wrapper: true, merge_siblings: false},
{title: 'article', block: 'article', wrapper: true, merge_siblings: false},
{title: 'blockquote', block: 'blockquote', wrapper: true},
{title: 'hgroup', block: 'hgroup', wrapper: true},
{title: 'aside', block: 'aside', wrapper: true},
{title: 'figure', block: 'figure', wrapper: true}
]}
],
forced_root_block : false,
width : <?php echo ($config['width'] == 'full' ? '"100%"' : $context->getProperty('skin.contentWidth')+40);?>
}, tinymce.EditorManager);
editor.initialize = function() {
this.render();
};
editor.addObject = function(data) {
this.plugins.TTMLsupport.addObject(data);
};
editor.finalize = function() {
this.syncTextarea();
this.destroy();
};
editor.syncTextarea = function(){
this.save();
};
editor.syncEditorWindow = function() {
this.load();
};
editor.on('keyup',editorChanged);
editor.on('mousedown',editorChanged);
editor.propertyFilePath = "<?php echo $context->getProperty('uri.service');?>/attach/<?php echo $context->getProperty('blog.id');?>/";
editor.fixPosition = <?php echo Setting::getBlogSettingGlobal('editorPropertyPositionFix', 0);?>;
return editor;
<?php
$result = ob_get_contents();
ob_end_clean();
return $result;
}

function tinyMCE_adminheader($target, $mother) {
global $suri, $pluginURL;
$context = Model_Context::getInstance();
if ($context->getProperty('editor.key') == 'tinyMCE') {
if ($suri['directive'] == '/owner/entry/post' || $suri['directive'] == '/owner/entry/edit') {
$target .= "\t<script type=\"text/javascript\" src=\"$pluginURL/tinymce/tinymce.min.js\"></script>\n";
$target .= "\t<link rel=\"stylesheet\" type=\"text/css\" media=\"screen\" href=\"$pluginURL/override.css\" />\n";
}
}
return $target;
}
?>
76 changes: 76 additions & 0 deletions plugins/ED_tinyMCE-EX/index.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="utf-8"?>
<plugin version="1.1">
<title xml:lang="en">tinyMCE Editor EX</title>
<title xml:lang="ko">tinyMCE 편집기 EX</title>
<link>http://needlworks.org/</link>
<version>1.10</version>
<description xml:lang="en">Provides an easy-to-use WYSIWYG editor interface.</description>
<description xml:lang="ko">Textcube용 tinyMCE 위지윅 에디터입니다. CodeMirror 라이브 소스코드 하이라이트 기능의 플러그인이 포함되어 있습니다. Edited by zvuc</description>
<description xml:lang="ja">tinyMCE WYSIWYGに編集環境を転換</description>
<license>GPLv2</license>
<author xml:lang="en" link="http://forest.nubimaru.com/">inureyes</author>
<author xml:lang="ko" link="http://forest.nubimaru.com/"><![CDATA[inureyes]]></author>
<safety changeData="yes" exposeData="no" accessLocal="yes" accessRemote="no" accessRaw="yes" />
<requirements>
<textcube>1.10</textcube>
</requirements>
<binding>
<listener event="ShowAdminHeader">tinyMCE_adminheader</listener>

<editor xml:lang="en" id="tinyMCE" name="tinyMCE">
<initialize>tinyMCE_editorinit</initialize>
<usedFor formatter="ttml" />
<!--<usedFor formatter="markdown" />
<usedFor formatter="textile" />-->
</editor>
<editor xml:lang="ko" id="tinyMCE" name="tinyMCE">
<initialize>tinyMCE_editorinit</initialize>
<usedFor formatter="ttml" />
<!--usedFor formatter="markdown" />
<usedFor formatter="textile" />-->
</editor>
<editor xml:lang="ja" id="tinyMCE" name="tinyMCE">
<initialize>tinyMCE_editorinit</initialize>
<usedFor formatter="ttml" />
<!--usedFor formatter="markdown" />
<usedFor formatter="textile" />-->
</editor>
<config xml:lang="ko" dataValHandler="tinyMCE_handleconfig">
<window width="500" height="360" />
<fieldset legend="기본 설정">
<field title="에디터 편집 모드" type="select" name="editormode">
<op value="simple" checked="checked"><![CDATA[간단]]></op>
<op value="advanced"><![CDATA[고급]]></op>
</field>
</fieldset>
<fieldset legend="상세 설정">
<field title="에디터 폭" type="select" name="width">
<op value="skin" checked="checked"><![CDATA[스킨 지정 폭]]></op>
<op value="full"><![CDATA[화면 폭]]></op>
</field>
</fieldset>
<fieldset legend="소스코드 에디터 테마">
<field title="테마" type="select" name="srctheme">
<op value="default" checked="checked"><![CDATA[Default]]></op>
<op value="ambiance"><![CDATA[Ambiance]]></op>
<op value="base16-dark"><![CDATA[base16 Dark]]></op>
<op value="base16-light"><![CDATA[base16 Light]]></op>
<op value="cobalt"><![CDATA[Cobalt]]></op>
<op value="eclipse"><![CDATA[Eclipse]]></op>
<op value="elegant"><![CDATA[Elegant]]></op>
<op value="mdn-like"><![CDATA[MDN-Like]]></op>
<op value="monokai"><![CDATA[Monokai]]></op>
<op value="neat"><![CDATA[Neat]]></op>
<op value="neo"><![CDATA[Neo]]></op>
<op value="paraiso-light"><![CDATA[paraiso-light]]></op>
<op value="paraiso-dark"><![CDATA[paraiso-dark]]></op>
<op value="rubyblue"><![CDATA[rubyblue]]></op>
<op value="tomorrow-night"><![CDATA[Tomorrow Night]]></op>
<op value="tomorrow-night-bright"><![CDATA[Tomorrow Night Bright]]></op>
<op value="tomorrow-night-eighties"><![CDATA[Tomorrow Night Eighties]]></op>
<op value="twilight"><![CDATA[Twilight]]></op>
</field>
</fieldset>
</config>
</binding>
</plugin>
Loading