Skip to content

Commit

Permalink
refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
easylogic committed Sep 8, 2015
1 parent cdf7bc4 commit 9fcd158
Show file tree
Hide file tree
Showing 46 changed files with 11,283 additions and 0 deletions.
3 changes: 3 additions & 0 deletions _common.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php
include_once("../../../common.php");
?>
12 changes: 12 additions & 0 deletions composer.json
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name" : "gnuboard-summernote",
"description" : "Summernote Plugin for gnuboard",
"keywords" : ["wysiwyg", "summernote", "editor"],
"license" : "MIT",
"authors" : [
{
"name" : "easylogic",
"email" : "cyberuls@gmail.com"
}
]
}
31 changes: 31 additions & 0 deletions config.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,31 @@
(function ($) {
$(document).ready(function () {
$(".summernote").summernote({
lang: 'ko-KR',
height: 300,
// toolbar
toolbar: [
['style', ['style']],
['font', ['bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', 'clear']],
['fontname', ['fontname']],
['fontsize', ['fontsize']],
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['height', ['height']],
['table', ['table']],
['insert', ['link', 'picture', 'video']],
['view', ['fullscreen', 'codeview']],
['help', ['help']]
],
onImageUpload: function (files) {

// TODO: implements insert image
for (var i = 0; i < files.length; i++) {
sendFile(files[i], this);
}
}
});


});
})(jQuery);
73 changes: 73 additions & 0 deletions editor.lib.php
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,73 @@
<?php
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가

function editor_html($id, $content, $is_dhtml_editor=true)
{
global $g5, $config;
static $js = true;

$editor_url = G5_EDITOR_URL.'/'.$config['cf_editor'];

$html = "";
$html .= "<span class=\"sound_only\">Summernote 시작</span>";

if ($is_dhtml_editor && $js) {
$html .= "\n".'<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">';
$html .= "\n".'<link rel="stylesheet" href="'.$editor_url.'/summernote/summernote.css">';
$html .= "\n".'<link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.min.css" />';
$html .= "\n".'<script src="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/js/bootstrap.min.js"></script>';
$html .= "\n".'<script src="'.$editor_url.'/summernote/summernote.min.js"></script>';
$html .= "\n".'<script src="'.$editor_url.'/summernote/plugin/summernote-ext-video.js"></script>';
$html .= "\n".'<script src="'.$editor_url.'/suumernote/lang/summernote-ko-KR.js"></script>';
$html .= "\n".'<script>';

$html .= "\n".'function sendFile(file, editor) {';
$html .= "\n".'';
$html .= "\n".' data = new FormData();';
$html .= "\n".' data.append("file", file);';
$html .= "\n".' $.ajax({';
$html .= "\n".' data: data,';
$html .= "\n".' type: "POST",';
$html .= "\n".' url: "'.$editor_url.'/upload.php",';
$html .= "\n".' cache: false,';
$html .= "\n".' contentType: false,';
$html .= "\n".' processData: false,';
$html .= "\n".' success: function(url) {';
$html .= "\n".' $(editor).summernote("insertImage", url);';
$html .= "\n".' }';
$html .= "\n".' });';
$html .= "\n".'}';

$html .= "\n".'</script>';
$html .= "\n".'<script src="'.$editor_url.'/config.js"></script>';
$js = false;
}

$summernote_class = $is_dhtml_editor ? "summernote" : "";
$html .= "\n<textarea id=\"$id\" name=\"$id\" class=\"$summernote_class\" >$content</textarea>";
$html .= "\n<span class=\"sound_only\">Summernote 끝</span>";
return $html;
}


// textarea 로 값을 넘긴다. javascript 반드시 필요
function get_editor_js($id, $is_dhtml_editor=true)
{
if ($is_dhtml_editor) {
return "var {$id}_editor_data = $('#{$id}').code();";
} else {
return "var {$id}_editor = document.getElementById('{$id}');\n";
}
}


// textarea 의 값이 비어 있는지 검사
function chk_editor_js($id, $is_dhtml_editor=true)
{
if ($is_dhtml_editor) {
return "if (!{$id}_editor_data) { alert(\"내용을 입력해 주십시오.\"); $('#{$id}').summernote('focus'); return false; }\n";
} else {
return "if (!{$id}_editor.value) { alert(\"내용을 입력해 주십시오.\"); {$id}_editor.focus(); return false; }\n";
}
}
?>
97 changes: 97 additions & 0 deletions summernote/lang/summernote-ar-AR.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,97 @@
(function ($) {
$.extend($.summernote.lang, {
'ar-AR': {
font: {
bold: 'عريض',
italic: 'مائل',
underline: 'تحته خط',
clear: 'مسح التنسيق',
height: 'إرتفاع السطر',
name: 'الخط',
strikethrough: 'فى وسطه خط',
size: 'الحجم'
},
image: {
image: 'صورة',
insert: 'إضافة صورة',
resizeFull: 'الحجم بالكامل',
resizeHalf: 'تصغير للنصف',
resizeQuarter: 'تصغير للربع',
floatLeft: 'تطيير لليسار',
floatRight: 'تطيير لليمين',
floatNone: 'ثابته',
dragImageHere: 'إدرج الصورة هنا',
selectFromFiles: 'حدد ملف',
url: 'رابط الصورة',
remove: 'حذف الصورة'
},
link: {
link: 'رابط رابط',
insert: 'إدراج',
unlink: 'حذف الرابط',
edit: 'تعديل',
textToDisplay: 'النص',
url: 'مسار الرابط',
openInNewWindow: 'فتح في نافذة جديدة'
},
table: {
table: 'جدول'
},
hr: {
insert: 'إدراج خط أفقي'
},
style: {
style: 'تنسيق',
normal: 'عادي',
blockquote: 'إقتباس',
pre: 'شفيرة',
h1: 'عنوان رئيسي 1',
h2: 'عنوان رئيسي 2',
h3: 'عنوان رئيسي 3',
h4: 'عنوان رئيسي 4',
h5: 'عنوان رئيسي 5',
h6: 'عنوان رئيسي 6'
},
lists: {
unordered: 'قائمة مُنقطة',
ordered: 'قائمة مُرقمة'
},
options: {
help: 'مساعدة',
fullscreen: 'حجم الشاشة بالكامل',
codeview: 'شفيرة المصدر'
},
paragraph: {
paragraph: 'فقرة',
outdent: 'محاذاة للخارج',
indent: 'محاذاة للداخل',
left: 'محاذاة لليسار',
center: 'توسيط',
right: 'محاذاة لليمين',
justify: 'ملئ السطر'
},
color: {
recent: 'تم إستخدامه',
more: 'المزيد',
background: 'لون الخلفية',
foreground: 'لون النص',
transparent: 'شفاف',
setTransparent: 'بدون خلفية',
reset: 'إعادة الضبط',
resetToDefault: 'إعادة الضبط'
},
shortcut: {
shortcuts: 'إختصارات',
close: 'غلق',
textFormatting: 'تنسيق النص',
action: 'Action',
paragraphFormatting: 'تنسيق الفقرة',
documentStyle: 'تنسيق المستند'
},
history: {
undo: 'تراجع',
redo: 'إعادة'
}
}
});
})(jQuery);
99 changes: 99 additions & 0 deletions summernote/lang/summernote-bg-BG.js
Original file line number Original file line Diff line number Diff line change
@@ -0,0 +1,99 @@
(function ($) {
$.extend($.summernote.lang, {
'bg-BG': {
font: {
bold: 'Удебелен',
italic: 'Наклонен',
underline: 'Подчертан',
clear: 'Изчисти стиловете',
height: 'Височина',
name: 'Шрифт',
strikethrough: 'Задраскано',
subscript: 'Долен индекс',
superscript: 'Горен индекс',
size: 'Размер на шрифта'
},
image: {
image: 'Изображение',
insert: 'Постави картинка',
resizeFull: 'Цял размер',
resizeHalf: 'Размер на 50%',
resizeQuarter: 'Размер на 25%',
floatLeft: 'Подравни в ляво',
floatRight: 'Подравни в дясно',
floatNone: 'Без подравняване',
dragImageHere: 'Пуснете изображението тук',
selectFromFiles: 'Изберете файл',
url: 'URL адрес на изображение',
remove: 'Премахни изображение'
},
link: {
link: 'Връзка',
insert: 'Добави връзка',
unlink: 'Премахни връзка',
edit: 'Промени',
textToDisplay: 'Текст за показване',
url: 'URL адрес',
openInNewWindow: 'Отвори в нов прозорец'
},
table: {
table: 'Таблица'
},
hr: {
insert: 'Добави хоризонтална линия'
},
style: {
style: 'Стил',
normal: 'Нормален',
blockquote: 'Цитат',
pre: 'Код',
h1: 'Заглавие 1',
h2: 'Заглавие 2',
h3: 'Заглавие 3',
h4: 'Заглавие 4',
h5: 'Заглавие 5',
h6: 'Заглавие 6'
},
lists: {
unordered: 'Символен списък',
ordered: 'Цифров списък'
},
options: {
help: 'Помощ',
fullscreen: 'На цял екран',
codeview: 'Преглед на код'
},
paragraph: {
paragraph: 'Параграф',
outdent: 'Намаляване на отстъпа',
indent: 'Абзац',
left: 'Подравняване в ляво',
center: 'Център',
right: 'Подравняване в дясно',
justify: 'Разтягане по ширина'
},
color: {
recent: 'Последния избран цвят',
more: 'Още цветове',
background: 'Цвят на фона',
foreground: 'Цвят на шрифта',
transparent: 'Прозрачен',
setTransparent: 'Направете прозрачен',
reset: 'Възстанови',
resetToDefault: 'Възстанови оригиналните'
},
shortcut: {
shortcuts: 'Клавишни комбинации',
close: 'Затвори',
textFormatting: 'Форматиране на текста',
action: 'Действие',
paragraphFormatting: 'Форматиране на параграф',
documentStyle: 'Стил на документа'
},
history: {
undo: 'Назад',
redo: 'Напред'
}
}
});
})(jQuery);
Loading

0 comments on commit 9fcd158

Please sign in to comment.