diff options
Diffstat (limited to 'public/admin/view/javascript/summernote')
49 files changed, 12610 insertions, 0 deletions
diff --git a/public/admin/view/javascript/summernote/font/summernote.eot b/public/admin/view/javascript/summernote/font/summernote.eot Binary files differnew file mode 100644 index 0000000..f2b6e3b --- /dev/null +++ b/public/admin/view/javascript/summernote/font/summernote.eot diff --git a/public/admin/view/javascript/summernote/font/summernote.ttf b/public/admin/view/javascript/summernote/font/summernote.ttf Binary files differnew file mode 100644 index 0000000..5cc1981 --- /dev/null +++ b/public/admin/view/javascript/summernote/font/summernote.ttf diff --git a/public/admin/view/javascript/summernote/font/summernote.woff b/public/admin/view/javascript/summernote/font/summernote.woff Binary files differnew file mode 100644 index 0000000..f30de73 --- /dev/null +++ b/public/admin/view/javascript/summernote/font/summernote.woff diff --git a/public/admin/view/javascript/summernote/lang/summernote-ar-AR.js b/public/admin/view/javascript/summernote/lang/summernote-ar-AR.js new file mode 100644 index 0000000..ac6e6b5 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-ar-AR.js @@ -0,0 +1,104 @@ +(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: 'حذف الصورة' + }, + video: { + video: 'فيديو', + videoLink: 'رابط الفيديو', + insert: 'إدراج الفيديو', + url: 'رابط الفيديو', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)' + }, + link: { + link: 'رابط رابط', + insert: 'إدراج', + unlink: 'حذف الرابط', + edit: 'تعديل', + textToDisplay: 'النص', + url: 'مسار الرابط', + openInNewWindow: 'فتح في نافذة جديدة' + }, + table: { + table: 'جدول' + }, + hr: { + insert: 'إدراج خط أفقي' + }, + style: { + style: 'تنسيق', + p: 'عادي', + 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); diff --git a/public/admin/view/javascript/summernote/lang/summernote-bg-BG.js b/public/admin/view/javascript/summernote/lang/summernote-bg-BG.js new file mode 100644 index 0000000..daefd20 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-bg-BG.js @@ -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: 'Стил', + p: 'Нормален', + 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); diff --git a/public/admin/view/javascript/summernote/lang/summernote-ca-ES.js b/public/admin/view/javascript/summernote/lang/summernote-ca-ES.js new file mode 100644 index 0000000..04978a1 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-ca-ES.js @@ -0,0 +1,147 @@ +(function ($) { + $.extend($.summernote.lang, { + 'ca-ES': { + font: { + bold: 'Negreta', + italic: 'Cursiva', + underline: 'Subratllat', + clear: 'Treure estil de lletra', + height: 'Alçada de línia', + name: 'Font', + strikethrough: 'Ratllat', + subscript: 'Subíndex', + superscript: 'Superíndex', + size: 'Mida de lletra' + }, + image: { + image: 'Imatge', + insert: 'Inserir imatge', + resizeFull: 'Redimensionar a mida completa', + resizeHalf: 'Redimensionar a la meitat', + resizeQuarter: 'Redimensionar a un quart', + floatLeft: 'Alinear a l\'esquerra', + floatRight: 'Alinear a la dreta', + floatNone: 'No alinear', + shapeRounded: 'Forma: Arrodonit', + shapeCircle: 'Forma: Cercle', + shapeThumbnail: 'Forma: Marc', + shapeNone: 'Forma: Cap', + dragImageHere: 'Arrossegueu una imatge o text aquí', + dropImage: 'Deixa anar aquí una imatge o un text', + selectFromFiles: 'Seleccioneu des dels arxius', + maximumFileSize: 'Mida màxima de l\'arxiu', + maximumFileSizeError: 'La mida màxima de l\'arxiu s\'ha superat.', + url: 'URL de la imatge', + remove: 'Eliminar imatge' + }, + video: { + video: 'Vídeo', + videoLink: 'Enllaç del vídeo', + insert: 'Inserir vídeo', + url: 'URL del vídeo?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)' + }, + link: { + link: 'Enllaç', + insert: 'Inserir enllaç', + unlink: 'Treure enllaç', + edit: 'Editar', + textToDisplay: 'Text per mostrar', + url: 'Cap a quina URL porta l\'enllaç?', + openInNewWindow: 'Obrir en una finestra nova' + }, + table: { + table: 'Taula' + }, + hr: { + insert: 'Inserir línia horitzontal' + }, + style: { + style: 'Estil', + p: 'p', + blockquote: 'Cita', + pre: 'Codi', + h1: 'Títol 1', + h2: 'Títol 2', + h3: 'Títol 3', + h4: 'Títol 4', + h5: 'Títol 5', + h6: 'Títol 6' + }, + lists: { + unordered: 'Llista desendreçada', + ordered: 'Llista endreçada' + }, + options: { + help: 'Ajut', + fullscreen: 'Pantalla sencera', + codeview: 'Veure codi font' + }, + paragraph: { + paragraph: 'Paràgraf', + outdent: 'Menys tabulació', + indent: 'Més tabulació', + left: 'Alinear a l\'esquerra', + center: 'Alinear al mig', + right: 'Alinear a la dreta', + justify: 'Justificar' + }, + color: { + recent: 'Últim color', + more: 'Més colors', + background: 'Color de fons', + foreground: 'Color de lletra', + transparent: 'Transparent', + setTransparent: 'Establir transparent', + reset: 'Restablir', + resetToDefault: 'Restablir per defecte' + }, + shortcut: { + shortcuts: 'Dreceres de teclat', + close: 'Tancar', + textFormatting: 'Format de text', + action: 'Acció', + paragraphFormatting: 'Format de paràgraf', + documentStyle: 'Estil del document', + extraKeys: 'Tecles adicionals' + }, + help : { + 'insertParagraph': 'Inserir paràgraf', + 'undo': 'Desfer l\'última acció', + 'redo': 'Refer l\'última acció', + 'tab': 'Tabular', + 'untab': 'Eliminar tabulació', + 'bold': 'Establir estil negreta', + 'italic': 'Establir estil cursiva', + 'underline': 'Establir estil subratllat', + 'strikethrough': 'Establir estil ratllat', + 'removeFormat': 'Netejar estil', + 'justifyLeft': 'Alinear a l\'esquerra', + 'justifyCenter': 'Alinear al centre', + 'justifyRight': 'Alinear a la dreta', + 'justifyFull': 'Justificar', + 'insertUnorderedList': 'Inserir llista desendreçada', + 'insertOrderedList': 'Inserir llista endreçada', + 'outdent': 'Reduïr tabulació del paràgraf', + 'indent': 'Augmentar tabulació del paràgraf', + 'formatPara': 'Canviar l\'estil del bloc com a un paràgraf (etiqueta P)', + 'formatH1': 'Canviar l\'estil del bloc com a un H1', + 'formatH2': 'Canviar l\'estil del bloc com a un H2', + 'formatH3': 'Canviar l\'estil del bloc com a un H3', + 'formatH4': 'Canviar l\'estil del bloc com a un H4', + 'formatH5': 'Canviar l\'estil del bloc com a un H5', + 'formatH6': 'Canviar l\'estil del bloc com a un H6', + 'insertHorizontalRule': 'Inserir una línia horitzontal', + 'linkDialog.show': 'Mostrar panel d\'enllaços' + }, + history: { + undo: 'Desfer', + redo: 'Refer' + }, + specialChar: { + specialChar: 'CARÀCTERS ESPECIALS', + select: 'Selecciona caràcters especials' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-cs-CZ.js b/public/admin/view/javascript/summernote/lang/summernote-cs-CZ.js new file mode 100644 index 0000000..14fc16c --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-cs-CZ.js @@ -0,0 +1,103 @@ +(function ($) { + $.extend($.summernote.lang, { + 'cs-CZ': { + font: { + bold: 'Tučné', + italic: 'Kurzíva', + underline: 'Podtržené', + clear: 'Odstranit styl písma', + height: 'Výška řádku', + strikethrough: 'Přeškrtnuté', + size: 'Velikost písma' + }, + image: { + image: 'Obrázek', + insert: 'Vložit obrázek', + resizeFull: 'Původní velikost', + resizeHalf: 'Poloviční velikost', + resizeQuarter: 'Čtvrteční velikost', + floatLeft: 'Umístit doleva', + floatRight: 'Umístit doprava', + floatNone: 'Neobtékat textem', + dragImageHere: 'Přetáhnout sem obrázek', + selectFromFiles: 'Vybrat soubor', + url: 'URL obrázku' + }, + video: { + video: 'Video', + videoLink: 'Odkaz videa', + insert: 'Vložit video', + url: 'URL videa?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion nebo Youku)' + }, + link: { + link: 'Odkaz', + insert: 'Vytvořit odkaz', + unlink: 'Zrušit odkaz', + edit: 'Upravit', + textToDisplay: 'Zobrazovaný text', + url: 'Na jaké URL má tento odkaz vést?', + openInNewWindow: 'Otevřít v novém okně' + }, + table: { + table: 'Tabulka' + }, + hr: { + insert: 'Vložit vodorovnou čáru' + }, + style: { + style: 'Styl', + p: 'Normální', + blockquote: 'Citace', + pre: 'Kód', + h1: 'Nadpis 1', + h2: 'Nadpis 2', + h3: 'Nadpis 3', + h4: 'Nadpis 4', + h5: 'Nadpis 5', + h6: 'Nadpis 6' + }, + lists: { + unordered: 'Odrážkový seznam', + ordered: 'Číselný seznam' + }, + options: { + help: 'Nápověda', + fullscreen: 'Celá obrazovka', + codeview: 'HTML kód' + }, + paragraph: { + paragraph: 'Odstavec', + outdent: 'Zvětšit odsazení', + indent: 'Zmenšit odsazení', + left: 'Zarovnat doleva', + center: 'Zarovnat na střed', + right: 'Zarovnat doprava', + justify: 'Zarovnat oboustranně' + }, + color: { + recent: 'Aktuální barva', + more: 'Další barvy', + background: 'Barva pozadí', + foreground: 'Barva písma', + transparent: 'Průhlednost', + setTransparent: 'Nastavit průhlednost', + reset: 'Obnovit', + resetToDefault: 'Obnovit výchozí' + }, + shortcut: { + shortcuts: 'Klávesové zkratky', + close: 'Zavřít', + textFormatting: 'Formátování textu', + action: 'Akce', + paragraphFormatting: 'Formátování odstavce', + documentStyle: 'Styl dokumentu' + }, + history: { + undo: 'Krok vzad', + redo: 'Krok vpřed' + } + + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-da-DK.js b/public/admin/view/javascript/summernote/lang/summernote-da-DK.js new file mode 100644 index 0000000..8f51774 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-da-DK.js @@ -0,0 +1,114 @@ +(function ($) { + $.extend($.summernote.lang, { + 'da-DK': { + font: { + bold: 'Fed', + italic: 'Kursiv', + underline: 'Understreget', + clear: 'Fjern formatering', + height: 'Højde', + name: 'Skrifttype', + strikethrough: 'Gennemstreget', + subscript: 'Sænket skrift', + superscript: 'Hævet skrift', + size: 'Skriftstørrelse' + }, + image: { + image: 'Billede', + insert: 'Indsæt billede', + resizeFull: 'Original størrelse', + resizeHalf: 'Halv størrelse', + resizeQuarter: 'Kvart størrelse', + floatLeft: 'Venstrestillet', + floatRight: 'Højrestillet', + floatNone: 'Fjern formatering', + shapeRounded: 'Form: Runde kanter', + shapeCircle: 'Form: Cirkel', + shapeThumbnail: 'Form: Miniature', + shapeNone: 'Form: Ingen', + dragImageHere: 'Træk billede hertil', + dropImage: 'Slip billede', + selectFromFiles: 'Vælg billed-fil', + maximumFileSize: 'Maks fil størrelse', + maximumFileSizeError: 'Filen er større end maks tilladte fil størrelse!', + url: 'Billede URL', + remove: 'Fjern billede' + }, + video: { + video: 'Video', + videoLink: 'Video Link', + insert: 'Indsæt Video', + url: 'Video URL?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)' + }, + link: { + link: 'Link', + insert: 'Indsæt link', + unlink: 'Fjern link', + edit: 'Rediger', + textToDisplay: 'Visningstekst', + url: 'Hvor skal linket pege hen?', + openInNewWindow: 'Åbn i nyt vindue' + }, + table: { + table: 'Tabel' + }, + hr: { + insert: 'Indsæt horisontal linje' + }, + style: { + style: 'Stil', + p: 'p', + blockquote: 'Citat', + pre: 'Kode', + h1: 'Overskrift 1', + h2: 'Overskrift 2', + h3: 'Overskrift 3', + h4: 'Overskrift 4', + h5: 'Overskrift 5', + h6: 'Overskrift 6' + }, + lists: { + unordered: 'Punktopstillet liste', + ordered: 'Nummereret liste' + }, + options: { + help: 'Hjælp', + fullscreen: 'Fuld skærm', + codeview: 'HTML-Visning' + }, + paragraph: { + paragraph: 'Afsnit', + outdent: 'Formindsk indryk', + indent: 'Forøg indryk', + left: 'Venstrestillet', + center: 'Centreret', + right: 'Højrestillet', + justify: 'Blokjuster' + }, + color: { + recent: 'Nyligt valgt farve', + more: 'Flere farver', + background: 'Baggrund', + foreground: 'Forgrund', + transparent: 'Transparent', + setTransparent: 'Sæt transparent', + reset: 'Nulstil', + resetToDefault: 'Gendan standardindstillinger' + }, + shortcut: { + shortcuts: 'Genveje', + close: 'Luk', + textFormatting: 'Tekstformatering', + action: 'Handling', + paragraphFormatting: 'Afsnitsformatering', + documentStyle: 'Dokumentstil' + }, + history: { + undo: 'Fortryd', + redo: 'Annuller fortryd' + } + + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-de-DE.js b/public/admin/view/javascript/summernote/lang/summernote-de-DE.js new file mode 100644 index 0000000..402caed --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-de-DE.js @@ -0,0 +1,110 @@ +(function ($) { + $.extend($.summernote.lang, { + 'de-DE': { + font: { + bold: 'Fett', + italic: 'Kursiv', + underline: 'Unterstreichen', + clear: 'Zurücksetzen', + height: 'Zeilenhöhe', + strikethrough: 'Durchgestrichen', + size: 'Schriftgröße' + }, + image: { + image: 'Grafik', + insert: 'Grafik einfügen', + resizeFull: 'Originalgröße', + resizeHalf: 'Größe 1/2', + resizeQuarter: 'Größe 1/4', + floatLeft: 'Linksbündig', + floatRight: 'Rechtsbündig', + floatNone: 'Kein Textfluss', + shapeRounded: 'Rahmen: Abgerundet', + shapeCircle: 'Rahmen: Kreisförmig', + shapeThumbnail: 'Rahmen: Thumbnail', + shapeNone: 'Kein Rahmen', + dragImageHere: 'Ziehen Sie ein Bild mit der Maus hierher', + selectFromFiles: 'Wählen Sie eine Datei aus', + maximumFileSize: 'Maximale Dateigröße', + maximumFileSizeError: 'Maximale Dateigröße überschritten', + url: 'Grafik URL', + remove: 'Grafik entfernen' + }, + video: { + video: 'Video', + videoLink: 'Video Link', + insert: 'Video einfügen', + url: 'Video URL?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion oder Youku)' + }, + link: { + link: 'Link', + insert: 'Link einfügen', + unlink: 'Link entfernen', + edit: 'Editieren', + textToDisplay: 'Anzeigetext', + url: 'Ziel des Links?', + openInNewWindow: 'In einem neuen Fenster öffnen' + }, + table: { + table: 'Tabelle' + }, + hr: { + insert: 'Eine horizontale Linie einfügen' + }, + style: { + style: 'Stil', + p: 'p', + blockquote: 'Zitat', + pre: 'Quellcode', + h1: 'Überschrift 1', + h2: 'Überschrift 2', + h3: 'Überschrift 3', + h4: 'Überschrift 4', + h5: 'Überschrift 5', + h6: 'Überschrift 6' + }, + lists: { + unordered: 'Aufzählung', + ordered: 'Nummerierung' + }, + options: { + help: 'Hilfe', + fullscreen: 'Vollbild', + codeview: 'HTML-Code anzeigen' + }, + paragraph: { + paragraph: 'Absatz', + outdent: 'Einzug vergrößern', + indent: 'Einzug verkleinern', + left: 'Links ausrichten', + center: 'Zentriert ausrichten', + right: 'Rechts ausrichten', + justify: 'Blocksatz' + }, + color: { + recent: 'Letzte Farbe', + more: 'Mehr Farben', + background: 'Hintergrundfarbe', + foreground: 'Schriftfarbe', + transparent: 'Transparenz', + setTransparent: 'Transparenz setzen', + reset: 'Zurücksetzen', + resetToDefault: 'Auf Standard zurücksetzen' + }, + shortcut: { + shortcuts: 'Tastenkürzel', + close: 'Schließen', + textFormatting: 'Textformatierung', + action: 'Aktion', + paragraphFormatting: 'Absatzformatierung', + documentStyle: 'Dokumentenstil' + }, + history: { + undo: 'Rückgängig', + redo: 'Wiederholen' + } + + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-es-ES.js b/public/admin/view/javascript/summernote/lang/summernote-es-ES.js new file mode 100644 index 0000000..b66a368 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-es-ES.js @@ -0,0 +1,147 @@ +(function ($) { + $.extend($.summernote.lang, { + 'es-ES': { + font: { + bold: 'Negrita', + italic: 'Cursiva', + underline: 'Subrayado', + clear: 'Quitar estilo de fuente', + height: 'Altura de línea', + name: 'Fuente', + strikethrough: 'Tachado', + superscript: 'Superíndice', + subscript: 'Subíndice', + size: 'Tamaño de la fuente' + }, + image: { + image: 'Imagen', + insert: 'Insertar imagen', + resizeFull: 'Redimensionar a tamaño completo', + resizeHalf: 'Redimensionar a la mitad', + resizeQuarter: 'Redimensionar a un cuarto', + floatLeft: 'Flotar a la izquierda', + floatRight: 'Flotar a la derecha', + floatNone: 'No flotar', + shapeRounded: 'Forma: Redondeado', + shapeCircle: 'Forma: Círculo', + shapeThumbnail: 'Forma: Marco', + shapeNone: 'Forma: Ninguna', + dragImageHere: 'Arrastrar una imagen o texto aquí', + dropImage: 'Suelta la imagen o texto', + selectFromFiles: 'Seleccionar desde los archivos', + maximumFileSize: 'Tamaño máximo del archivo', + maximumFileSizeError: 'Has superado el tamaño máximo del archivo.', + url: 'URL de la imagen', + remove: 'Eliminar imagen' + }, + video: { + video: 'Vídeo', + videoLink: 'Link del vídeo', + insert: 'Insertar vídeo', + url: '¿URL del vídeo?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)' + }, + link: { + link: 'Link', + insert: 'Insertar link', + unlink: 'Quitar link', + edit: 'Editar', + textToDisplay: 'Texto para mostrar', + url: '¿Hacia que URL lleva el link?', + openInNewWindow: 'Abrir en una nueva ventana' + }, + table: { + table: 'Tabla' + }, + hr: { + insert: 'Insertar línea horizontal' + }, + style: { + style: 'Estilo', + p: 'p', + blockquote: 'Cita', + pre: 'Código', + h1: 'Título 1', + h2: 'Título 2', + h3: 'Título 3', + h4: 'Título 4', + h5: 'Título 5', + h6: 'Título 6' + }, + lists: { + unordered: 'Lista desordenada', + ordered: 'Lista ordenada' + }, + options: { + help: 'Ayuda', + fullscreen: 'Pantalla completa', + codeview: 'Ver código fuente' + }, + paragraph: { + paragraph: 'Párrafo', + outdent: 'Menos tabulación', + indent: 'Más tabulación', + left: 'Alinear a la izquierda', + center: 'Alinear al centro', + right: 'Alinear a la derecha', + justify: 'Justificar' + }, + color: { + recent: 'Último color', + more: 'Más colores', + background: 'Color de fondo', + foreground: 'Color de fuente', + transparent: 'Transparente', + setTransparent: 'Establecer transparente', + reset: 'Restaurar', + resetToDefault: 'Restaurar por defecto' + }, + shortcut: { + shortcuts: 'Atajos de teclado', + close: 'Cerrar', + textFormatting: 'Formato de texto', + action: 'Acción', + paragraphFormatting: 'Formato de párrafo', + documentStyle: 'Estilo de documento', + extraKeys: 'Teclas adicionales' + }, + help : { + 'insertParagraph': 'Insertar párrafo', + 'undo': 'Deshacer última acción', + 'redo': 'Rehacer última acción', + 'tab': 'Tabular', + 'untab': 'Eliminar tabulación', + 'bold': 'Establecer estilo negrita', + 'italic': 'Establecer estilo cursiva', + 'underline': 'Establecer estilo subrayado', + 'strikethrough': 'Establecer estilo tachado', + 'removeFormat': 'Limpiar estilo', + 'justifyLeft': 'Alinear a la izquierda', + 'justifyCenter': 'Alinear al centro', + 'justifyRight': 'Alinear a la derecha', + 'justifyFull': 'Justificar', + 'insertUnorderedList': 'Insertar lista desordenada', + 'insertOrderedList': 'Insertar lista ordenada', + 'outdent': 'Reducir tabulación del párrafo', + 'indent': 'Aumentar tabulación del párrafo', + 'formatPara': 'Cambiar estilo del bloque a párrafo (etiqueta P)', + 'formatH1': 'Cambiar estilo del bloque a H1', + 'formatH2': 'Cambiar estilo del bloque a H2', + 'formatH3': 'Cambiar estilo del bloque a H3', + 'formatH4': 'Cambiar estilo del bloque a H4', + 'formatH5': 'Cambiar estilo del bloque a H5', + 'formatH6': 'Cambiar estilo del bloque a H6', + 'insertHorizontalRule': 'Insertar línea horizontal', + 'linkDialog.show': 'Mostrar panel enlaces' + }, + history: { + undo: 'Deshacer', + redo: 'Rehacer' + }, + specialChar: { + specialChar: 'CARACTERES ESPECIALES', + select: 'Selecciona Caracteres especiales' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-es-EU.js b/public/admin/view/javascript/summernote/lang/summernote-es-EU.js new file mode 100644 index 0000000..4681db0 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-es-EU.js @@ -0,0 +1,103 @@ +(function ($) { + $.extend($.summernote.lang, { + 'es-EU': { + font: { + bold: 'Lodia', + italic: 'Etzana', + underline: 'Azpimarratua', + clear: 'Estiloa kendu', + height: 'Lerro altuera', + name: 'Tipografia', + strikethrough: 'Marratua', + size: 'Letren neurria' + }, + image: { + image: 'Irudia', + insert: 'Irudi bat txertatu', + resizeFull: 'Jatorrizko neurrira aldatu', + resizeHalf: 'Neurria erdira aldatu', + resizeQuarter: 'Neurria laurdenera aldatu', + floatLeft: 'Ezkerrean kokatu', + floatRight: 'Eskuinean kokatu', + floatNone: 'Kokapenik ez ezarri', + dragImageHere: 'Irudi bat ezarri hemen', + selectFromFiles: 'Zure fitxategi bat aukeratu', + url: 'Irudiaren URL helbidea' + }, + video: { + video: 'Bideoa', + videoLink: 'Bideorako esteka', + insert: 'Bideo berri bat txertatu', + url: 'Bideoaren URL helbidea', + providers: '(YouTube, Vimeo, Vine, Instagram edo DailyMotion)' + }, + link: { + link: 'Esteka', + insert: 'Esteka bat txertatu', + unlink: 'Esteka ezabatu', + edit: 'Editatu', + textToDisplay: 'Estekaren testua', + url: 'Estekaren URL helbidea', + openInNewWindow: 'Leiho berri batean ireki' + }, + table: { + table: 'Taula' //Tabla + }, + hr: { + insert: 'Marra horizontala txertatu' //Insertar línea horizontal + }, + style: { + style: 'Estiloa', + p: 'p', + blockquote: 'Aipamena', + pre: 'Kodea', + h1: '1. izenburua', + h2: '2. izenburua', + h3: '3. izenburua', + h4: '4. izenburua', + h5: '5. izenburua', + h6: '6. izenburua' + }, + lists: { + unordered: 'Ordenatu gabeko zerrenda', + ordered: 'Zerrenda ordenatua' + }, + options: { + help: 'Laguntza', + fullscreen: 'Pantaila osoa', + codeview: 'Kodea ikusi' + }, + paragraph: { + paragraph: 'Paragrafoa', + outdent: 'Koska txikiagoa', + indent: 'Koska handiagoa', + left: 'Ezkerrean kokatu', + center: 'Erdian kokatu', + right: 'Eskuinean kokatu', + justify: 'Justifikatu' + }, + color: { + recent: 'Azken kolorea', + more: 'Kolore gehiago', + background: 'Atzeko planoa', + foreground: 'Aurreko planoa', + transparent: 'Gardena', + setTransparent: 'Gardendu', + reset: 'Lehengoratu', + resetToDefault: 'Berrezarri lehenetsia' + }, + shortcut: { + shortcuts: 'Lasterbideak', + close: 'Itxi', + textFormatting: 'Testuaren formatua', + action: 'Ekintza', + paragraphFormatting: 'Paragrafoaren formatua', + documentStyle: 'Dokumentuaren estiloa' + }, + history: { + undo: 'Desegin', + redo: 'Berregin' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-fa-IR.js b/public/admin/view/javascript/summernote/lang/summernote-fa-IR.js new file mode 100644 index 0000000..a9d1a2d --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-fa-IR.js @@ -0,0 +1,105 @@ +(function ($) { + $.extend($.summernote.lang, { + 'fa-IR': { + font: { + bold: 'درشت', + italic: 'خمیده', + underline: 'میان خط', + clear: 'پاک کردن فرمت فونت', + height: 'فاصله ی خطی', + name: 'اسم فونت', + strikethrough: 'Strike', + size: 'اندازه ی فونت' + }, + image: { + image: 'تصویر', + insert: 'وارد کردن تصویر', + resizeFull: 'تغییر به اندازه ی کامل', + resizeHalf: 'تغییر به اندازه نصف', + resizeQuarter: 'تغییر به اندازه یک چهارم', + floatLeft: 'چسباندن به چپ', + floatRight: 'چسباندن به راست', + floatNone: 'بدون چسبندگی', + dragImageHere: 'یک تصویر را اینجا بکشید', + selectFromFiles: 'فایل ها را انتخاب کنید', + url: 'آدرس تصویر', + remove: 'حذف تصویر' + }, + video: { + video: 'ویدیو', + videoLink: 'لینک ویدیو', + insert: 'افزودن ویدیو', + url: 'آدرس ویدیو ؟', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion یا Youku)' + }, + link: { + link: 'لینک', + insert: 'اضافه کردن لینک', + unlink: 'حذف لینک', + edit: 'ویرایش', + textToDisplay: 'متن جهت نمایش', + url: 'این لینک به چه آدرسی باید برود ؟', + openInNewWindow: 'در یک پنجره ی جدید باز شود' + }, + table: { + table: 'جدول' + }, + hr: { + insert: 'افزودن خط افقی' + }, + style: { + style: 'استیل', + p: 'نرمال', + 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); + diff --git a/public/admin/view/javascript/summernote/lang/summernote-fi-FI.js b/public/admin/view/javascript/summernote/lang/summernote-fi-FI.js new file mode 100644 index 0000000..22e7875 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-fi-FI.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'fi-FI': { + font: { + bold: 'Lihavoitu', + italic: 'Kursiivi', + underline: 'Alleviivaa', + clear: 'Tyhjennä muotoilu', + height: 'Riviväli', + name: 'Kirjasintyyppi', + strikethrough: 'Yliviivaus', + size: 'Kirjasinkoko' + }, + image: { + image: 'Kuva', + insert: 'Lisää kuva', + resizeFull: 'Koko leveys', + resizeHalf: 'Puolikas leveys', + resizeQuarter: 'Neljäsosa leveys', + floatLeft: 'Sijoita vasemmalle', + floatRight: 'Sijoita oikealle', + floatNone: 'Ei sijoitusta', + dragImageHere: 'Vedä kuva tähän', + selectFromFiles: 'Valitse tiedostoista', + url: 'URL-osoitteen mukaan', + remove: 'Poista kuva' + }, + video: { + video: 'Video', + videoLink: 'Linkki videoon', + insert: 'Lisää video', + url: 'Videon URL-osoite?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion tai Youku)' + }, + link: { + link: 'Linkki', + insert: 'Lisää linkki', + unlink: 'Poista linkki', + edit: 'Muokkaa', + textToDisplay: 'Näytettävä teksti', + url: 'Linkin URL-osoite?', + openInNewWindow: 'Avaa uudessa ikkunassa' + }, + table: { + table: 'Taulukko' + }, + hr: { + insert: 'Lisää vaakaviiva' + }, + style: { + style: 'Tyyli', + p: 'Normaali', + blockquote: 'Lainaus', + pre: 'Koodi', + h1: 'Otsikko 1', + h2: 'Otsikko 2', + h3: 'Otsikko 3', + h4: 'Otsikko 4', + h5: 'Otsikko 5', + h6: 'Otsikko 6' + }, + lists: { + unordered: 'Luettelomerkitty luettelo', + ordered: 'Numeroitu luettelo' + }, + options: { + help: 'Ohje', + fullscreen: 'Koko näyttö', + codeview: 'HTML-näkymä' + }, + paragraph: { + paragraph: 'Kappale', + outdent: 'Pienennä sisennystä', + indent: 'Suurenna sisennystä', + left: 'Tasaus vasemmalle', + center: 'Keskitä', + right: 'Tasaus oikealle', + justify: 'Tasaa' + }, + color: { + recent: 'Viimeisin väri', + more: 'Lisää värejä', + background: 'Taustaväri', + foreground: 'Tekstin väri', + transparent: 'Läpinäkyvä', + setTransparent: 'Aseta läpinäkyväksi', + reset: 'Palauta', + resetToDefault: 'Palauta oletusarvoksi' + }, + shortcut: { + shortcuts: 'Pikanäppäimet', + close: 'Sulje', + textFormatting: 'Tekstin muotoilu', + action: 'Toiminto', + paragraphFormatting: 'Kappaleen muotoilu', + documentStyle: 'Asiakirjan tyyli' + }, + history: { + undo: 'Kumoa', + redo: 'Toista' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-fr-FR.js b/public/admin/view/javascript/summernote/lang/summernote-fr-FR.js new file mode 100644 index 0000000..f6b7738 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-fr-FR.js @@ -0,0 +1,115 @@ +(function ($) { + $.extend($.summernote.lang, { + 'fr-FR': { + font: { + bold: 'Gras', + italic: 'Italique', + underline: 'Souligné', + clear: 'Effacer la mise en forme', + height: 'Interligne', + name: 'Famille de police', + strikethrough: 'Barré', + superscript: 'Exposant', + subscript: 'Indice', + size: 'Taille de police' + }, + image: { + image: 'Image', + insert: 'Insérer une image', + resizeFull: 'Taille originale', + resizeHalf: 'Redimensionner à 50 %', + resizeQuarter: 'Redimensionner à 25 %', + floatLeft: 'Aligné à gauche', + floatRight: 'Aligné à droite', + floatNone: 'Pas d\'alignement', + shapeRounded: 'Forme: Rectangle arrondie', + shapeCircle: 'Forme: Cercle', + shapeThumbnail: 'Forme: Vignette', + shapeNone: 'Forme: Aucune', + dragImageHere: 'Faites glisser une image ou un texte dans ce cadre', + dropImage: 'Lachez l\'image ou le texte', + selectFromFiles: 'Choisir un fichier', + maximumFileSize: 'Taille de fichier maximale', + maximumFileSizeError: 'Taille maximale du fichier dépassée', + url: 'URL de l\'image', + remove: 'Supprimer l\'image' + }, + video: { + video: 'Vidéo', + videoLink: 'Lien vidéo', + insert: 'Insérer une vidéo', + url: 'URL de la vidéo', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)' + }, + link: { + link: 'Lien', + insert: 'Insérer un lien', + unlink: 'Supprimer un lien', + edit: 'Modifier', + textToDisplay: 'Texte à afficher', + url: 'URL du lien', + openInNewWindow: 'Ouvrir dans une nouvelle fenêtre' + }, + table: { + table: 'Tableau' + }, + hr: { + insert: 'Insérer une ligne horizontale' + }, + style: { + style: 'Style', + p: 'p', + blockquote: 'Citation', + pre: 'Code source', + h1: 'Titre 1', + h2: 'Titre 2', + h3: 'Titre 3', + h4: 'Titre 4', + h5: 'Titre 5', + h6: 'Titre 6' + }, + lists: { + unordered: 'Liste à puces', + ordered: 'Liste numérotée' + }, + options: { + help: 'Aide', + fullscreen: 'Plein écran', + codeview: 'Afficher le code HTML' + }, + paragraph: { + paragraph: 'Paragraphe', + outdent: 'Diminuer le retrait', + indent: 'Augmenter le retrait', + left: 'Aligner à gauche', + center: 'Centrer', + right: 'Aligner à droite', + justify: 'Justifier' + }, + color: { + recent: 'Dernière couleur sélectionnée', + more: 'Plus de couleurs', + background: 'Couleur de fond', + foreground: 'Couleur de police', + transparent: 'Transparent', + setTransparent: 'Définir la transparence', + reset: 'Restaurer', + resetToDefault: 'Restaurer la couleur par défaut' + }, + shortcut: { + shortcuts: 'Raccourcis', + close: 'Fermer', + textFormatting: 'Mise en forme du texte', + action: 'Action', + paragraphFormatting: 'Mise en forme des paragraphes', + documentStyle: 'Style du document', + extraKeys: 'Touches supplémentaires' + }, + history: { + undo: 'Annuler la dernière action', + redo: 'Restaurer la dernière action annulée' + } + + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-gl-ES.js b/public/admin/view/javascript/summernote/lang/summernote-gl-ES.js new file mode 100644 index 0000000..004af3c --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-gl-ES.js @@ -0,0 +1,147 @@ +(function ($) { + $.extend($.summernote.lang, { + 'gl-ES': { + font: { + bold: 'Negrita', + italic: 'Cursiva', + underline: 'Subliñado', + clear: 'Quitar estilo de fonte', + height: 'Altura de liña', + name: 'Fonte', + strikethrough: 'Riscado', + superscript: 'Superíndice', + subscript: 'Subíndice', + size: 'Tamaño da fonte' + }, + image: { + image: 'Imaxe', + insert: 'Inserir imaxe', + resizeFull: 'Redimensionar a tamaño completo', + resizeHalf: 'Redimensionar á metade', + resizeQuarter: 'Redimensionar a un cuarto', + floatLeft: 'Flotar á esquerda', + floatRight: 'Flotar á dereita', + floatNone: 'Non flotar', + shapeRounded: 'Forma: Redondeado', + shapeCircle: 'Forma: Círculo', + shapeThumbnail: 'Forma: Marco', + shapeNone: 'Forma: Ningunha', + dragImageHere: 'Arrastrar unha imaxe ou texto aquí', + dropImage: 'Solta a imaxe ou texto', + selectFromFiles: 'Seleccionar desde os arquivos', + maximumFileSize: 'Tamaño máximo do arquivo', + maximumFileSizeError: 'Superaches o tamaño máximo do arquivo.', + url: 'URL da imaxe', + remove: 'Eliminar imaxe' + }, + video: { + video: 'Vídeo', + videoLink: 'Ligazón do vídeo', + insert: 'Insertar vídeo', + url: 'URL do vídeo?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion, o Youku)' + }, + link: { + link: 'Ligazón', + insert: 'Inserir Ligazón', + unlink: 'Quitar Ligazón', + edit: 'Editar', + textToDisplay: 'Texto para amosar', + url: 'Cara a que URL leva a ligazón?', + openInNewWindow: 'Abrir nunha nova xanela' + }, + table: { + table: 'Táboa' + }, + hr: { + insert: 'Inserir liña horizontal' + }, + style: { + style: 'Estilo', + normal: 'Normal', + blockquote: 'Cita', + pre: 'Código', + h1: 'Título 1', + h2: 'Título 2', + h3: 'Título 3', + h4: 'Título 4', + h5: 'Título 5', + h6: 'Título 6' + }, + lists: { + unordered: 'Lista desordenada', + ordered: 'Lista ordenada' + }, + options: { + help: 'Axuda', + fullscreen: 'Pantalla completa', + codeview: 'Ver código fonte' + }, + paragraph: { + paragraph: 'Parágrafo', + outdent: 'Menos tabulación', + indent: 'Máis tabulación', + left: 'Aliñar á esquerda', + center: 'Aliñar ao centro', + right: 'Aliñar á dereita', + justify: 'Xustificar' + }, + color: { + recent: 'Última cor', + more: 'Máis cores', + background: 'Cor de fondo', + foreground: 'Cor de fuente', + transparent: 'Transparente', + setTransparent: 'Establecer transparente', + reset: 'Restaurar', + resetToDefault: 'Restaurar por defecto' + }, + shortcut: { + shortcuts: 'Atallos de teclado', + close: 'Pechar', + textFormatting: 'Formato de texto', + action: 'Acción', + paragraphFormatting: 'Formato de parágrafo', + documentStyle: 'Estilo de documento', + extraKeys: 'Teclas adicionais' + }, + help : { + 'insertParagraph': 'Inserir parágrafo', + 'undo': 'Desfacer última acción', + 'redo': 'Refacer última acción', + 'tab': 'Tabular', + 'untab': 'Eliminar tabulación', + 'bold': 'Establecer estilo negrita', + 'italic': 'Establecer estilo cursiva', + 'underline': 'Establecer estilo subliñado', + 'strikethrough': 'Establecer estilo riscado', + 'removeFormat': 'Limpar estilo', + 'justifyLeft': 'Aliñar á esquerda', + 'justifyCenter': 'Aliñar ao centro', + 'justifyRight': 'Aliñar á dereita', + 'justifyFull': 'Xustificar', + 'insertUnorderedList': 'Inserir lista desordenada', + 'insertOrderedList': 'Inserir lista ordenada', + 'outdent': 'Reducir tabulación do parágrafo', + 'indent': 'Aumentar tabulación do parágrafo', + 'formatPara': 'Mudar estilo do bloque a parágrafo (etiqueta P)', + 'formatH1': 'Mudar estilo do bloque a H1', + 'formatH2': 'Mudar estilo do bloque a H2', + 'formatH3': 'Mudar estilo do bloque a H3', + 'formatH4': 'Mudar estilo do bloque a H4', + 'formatH5': 'Mudar estilo do bloque a H5', + 'formatH6': 'Mudar estilo do bloque a H6', + 'insertHorizontalRule': 'Inserir liña horizontal', + 'linkDialog.show': 'Amosar panel ligazóns' + }, + history: { + undo: 'Desfacer', + redo: 'Refacer' + }, + specialChar: { + specialChar: 'CARACTERES ESPECIAIS', + select: 'Selecciona Caracteres especiais' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-he-IL.js b/public/admin/view/javascript/summernote/lang/summernote-he-IL.js new file mode 100644 index 0000000..344d93b --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-he-IL.js @@ -0,0 +1,107 @@ +(function ($) { + $.extend($.summernote.lang, { + 'he-IL': { + font: { + bold: 'מודגש', + italic: 'נטוי', + underline: 'קו תחתון', + clear: 'נקה עיצוב', + height: 'גובה', + name: 'גופן', + strikethrough: 'קו חוצה', + subscript: 'כתב תחתי', + superscript: 'כתב עילי', + size: 'גודל גופן' + }, + image: { + image: 'תמונה', + insert: 'הוסף תמונה', + resizeFull: 'גודל מלא', + resizeHalf: 'להקטין לחצי', + resizeQuarter: 'להקטין לרבע', + floatLeft: 'יישור לשמאל', + floatRight: 'יישור לימין', + floatNone: 'ישר', + dragImageHere: 'גרור תמונה לכאן', + selectFromFiles: 'בחר מתוך קבצים', + url: 'נתיב לתמונה', + remove: 'הסר תמונה' + }, + video: { + video: 'סרטון', + videoLink: 'קישור לסרטון', + insert: 'הוסף סרטון', + url: 'קישור לסרטון', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion או Youku)' + }, + link: { + link: 'קישור', + insert: 'הוסף קישור', + unlink: 'הסר קישור', + edit: 'ערוך', + textToDisplay: 'טקסט להציג', + url: 'קישור', + openInNewWindow: 'פתח בחלון חדש' + }, + table: { + table: 'טבלה' + }, + hr: { + insert: 'הוסף קו' + }, + style: { + style: 'עיצוב', + p: 'טקסט רגיל', + 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: 'עיצוב המסמך', + extraKeys: 'קיצורים נוספים' + }, + history: { + undo: 'בטל פעולה', + redo: 'בצע שוב' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-hr-HR.js b/public/admin/view/javascript/summernote/lang/summernote-hr-HR.js new file mode 100644 index 0000000..8b0d8bf --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-hr-HR.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'hr-HR': { + font: { + bold: 'Podebljano', + italic: 'Kurziv', + underline: 'Podvučeno', + clear: 'Ukloni stilove fonta', + height: 'Visina linije', + strikethrough: 'Precrtano', + size: 'Veličina fonta' + }, + image: { + image: 'Slika', + insert: 'Ubaci sliku', + resizeFull: 'Puna veličina', + resizeHalf: 'Umanji na 50%', + resizeQuarter: 'Umanji na 25%', + floatLeft: 'Poravnaj lijevo', + floatRight: 'Poravnaj desno', + floatNone: 'Bez poravnanja', + dragImageHere: 'Povuci sliku ovdje', + selectFromFiles: 'Izaberi iz datoteke', + url: 'Adresa slike', + remove: 'Ukloni sliku' + }, + video: { + video: 'Video', + videoLink: 'Veza na video', + insert: 'Ubaci video', + url: 'URL video', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ili Youku)' + }, + link: { + link: 'Veza', + insert: 'Ubaci vezu', + unlink: 'Ukloni vezu', + edit: 'Uredi', + textToDisplay: 'Tekst za prikaz', + url: 'Internet adresa', + openInNewWindow: 'Otvori u novom prozoru' + }, + table: { + table: 'Tablica' + }, + hr: { + insert: 'Ubaci horizontalnu liniju' + }, + style: { + style: 'Stil', + p: 'pni', + blockquote: 'Citat', + pre: 'Kôd', + h1: 'Naslov 1', + h2: 'Naslov 2', + h3: 'Naslov 3', + h4: 'Naslov 4', + h5: 'Naslov 5', + h6: 'Naslov 6' + }, + lists: { + unordered: 'Obična lista', + ordered: 'Numerirana lista' + }, + options: { + help: 'Pomoć', + fullscreen: 'Preko cijelog ekrana', + codeview: 'Izvorni kôd' + }, + paragraph: { + paragraph: 'Paragraf', + outdent: 'Smanji uvlačenje', + indent: 'Povećaj uvlačenje', + left: 'Poravnaj lijevo', + center: 'Centrirano', + right: 'Poravnaj desno', + justify: 'Poravnaj obostrano' + }, + color: { + recent: 'Posljednja boja', + more: 'Više boja', + background: 'Boja pozadine', + foreground: 'Boja teksta', + transparent: 'Prozirna', + setTransparent: 'Prozirna', + reset: 'Poništi', + resetToDefault: 'Podrazumijevana' + }, + shortcut: { + shortcuts: 'Prečice s tipkovnice', + close: 'Zatvori', + textFormatting: 'Formatiranje teksta', + action: 'Akcija', + paragraphFormatting: 'Formatiranje paragrafa', + documentStyle: 'Stil dokumenta', + extraKeys: 'Dodatne kombinacije' + }, + history: { + undo: 'Poništi', + redo: 'Ponovi' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-hu-HU.js b/public/admin/view/javascript/summernote/lang/summernote-hu-HU.js new file mode 100644 index 0000000..e732c94 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-hu-HU.js @@ -0,0 +1,135 @@ +(function ($) { + $.extend($.summernote.lang, { + 'hu-HU': { + font: { + bold: 'Félkövér', + italic: 'Dőlt', + underline: 'Aláhúzott', + clear: 'Formázás törlése', + height: 'Sorköz', + name: 'Betűtípus', + strikethrough: 'Áthúzott', + size: 'Betűméret' + }, + image: { + image: 'Kép', + insert: 'Kép beszúrása', + resizeFull: 'Átméretezés teljes méretre', + resizeHalf: 'Átméretezés felére', + resizeQuarter: 'Átméretezés negyedére', + floatLeft: 'Igazítás balra', + floatRight: 'Igazítás jobbra', + floatNone: 'Igazítás törlése', + dragImageHere: 'Ide húzhat képet vagy szöveget', + dropImage: 'Engedje el a képet vagy szöveget', + selectFromFiles: 'Fájlok kiválasztása', + url: 'Kép URL címe', + remove: 'Kép törlése' + }, + video: { + video: 'Videó', + videoLink: 'Videó hivatkozás', + insert: 'Videó beszúrása', + url: 'Videó URL címe', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion vagy Youku)' + }, + link: { + link: 'Hivatkozás', + insert: 'Hivatkozás beszúrása', + unlink: 'Hivatkozás megszüntetése', + edit: 'Szerkesztés', + textToDisplay: 'Megjelenítendő szöveg', + url: 'Milyen URL címre hivatkozzon?', + openInNewWindow: 'Megnyitás új ablakban' + }, + table: { + table: 'Táblázat' + }, + hr: { + insert: 'Elválasztó vonal beszúrása' + }, + style: { + style: 'Stílus', + p: 'Normál', + blockquote: 'Idézet', + pre: 'Kód', + h1: 'Fejléc 1', + h2: 'Fejléc 2', + h3: 'Fejléc 3', + h4: 'Fejléc 4', + h5: 'Fejléc 5', + h6: 'Fejléc 6' + }, + lists: { + unordered: 'Listajeles lista', + ordered: 'Számozott lista' + }, + options: { + help: 'Súgó', + fullscreen: 'Teljes képernyő', + codeview: 'Kód nézet' + }, + paragraph: { + paragraph: 'Bekezdés', + outdent: 'Behúzás csökkentése', + indent: 'Behúzás növelése', + left: 'Igazítás balra', + center: 'Igazítás középre', + right: 'Igazítás jobbra', + justify: 'Sorkizárt' + }, + color: { + recent: 'Jelenlegi szín', + more: 'További színek', + background: 'Háttérszín', + foreground: 'Betűszín', + transparent: 'Átlátszó', + setTransparent: 'Átlászóság beállítása', + reset: 'Visszaállítás', + resetToDefault: 'Alaphelyzetbe állítás' + }, + shortcut: { + shortcuts: 'Gyorsbillentyű', + close: 'Bezárás', + textFormatting: 'Szöveg formázása', + action: 'Művelet', + paragraphFormatting: 'Bekezdés formázása', + documentStyle: 'Dokumentumstílus' + }, + help: { + 'insertParagraph': 'Új bekezdés', + 'undo': 'Visszavonás', + 'redo': 'Újra', + 'tab': 'Behúzás növelése', + 'untab': 'Behúzás csökkentése', + 'bold': 'Félkövérre állítás', + 'italic': 'Dőltre állítás', + 'underline': 'Aláhúzás', + 'strikethrough': 'Áthúzás', + 'removeFormat': 'Formázás törlése', + 'justifyLeft': 'Balra igazítás', + 'justifyCenter': 'Középre igazítás', + 'justifyRight': 'Jobbra igazítás', + 'justifyFull': 'Sorkizárt', + 'insertUnorderedList': 'Számozatlan lista be/ki', + 'insertOrderedList': 'Számozott lista be/ki', + 'outdent': 'Jelenlegi bekezdés behúzásának megszüntetése', + 'indent': 'Jelenlegi bekezdés behúzása', + 'formatPara': 'Blokk formázása bekezdésként (P tag)', + 'formatH1': 'Blokk formázása, mint Fejléc 1', + 'formatH2': 'Blokk formázása, mint Fejléc 2', + 'formatH3': 'Blokk formázása, mint Fejléc 3', + 'formatH4': 'Blokk formázása, mint Fejléc 4', + 'formatH5': 'Blokk formázása, mint Fejléc 5', + 'formatH6': 'Blokk formázása, mint Fejléc 6', + 'insertHorizontalRule': 'Vízszintes vonal beszúrása', + 'linkDialog.show': 'Link párbeszédablak megjelenítése' + }, + history: { + undo: 'Visszavonás', + redo: 'Újra' + } + + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-id-ID.js b/public/admin/view/javascript/summernote/lang/summernote-id-ID.js new file mode 100644 index 0000000..8283107 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-id-ID.js @@ -0,0 +1,103 @@ +(function ($) { + $.extend($.summernote.lang, { + 'id-ID': { + font: { + bold: 'Tebal', + italic: 'Miring', + underline: 'Garis bawah', + clear: 'Bersihkan gaya', + height: 'Jarak baris', + strikethrough: 'Coret', + size: 'Ukuran font' + }, + image: { + image: 'Gambar', + insert: 'Sisipkan gambar', + resizeFull: 'Ukuran penuh', + resizeHalf: 'Ukuran 50%', + resizeQuarter: 'Ukuran 25%', + floatLeft: 'Rata kiri', + floatRight: 'Rata kanan', + floatNone: 'Tidak ada perataan', + dragImageHere: 'Tarik gambar pada area ini', + selectFromFiles: 'Pilih gambar dari berkas', + url: 'URL gambar', + remove: 'Hapus Gambar' + }, + video: { + video: 'Video', + videoLink: 'Link video', + insert: 'Sisipkan video', + url: 'Tautan video', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion atau Youku)' + }, + link: { + link: 'Tautan', + insert: 'Tambah tautan', + unlink: 'Hapus tautan', + edit: 'Edit', + textToDisplay: 'Tampilan teks', + url: 'Tautan tujuan', + openInNewWindow: 'Buka di jendela baru' + }, + table: { + table: 'Tabel' + }, + hr: { + insert: 'Masukkan garis horizontal' + }, + style: { + style: 'Gaya', + p: 'p', + blockquote: 'Kutipan', + pre: 'Kode', + h1: 'Heading 1', + h2: 'Heading 2', + h3: 'Heading 3', + h4: 'Heading 4', + h5: 'Heading 5', + h6: 'Heading 6' + }, + lists: { + unordered: 'Pencacahan', + ordered: 'Penomoran' + }, + options: { + help: 'Bantuan', + fullscreen: 'Layar penuh', + codeview: 'Kode HTML' + }, + paragraph: { + paragraph: 'Paragraf', + outdent: 'Outdent', + indent: 'Indent', + left: 'Rata kiri', + center: 'Rata tengah', + right: 'Rata kanan', + justify: 'Rata kanan kiri' + }, + color: { + recent: 'Warna sekarang', + more: 'Selengkapnya', + background: 'Warna latar', + foreground: 'Warna font', + transparent: 'Transparan', + setTransparent: 'Atur transparansi', + reset: 'Atur ulang', + resetToDefault: 'Kembalikan kesemula' + }, + shortcut: { + shortcuts: 'Jalan pintas', + close: 'Keluar', + textFormatting: 'Format teks', + action: 'Aksi', + paragraphFormatting: 'Format paragraf', + documentStyle: 'Gaya dokumen' + }, + history: { + undo: 'Kembali', + redo: 'Ulang' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-it-IT.js b/public/admin/view/javascript/summernote/lang/summernote-it-IT.js new file mode 100644 index 0000000..73f133c --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-it-IT.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'it-IT': { + font: { + bold: 'Testo in grassetto', + italic: 'Testo in corsivo', + underline: 'Testo sottolineato', + clear: 'Elimina la formattazione del testo', + height: 'Altezza della linea di testo', + name: 'Famiglia Font', + strikethrough: 'Testo barrato', + size: 'Dimensione del carattere' + }, + image: { + image: 'Immagine', + insert: 'Inserisci Immagine', + resizeFull: 'Dimensioni originali', + resizeHalf: 'Ridimensiona al 50%', + resizeQuarter: 'Ridimensiona al 25%', + floatLeft: 'Posiziona a sinistra', + floatRight: 'Posiziona a destra', + floatNone: 'Nessun posizionamento', + dragImageHere: 'Trascina qui un\'immagine', + selectFromFiles: 'Scegli dai Documenti', + url: 'URL dell\'immagine', + remove: 'Rimuovi immagine' + }, + video: { + video: 'Video', + videoLink: 'Collegamento ad un Video', + insert: 'Inserisci Video', + url: 'URL del Video', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion o Youku)' + }, + link: { + link: 'Collegamento', + insert: 'Inserisci Collegamento', + unlink: 'Elimina collegamento', + edit: 'Modifica collegamento', + textToDisplay: 'Testo del collegamento', + url: 'URL del collegamento', + openInNewWindow: 'Apri in una nuova finestra' + }, + table: { + table: 'Tabella' + }, + hr: { + insert: 'Inserisce una linea di separazione' + }, + style: { + style: 'Stili', + p: 'pe', + blockquote: 'Citazione', + pre: 'Codice', + h1: 'Titolo 1', + h2: 'Titolo 2', + h3: 'Titolo 3', + h4: 'Titolo 4', + h5: 'Titolo 5', + h6: 'Titolo 6' + }, + lists: { + unordered: 'Elenco non ordinato', + ordered: 'Elenco ordinato' + }, + options: { + help: 'Aiuto', + fullscreen: 'Modalità a tutto schermo', + codeview: 'Visualizza codice' + }, + paragraph: { + paragraph: 'Paragrafo', + outdent: 'Diminuisce il livello di rientro', + indent: 'Aumenta il livello di rientro', + left: 'Allinea a sinistra', + center: 'Centra', + right: 'Allinea a destra', + justify: 'Giustifica (allinea a destra e sinistra)' + }, + color: { + recent: 'Ultimo colore utilizzato', + more: 'Altri colori', + background: 'Colore di sfondo', + foreground: 'Colore', + transparent: 'Trasparente', + setTransparent: 'Trasparente', + reset: 'Reimposta', + resetToDefault: 'Reimposta i colori' + }, + shortcut: { + shortcuts: 'Scorciatoie da tastiera', + close: 'Chiudi', + textFormatting: 'Formattazione testo', + action: 'Azioni', + paragraphFormatting: 'Formattazione paragrafo', + documentStyle: 'Stili' + }, + history: { + undo: 'Annulla', + redo: 'Ripristina' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-ja-JP.js b/public/admin/view/javascript/summernote/lang/summernote-ja-JP.js new file mode 100644 index 0000000..58ac5af --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-ja-JP.js @@ -0,0 +1,133 @@ +(function ($) { + $.extend($.summernote.lang, { + 'ja-JP': { + font: { + bold: '太字', + italic: '斜体', + underline: '下線', + clear: 'クリア', + height: '文字高', + name: 'フォント', + strikethrough: '取り消し線', + size: '大きさ' + }, + image: { + image: '画像', + insert: '画像挿入', + resizeFull: '最大化', + resizeHalf: '1/2', + resizeQuarter: '1/4', + floatLeft: '左寄せ', + floatRight: '右寄せ', + floatNone: '寄せ解除', + dragImageHere: 'ここに画像をドラッグしてください', + selectFromFiles: '画像ファイルを選ぶ', + url: 'URLから画像を挿入する', + remove: '画像を削除する' + }, + video: { + video: '動画', + videoLink: '動画リンク', + insert: '動画挿入', + url: '動画のURL', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion, Youku)' + }, + link: { + link: 'リンク', + insert: 'リンク挿入', + unlink: 'リンク解除', + edit: '編集', + textToDisplay: 'リンク文字列', + url: 'URLを入力してください', + openInNewWindow: '新しいウィンドウで開く' + }, + table: { + table: 'テーブル' + }, + hr: { + insert: '水平線の挿入' + }, + style: { + style: 'スタイル', + p: '標準', + 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: 'やり直す' + }, + help: { + 'insertParagraph': '改行挿入', + 'undo': '一旦、行った操作を戻す', + 'redo': '最後のコマンドをやり直す', + 'tab': 'Tab', + 'untab': 'タブ戻し', + 'bold': '太文字', + 'italic': '斜体', + 'underline': '下線', + 'strikethrough': '取り消し線', + 'removeFormat': '装飾を戻す', + 'justifyLeft': '左寄せ', + 'justifyCenter': '真ん中寄せ', + 'justifyRight': '右寄せ', + 'justifyFull': 'すべてを整列', + 'insertUnorderedList': '行頭に●を挿入', + 'insertOrderedList': '行頭に番号を挿入', + 'outdent': '字下げを戻す(アウトデント)', + 'indent': '字下げする(インデント)', + 'formatPara': '段落(P tag)指定', + 'formatH1': 'H1指定', + 'formatH2': 'H2指定', + 'formatH3': 'H3指定', + 'formatH4': 'H4指定', + 'formatH5': 'H5指定', + 'formatH6': 'H6指定', + 'insertHorizontalRule': '<hr />を挿入', + 'linkDialog.show': 'リンク挿入' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-ko-KR.js b/public/admin/view/javascript/summernote/lang/summernote-ko-KR.js new file mode 100644 index 0000000..28aa872 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-ko-KR.js @@ -0,0 +1,115 @@ +(function ($) { + $.extend($.summernote.lang, { + 'ko-KR': { + font: { + bold: '굵게', + italic: '기울임꼴', + underline: '밑줄', + clear: '글자 효과 없애기', + height: '줄간격', + name: '글꼴', + superscript: '위 첨자', + subscript: '아래 첨자', + strikethrough: '취소선', + size: '글자 크기' + }, + image: { + image: '사진', + insert: '사진 추가', + resizeFull: '100% 크기로 변경', + resizeHalf: '50% 크기로 변경', + resizeQuarter: '25% 크기로 변경', + floatLeft: '왼쪽 정렬', + floatRight: '오른쪽 정렬', + floatNone: '정렬하지 않음', + shapeRounded: '스타일: 둥근 모서리', + shapeCircle: '스타일: 원형', + shapeThumbnail: '스타일: 액자', + shapeNone: '스타일: 없음', + dragImageHere: '텍스트 혹은 사진을 이곳으로 끌어오세요', + dropImage: '텍스트 혹은 사진을 내려놓으세요', + selectFromFiles: '파일 선택', + url: '사진 URL', + remove: '사진 삭제' + }, + video: { + video: '동영상', + videoLink: '동영상 링크', + insert: '동영상 추가', + url: '동영상 URL', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion, Youku 사용 가능)' + }, + link: { + link: '링크', + insert: '링크 추가', + unlink: '링크 삭제', + edit: '수정', + textToDisplay: '링크에 표시할 내용', + url: '이동할 URL', + openInNewWindow: '새창으로 열기' + }, + table: { + table: '테이블' + }, + hr: { + insert: '구분선 추가' + }, + style: { + style: '스타일', + p: '본문', + 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: '다시 실행' + }, + specialChar: { + specialChar: '특수문자', + select: '특수문자를 선택하세요' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-lt-LT.js b/public/admin/view/javascript/summernote/lang/summernote-lt-LT.js new file mode 100644 index 0000000..6ed66a9 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-lt-LT.js @@ -0,0 +1,107 @@ +(function ($) { + $.extend($.summernote.lang, { + 'lt-LT': { + font: { + bold: 'Paryškintas', + italic: 'Kursyvas', + underline: 'Pabrėžtas', + clear: 'Be formatavimo', + height: 'Eilutės aukštis', + name: 'Šrifto pavadinimas', + strikethrough: 'Perbrauktas', + superscript: 'Viršutinis', + subscript: 'Indeksas', + size: 'Šrifto dydis' + }, + image: { + image: 'Paveikslėlis', + insert: 'Įterpti paveikslėlį', + resizeFull: 'Pilnas dydis', + resizeHalf: 'Sumažinti dydį 50%', + resizeQuarter: 'Sumažinti dydį 25%', + floatLeft: 'Kairinis lygiavimas', + floatRight: 'Dešininis lygiavimas', + floatNone: 'Jokio lygiavimo', + shapeRounded: 'Forma: apvalūs kraštai', + shapeCircle: 'Forma: apskritimas', + shapeThumbnail: 'Forma: miniatiūra', + shapeNone: 'Forma: jokia', + dragImageHere: 'Vilkite paveikslėlį čia', + selectFromFiles: 'Pasirinkite failą', + maximumFileSize: 'Maskimalus failo dydis', + maximumFileSizeError: 'Maskimalus failo dydis viršytas!', + url: 'Paveikslėlio URL adresas', + remove: 'Ištrinti paveikslėlį' + }, + link: { + link: 'Nuoroda', + insert: 'Įterpti nuorodą', + unlink: 'Pašalinti nuorodą', + edit: 'Redaguoti', + textToDisplay: 'Rodomas tekstas', + url: 'Koks URL adresas yra susietas?', + openInNewWindow: 'Atidaryti naujame lange' + }, + table: { + table: 'Lentelė' + }, + hr: { + insert: 'Įterpti horizontalią liniją' + }, + style: { + style: 'Stilius', + p: 'pus', + blockquote: 'Citata', + pre: 'Kodas', + h1: 'Antraštė 1', + h2: 'Antraštė 2', + h3: 'Antraštė 3', + h4: 'Antraštė 4', + h5: 'Antraštė 5', + h6: 'Antraštė 6' + }, + lists: { + unordered: 'Suženklintasis sąrašas', + ordered: 'Sunumeruotas sąrašas' + }, + options: { + help: 'Pagalba', + fullscreen: 'Viso ekrano režimas', + codeview: 'HTML kodo peržiūra' + }, + paragraph: { + paragraph: 'Pastraipa', + outdent: 'Sumažinti įtrauką', + indent: 'Padidinti įtrauką', + left: 'Kairinė lygiuotė', + center: 'Centrinė lygiuotė', + right: 'Dešininė lygiuotė', + justify: 'Abipusis išlyginimas' + }, + color: { + recent: 'Paskutinė naudota spalva', + more: 'Daugiau spalvų', + background: 'Fono spalva', + foreground: 'Šrifto spalva', + transparent: 'Permatoma', + setTransparent: 'Nustatyti skaidrumo intensyvumą', + reset: 'Atkurti', + resetToDefault: 'Atstatyti numatytąją spalvą' + }, + shortcut: { + shortcuts: 'Spartieji klavišai', + close: 'Uždaryti', + textFormatting: 'Teksto formatavimas', + action: 'Veiksmas', + paragraphFormatting: 'Pastraipos formatavimas', + documentStyle: 'Dokumento stilius', + extraKeys: 'Papildomi klavišų deriniai' + }, + history: { + undo: 'Anuliuoti veiksmą', + redo: 'Perdaryti veiksmą' + } + + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-lt-LV.js b/public/admin/view/javascript/summernote/lang/summernote-lt-LV.js new file mode 100644 index 0000000..e873d85 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-lt-LV.js @@ -0,0 +1,135 @@ +(function ($) { + $.extend($.summernote.lang, { + 'lv-LV': { + font: { + bold: 'Treknraksts', + italic: 'Kursīvs', + underline: 'Pasvītrots', + clear: 'Noņemt formatējumu', + height: 'Līnijas augstums', + name: 'Fonts', + strikethrough: 'Nosvītrots', + superscript: 'Augšraksts', + subscript: 'Apakšraksts', + size: 'Fonta lielums' + }, + image: { + image: 'Attēls', + insert: 'Ievietot attēlu', + resizeFull: 'Pilns izmērts', + resizeHalf: 'Samazināt 50%', + resizeQuarter: 'Samazināt 25%', + floatLeft: 'Līdzināt pa kreisi', + floatRight: 'Līdzināt pa labi', + floatNone: 'Nelīdzināt', + shapeRounded: 'Forma: apaļām malām', + shapeCircle: 'Forma: aplis', + shapeThumbnail: 'Forma: rāmītis', + shapeNone: 'Forma: orģināla', + dragImageHere: 'Ievēlciet attēlu šeit', + selectFromFiles: 'Izvēlēties failu', + maximumFileSize: 'Maksimālais faila izmērs', + maximumFileSizeError: 'Faila izmērs pārāk liels!', + url: 'Attēla URL', + remove: 'Dzēst attēlu' + }, + link: { + link: 'Saite', + insert: 'Ievietot saiti', + unlink: 'Noņemt saiti', + edit: 'Rediģēt', + textToDisplay: 'Saites saturs', + url: 'Koks URL adresas yra susietas?', + openInNewWindow: 'Atvērt jaunā logā' + }, + table: { + table: 'Tabula' + }, + hr: { + insert: 'Ievietot līniju' + }, + style: { + style: 'Stils', + p: 'Parasts', + blockquote: 'Citāts', + pre: 'Kods', + h1: 'Virsraksts h1', + h2: 'Virsraksts h2', + h3: 'Virsraksts h3', + h4: 'Virsraksts h4', + h5: 'Virsraksts h5', + h6: 'Virsraksts h6' + }, + lists: { + unordered: 'Nenumurēts saraksts', + ordered: 'Numurēts saraksts' + }, + options: { + help: 'Palīdzība', + fullscreen: 'Pa visu ekrānu', + codeview: 'HTML kods' + }, + paragraph: { + paragraph: 'Paragrāfs', + outdent: 'Samazināt atkāpi', + indent: 'Palielināt atkāpi', + left: 'Līdzināt pa kreisi', + center: 'Centrēt', + right: 'Līdzināt pa labi', + justify: 'Līdzināt gar abām malām' + }, + color: { + recent: 'Nesen izmantotās', + more: 'Citas krāsas', + background: 'Fona krāsa', + foreground: 'Fonta krāsa', + transparent: 'Caurspīdīgs', + setTransparent: 'Iestatīt caurspīdīgumu', + reset: 'Atjaunot', + resetToDefault: 'Atjaunot noklusējumu' + }, + shortcut: { + shortcuts: 'Saīsnes', + close: 'Aizvērt', + textFormatting: 'Teksta formatēšana', + action: 'Darbība', + paragraphFormatting: 'Paragrāfa formatēšana', + documentStyle: 'Dokumenta stils', + extraKeys: 'Citas taustiņu kombinācijas' + }, + history: { + undo: 'Atsauks (undo)', + redo: 'Atkārtot (redo)' + }, + help: { + insertParagraph: 'Ievietot Paragrāfu', + undo: 'Atcelt iepriekšējo darbību', + redo: 'Atkārtot atcelto darbību', + tab: 'Atkāpe', + untab: 'Samazināt atkāpi', + bold: 'Pārvērst tekstu treknrakstā', + italic: 'Pārvērst tekstu slīprakstā (kursīvā)', + underline: 'Pasvītrot tekstu', + strikethrough: 'Nosvītrot tekstu', + removeFormat: 'Notīrīt stilu no teksta', + justifyLeft: 'Līdzīnāt saturu pa kreisi', + justifyCenter: 'Centrēt saturu', + justifyRight: 'Līdzīnāt saturu pa labi', + justifyFull: 'Izlīdzināt saturu gar abām malām', + insertUnorderedList: 'Ievietot nenumurētu sarakstu', + insertOrderedList: 'Ievietot numurētu sarakstu', + outdent: 'Samazināt/noņemt atkāpi paragrāfam', + indent: 'Uzlikt atkāpi paragrāfam', + formatPara: 'Mainīt bloka tipu uz (p) Paragrāfu', + formatH1: 'Mainīt bloka tipu uz virsrakstu H1', + formatH2: 'Mainīt bloka tipu uz virsrakstu H2', + formatH3: 'Mainīt bloka tipu uz virsrakstu H3', + formatH4: 'Mainīt bloka tipu uz virsrakstu H4', + formatH5: 'Mainīt bloka tipu uz virsrakstu H5', + formatH6: 'Mainīt bloka tipu uz virsrakstu H6', + insertHorizontalRule: 'Ievietot horizontālu līniju', + 'linkDialog.show': 'Parādīt saites logu' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-nb-NO.js b/public/admin/view/javascript/summernote/lang/summernote-nb-NO.js new file mode 100644 index 0000000..c4c304d --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-nb-NO.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'nb-NO': { + font: { + bold: 'Fet', + italic: 'Kursiv', + underline: 'Understrek', + clear: 'Fjern formatering', + height: 'Linjehøyde', + name: 'Skrifttype', + strikethrough: 'Gjennomstrek', + size: 'Skriftstørrelse' + }, + image: { + image: 'Bilde', + insert: 'Sett inn bilde', + resizeFull: 'Sett full størrelse', + resizeHalf: 'Sett halv størrelse', + resizeQuarter: 'Sett kvart størrelse', + floatLeft: 'Flyt til venstre', + floatRight: 'Flyt til høyre', + floatNone: 'Fjern flyt', + dragImageHere: 'Dra et bilde hit', + selectFromFiles: 'Velg fra filer', + url: 'Bilde-URL', + remove: 'Fjern bilde' + }, + video: { + video: 'Video', + videoLink: 'Videolenke', + insert: 'Sett inn video', + url: 'Video-URL', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)' + }, + link: { + link: 'Lenke', + insert: 'Sett inn lenke', + unlink: 'Fjern lenke', + edit: 'Rediger', + textToDisplay: 'Visningstekst', + url: 'Til hvilken URL skal denne lenken peke?', + openInNewWindow: 'Åpne i nytt vindu' + }, + table: { + table: 'Tabell' + }, + hr: { + insert: 'Sett inn horisontal linje' + }, + style: { + style: 'Stil', + p: 'p', + blockquote: 'Sitat', + pre: 'Kode', + h1: 'Overskrift 1', + h2: 'Overskrift 2', + h3: 'Overskrift 3', + h4: 'Overskrift 4', + h5: 'Overskrift 5', + h6: 'Overskrift 6' + }, + lists: { + unordered: 'Punktliste', + ordered: 'Nummerert liste' + }, + options: { + help: 'Hjelp', + fullscreen: 'Fullskjerm', + codeview: 'HTML-visning' + }, + paragraph: { + paragraph: 'Avsnitt', + outdent: 'Tilbakerykk', + indent: 'Innrykk', + left: 'Venstrejustert', + center: 'Midtstilt', + right: 'Høyrejustert', + justify: 'Blokkjustert' + }, + color: { + recent: 'Nylig valgt farge', + more: 'Flere farger', + background: 'Bakgrunnsfarge', + foreground: 'Skriftfarge', + transparent: 'Gjennomsiktig', + setTransparent: 'Sett gjennomsiktig', + reset: 'Nullstill', + resetToDefault: 'Nullstill til standard' + }, + shortcut: { + shortcuts: 'Hurtigtaster', + close: 'Lukk', + textFormatting: 'Tekstformatering', + action: 'Handling', + paragraphFormatting: 'Avsnittsformatering', + documentStyle: 'Dokumentstil' + }, + history: { + undo: 'Angre', + redo: 'Gjør om' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-nl-NL.js b/public/admin/view/javascript/summernote/lang/summernote-nl-NL.js new file mode 100644 index 0000000..31f9d37 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-nl-NL.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'nl-NL': { + font: { + bold: 'Vet', + italic: 'Cursief', + underline: 'Onderstrepen', + clear: 'Stijl verwijderen', + height: 'Regelhoogte', + name: 'Lettertype', + strikethrough: 'Doorhalen', + size: 'Tekstgrootte' + }, + image: { + image: 'Afbeelding', + insert: 'Afbeelding invoegen', + resizeFull: 'Volledige breedte', + resizeHalf: 'Halve breedte', + resizeQuarter: 'Kwart breedte', + floatLeft: 'Links uitlijnen', + floatRight: 'Rechts uitlijnen', + floatNone: 'Geen uitlijning', + dragImageHere: 'Sleep hier een afbeelding naar toe', + selectFromFiles: 'Selecteer een bestand', + url: 'URL van de afbeelding', + remove: 'Verwijder afbeelding' + }, + video: { + video: 'Video', + videoLink: 'Video link', + insert: 'Video invoegen', + url: 'URL van de video', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion of Youku)' + }, + link: { + link: 'Link', + insert: 'Link invoegen', + unlink: 'Link verwijderen', + edit: 'Wijzigen', + textToDisplay: 'Tekst van link', + url: 'Naar welke URL moet deze link verwijzen?', + openInNewWindow: 'Open in nieuw venster' + }, + table: { + table: 'Tabel' + }, + hr: { + insert: 'Horizontale lijn invoegen' + }, + style: { + style: 'Stijl', + p: 'Normaal', + blockquote: 'Quote', + pre: 'Code', + h1: 'Kop 1', + h2: 'Kop 2', + h3: 'Kop 3', + h4: 'Kop 4', + h5: 'Kop 5', + h6: 'Kop 6' + }, + lists: { + unordered: 'Ongeordende lijst', + ordered: 'Geordende lijst' + }, + options: { + help: 'Help', + fullscreen: 'Volledig scherm', + codeview: 'Bekijk Code' + }, + paragraph: { + paragraph: 'Paragraaf', + outdent: 'Inspringen verkleinen', + indent: 'Inspringen vergroten', + left: 'Links uitlijnen', + center: 'Centreren', + right: 'Rechts uitlijnen', + justify: 'Uitvullen' + }, + color: { + recent: 'Recente kleur', + more: 'Meer kleuren', + background: 'Achtergrond kleur', + foreground: 'Tekst kleur', + transparent: 'Transparant', + setTransparent: 'Transparant', + reset: 'Standaard', + resetToDefault: 'Standaard kleur' + }, + shortcut: { + shortcuts: 'Toetsencombinaties', + close: 'sluiten', + textFormatting: 'Tekststijlen', + action: 'Acties', + paragraphFormatting: 'Paragraafstijlen', + documentStyle: 'Documentstijlen' + }, + history: { + undo: 'Ongedaan maken', + redo: 'Opnieuw doorvoeren' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-pl-PL.js b/public/admin/view/javascript/summernote/lang/summernote-pl-PL.js new file mode 100644 index 0000000..86068eb --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-pl-PL.js @@ -0,0 +1,112 @@ +(function ($) { + $.extend($.summernote.lang, { + 'pl-PL': { + font: { + bold: 'Pogrubienie', + italic: 'Pochylenie', + underline: 'Podkreślenie', + clear: 'Usuń formatowanie', + height: 'Interlinia', + name: 'Czcionka', + strikethrough: 'Przekreślenie', + size: 'Rozmiar' + }, + image: { + image: 'Grafika', + insert: 'Wstaw grafikę', + resizeFull: 'Zmień rozmiar na 100%', + resizeHalf: 'Zmień rozmiar na 50%', + resizeQuarter: 'Zmień rozmiar na 25%', + floatLeft: 'Po lewej', + floatRight: 'Po prawej', + floatNone: 'Równo z tekstem', + shapeRounded: 'Kształt: zaokrąglone', + shapeCircle: 'Kształt: okrąg', + shapeThumbnail: 'Kształt: miniatura', + shapeNone: 'Kształt: brak', + dragImageHere: 'Przeciągnij grafikę lub tekst tutaj', + dropImage: 'Przeciągnij grafikę lub tekst', + selectFromFiles: 'Wybierz z dysku', + maximumFileSize: 'Limit wielkości pliku', + maximumFileSizeError: 'Przekroczono limit wielkości pliku.', + url: 'Adres URL grafiki', + remove: 'Usuń grafikę' + }, + video: { + video: 'Wideo', + videoLink: 'Adres wideo', + insert: 'Wstaw wideo', + url: 'Adres wideo', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion lub Youku)' + }, + link: { + link: 'Odnośnik', + insert: 'Wstaw odnośnik', + unlink: 'Usuń odnośnik', + edit: 'Edytuj', + textToDisplay: 'Tekst do wyświetlenia', + url: 'Na jaki adres URL powinien przenosić ten odnośnik?', + openInNewWindow: 'Otwórz w nowym oknie' + }, + table: { + table: 'Tabela' + }, + hr: { + insert: 'Wstaw poziomą linię' + }, + style: { + style: 'Style', + p: 'pny', + blockquote: 'Cytat', + pre: 'Kod', + h1: 'Nagłówek 1', + h2: 'Nagłówek 2', + h3: 'Nagłówek 3', + h4: 'Nagłówek 4', + h5: 'Nagłówek 5', + h6: 'Nagłówek 6' + }, + lists: { + unordered: 'Lista wypunktowana', + ordered: 'Lista numerowana' + }, + options: { + help: 'Pomoc', + fullscreen: 'Pełny ekran', + codeview: 'Źródło' + }, + paragraph: { + paragraph: 'Akapit', + outdent: 'Zmniejsz wcięcie', + indent: 'Zwiększ wcięcie', + left: 'Wyrównaj do lewej', + center: 'Wyrównaj do środka', + right: 'Wyrównaj do prawej', + justify: 'Wyrównaj do lewej i prawej' + }, + color: { + recent: 'Ostani kolor', + more: 'Więcej kolorów', + background: 'Tło', + foreground: 'Czcionka', + transparent: 'Przeźroczysty', + setTransparent: 'Przeźroczyste', + reset: 'Reset', + resetToDefault: 'Domyślne' + }, + shortcut: { + shortcuts: 'Skróty klawiaturowe', + close: 'Zamknij', + textFormatting: 'Formatowanie tekstu', + action: 'Akcja', + paragraphFormatting: 'Formatowanie akapitu', + documentStyle: 'Styl dokumentu', + extraKeys: 'Dodatkowe klawisze' + }, + history: { + undo: 'Cofnij', + redo: 'Ponów' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-pt-BR.js b/public/admin/view/javascript/summernote/lang/summernote-pt-BR.js new file mode 100644 index 0000000..4b8efbb --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-pt-BR.js @@ -0,0 +1,132 @@ +(function ($) { + $.extend($.summernote.lang, { + 'pt-BR': { + font: { + bold: 'Negrito', + italic: 'Itálico', + underline: 'Sublinhado', + clear: 'Remover estilo da fonte', + height: 'Altura da linha', + name: 'Fonte', + strikethrough: 'Riscado', + size: 'Tamanho da fonte' + }, + image: { + image: 'Imagem', + insert: 'Inserir imagem', + resizeFull: 'Resize Full', + resizeHalf: 'Resize Half', + resizeQuarter: 'Resize Quarter', + floatLeft: 'Float Left', + floatRight: 'Float Right', + floatNone: 'Float None', + dragImageHere: 'Arraste uma imagem para cá', + selectFromFiles: 'Selecione a partir dos arquivos', + url: 'URL da imagem' + }, + video: { + video: 'Vídeo', + videoLink: 'Link para vídeo', + insert: 'Inserir vídeo', + url: 'URL do vídeo?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)' + }, + link: { + link: 'Link', + insert: 'Inserir link', + unlink: 'Remover link', + edit: 'Editar', + textToDisplay: 'Texto para exibir', + url: 'Para qual URL esse link leva?', + openInNewWindow: 'Abrir em uma nova janela' + }, + table: { + table: 'Tabela' + }, + hr: { + insert: 'Inserir linha horizontal' + }, + style: { + style: 'Estilo', + normal: 'Normal', + blockquote: 'Citação', + pre: 'Código', + h1: 'Título 1', + h2: 'Título 2', + h3: 'Título 3', + h4: 'Título 4', + h5: 'Título 5', + h6: 'Título 6' + }, + lists: { + unordered: 'Lista com marcadores', + ordered: 'Lista numerada' + }, + options: { + help: 'Ajuda', + fullscreen: 'Tela cheia', + codeview: 'Ver código-fonte' + }, + paragraph: { + paragraph: 'Parágrafo', + outdent: 'Menor tabulação', + indent: 'Maior tabulação', + left: 'Alinhar à esquerda', + center: 'Alinhar ao centro', + right: 'Alinha à direita', + justify: 'Justificado' + }, + color: { + recent: 'Cor recente', + more: 'Mais cores', + background: 'Fundo', + foreground: 'Fonte', + transparent: 'Transparente', + setTransparent: 'Fundo transparente', + reset: 'Restaurar', + resetToDefault: 'Restaurar padrão' + }, + shortcut: { + shortcuts: 'Atalhos do teclado', + close: 'Fechar', + textFormatting: 'Formatação de texto', + action: 'Ação', + paragraphFormatting: 'Formatação de parágrafo', + documentStyle: 'Estilo de documento' + }, + history: { + undo: 'Desfazer', + redo: 'Refazer' + }, + help: { + 'insertParagraph': 'Inserir Parágrafo', + 'undo': 'Desfazer o último comando', + 'redo': 'Refazer o último comando', + 'tab': 'Tab', + 'untab': 'Desfazer tab', + 'bold': 'Colocar em negrito', + 'italic': 'Colocar em itálico', + 'underline': 'Sublinhado', + 'strikethrough': 'Tachado', + 'removeFormat': 'Remover estilo', + 'justifyLeft': 'Alinhar à esquerda', + 'justifyCenter': 'Centralizar', + 'justifyRight': 'Alinhar à esquerda', + 'justifyFull': 'Justificar', + 'insertUnorderedList': 'Lista não ordenada', + 'insertOrderedList': 'Lista ordenada', + 'outdent': 'Recuar parágrafo atual', + 'indent': 'Avançar parágrafo atual', + 'formatPara': 'Alterar formato do bloco para parágrafo(tag P)', + 'formatH1': 'Alterar formato do bloco para H1', + 'formatH2': 'Alterar formato do bloco para H2', + 'formatH3': 'Alterar formato do bloco para H3', + 'formatH4': 'Alterar formato do bloco para H4', + 'formatH5': 'Alterar formato do bloco para H5', + 'formatH6': 'Alterar formato do bloco para H6', + 'insertHorizontalRule': 'Inserir régua horizontal', + 'linkDialog.show': 'Inserir um Hiperlink' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-pt-PT.js b/public/admin/view/javascript/summernote/lang/summernote-pt-PT.js new file mode 100644 index 0000000..96e3104 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-pt-PT.js @@ -0,0 +1,103 @@ +(function ($) { + $.extend($.summernote.lang, { + 'pt-PT': { + font: { + bold: 'Negrito', + italic: 'Itálico', + underline: 'Sublinhado', + clear: 'Remover estilo da fonte', + height: 'Altura da linha', + name: 'Fonte', + strikethrough: 'Riscado', + size: 'Tamanho da fonte' + }, + image: { + image: 'Imagem', + insert: 'Inserir imagem', + resizeFull: 'Redimensionar Completo', + resizeHalf: 'Redimensionar Metade', + resizeQuarter: 'Redimensionar Um Quarto', + floatLeft: 'Float Esquerda', + floatRight: 'Float Direita', + floatNone: 'Sem Float', + dragImageHere: 'Arraste uma imagem para aqui', + selectFromFiles: 'Selecione a partir dos arquivos', + url: 'Endereço da imagem' + }, + video: { + video: 'Vídeo', + videoLink: 'Link para vídeo', + insert: 'Inserir vídeo', + url: 'URL do vídeo?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ou Youku)' + }, + link: { + link: 'Link', + insert: 'Inserir ligação', + unlink: 'Remover ligação', + edit: 'Editar', + textToDisplay: 'Texto para exibir', + url: 'Que endereço esta licação leva?', + openInNewWindow: 'Abrir numa nova janela' + }, + table: { + table: 'Tabela' + }, + hr: { + insert: 'Inserir linha horizontal' + }, + style: { + style: 'Estilo', + p: 'p', + blockquote: 'Citação', + pre: 'Código', + h1: 'Título 1', + h2: 'Título 2', + h3: 'Título 3', + h4: 'Título 4', + h5: 'Título 5', + h6: 'Título 6' + }, + lists: { + unordered: 'Lista com marcadores', + ordered: 'Lista numerada' + }, + options: { + help: 'Ajuda', + fullscreen: 'Janela Completa', + codeview: 'Ver código-fonte' + }, + paragraph: { + paragraph: 'Parágrafo', + outdent: 'Menor tabulação', + indent: 'Maior tabulação', + left: 'Alinhar à esquerda', + center: 'Alinhar ao centro', + right: 'Alinha à direita', + justify: 'Justificado' + }, + color: { + recent: 'Cor recente', + more: 'Mais cores', + background: 'Fundo', + foreground: 'Fonte', + transparent: 'Transparente', + setTransparent: 'Fundo transparente', + reset: 'Restaurar', + resetToDefault: 'Restaurar padrão' + }, + shortcut: { + shortcuts: 'Atalhos do teclado', + close: 'Fechar', + textFormatting: 'Formatação de texto', + action: 'Ação', + paragraphFormatting: 'Formatação de parágrafo', + documentStyle: 'Estilo de documento' + }, + history: { + undo: 'Desfazer', + redo: 'Refazer' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-ro-RO.js b/public/admin/view/javascript/summernote/lang/summernote-ro-RO.js new file mode 100644 index 0000000..70df177 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-ro-RO.js @@ -0,0 +1,102 @@ +(function ($) { + $.extend($.summernote.lang, { + 'ro-RO': { + font: { + bold: 'Îngroșat', + italic: 'Înclinat', + underline: 'Subliniat', + clear: 'Înlătură formatare font', + height: 'Înălțime rând', + strikethrough: 'Tăiat', + size: 'Dimensiune font' + }, + image: { + image: 'Imagine', + insert: 'Inserează imagine', + resizeFull: 'Redimensionează complet', + resizeHalf: 'Redimensionează 1/2', + resizeQuarter: 'Redimensionează 1/4', + floatLeft: 'Aliniere la stânga', + floatRight: 'Aliniere la dreapta', + floatNone: 'Fară aliniere', + dragImageHere: 'Trage o imagine aici', + selectFromFiles: 'Alege din fişiere', + url: 'URL imagine' + }, + video: { + video: 'Video', + videoLink: 'Link video', + insert: 'Inserează video', + url: 'URL video?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion sau Youku)' + }, + link: { + link: 'Link', + insert: 'Inserează link', + unlink: 'Înlătură link', + edit: 'Editează', + textToDisplay: 'Text ce va fi afişat', + url: 'Deschidere în fereastra nouă?' + }, + table: { + table: 'Tabel' + }, + hr: { + insert: 'Inserează o linie orizontală' + }, + style: { + style: 'Stil', + p: 'p', + blockquote: 'Citat', + pre: 'Preformatat', + h1: 'Titlu 1', + h2: 'Titlu 2', + h3: 'Titlu 3', + h4: 'Titlu 4', + h5: 'Titlu 5', + h6: 'Titlu 6' + }, + lists: { + unordered: 'Listă neordonată', + ordered: 'Listă ordonată' + }, + options: { + help: 'Ajutor', + fullscreen: 'Măreşte', + codeview: 'Sursă' + }, + paragraph: { + paragraph: 'Paragraf', + outdent: 'Creşte identarea', + indent: 'Scade identarea', + left: 'Aliniere la stânga', + center: 'Aliniere centrală', + right: 'Aliniere la dreapta', + justify: 'Aliniere în bloc' + }, + color: { + recent: 'Culoare recentă', + more: 'Mai multe culori', + background: 'Culoarea fundalului', + foreground: 'Culoarea textului', + transparent: 'Transparent', + setTransparent: 'Setează transparent', + reset: 'Resetează', + resetToDefault: 'Revino la iniţial' + }, + shortcut: { + shortcuts: 'Scurtături tastatură', + close: 'Închide', + textFormatting: 'Formatare text', + action: 'Acţiuni', + paragraphFormatting: 'Formatare paragraf', + documentStyle: 'Stil paragraf' + }, + history: { + undo: 'Starea anterioară', + redo: 'Starea ulterioară' + } + + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-ru-RU.js b/public/admin/view/javascript/summernote/lang/summernote-ru-RU.js new file mode 100644 index 0000000..f22737f --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-ru-RU.js @@ -0,0 +1,112 @@ +(function ($) { + $.extend($.summernote.lang, { + 'ru-RU': { + font: { + bold: 'Полужирный', + italic: 'Курсив', + underline: 'Подчёркнутый', + clear: 'Убрать стили шрифта', + height: 'Высота линии', + name: 'Шрифт', + strikethrough: 'Зачёркнутый', + subscript: 'Нижний индекс', + superscript: 'Верхний индекс', + size: 'Размер шрифта' + }, + image: { + image: 'Картинка', + insert: 'Вставить картинку', + resizeFull: 'Восстановить размер', + resizeHalf: 'Уменьшить до 50%', + resizeQuarter: 'Уменьшить до 25%', + floatLeft: 'Расположить слева', + floatRight: 'Расположить справа', + floatNone: 'Расположение по-умолчанию', + shapeRounded: 'Форма: Закругленная', + shapeCircle: 'Форма: Круг', + shapeThumbnail: 'Форма: Миниатюра', + shapeNone: 'Форма: Нет', + dragImageHere: 'Перетащите сюда картинку', + dropImage: 'Перетащите картинку', + selectFromFiles: 'Выбрать из файлов', + url: 'URL картинки', + remove: 'Удалить картинку' + }, + video: { + video: 'Видео', + videoLink: 'Ссылка на видео', + insert: 'Вставить видео', + url: 'URL видео', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion или Youku)' + }, + link: { + link: 'Ссылка', + insert: 'Вставить ссылку', + unlink: 'Убрать ссылку', + edit: 'Редактировать', + textToDisplay: 'Отображаемый текст', + url: 'URL для перехода', + openInNewWindow: 'Открывать в новом окне' + }, + table: { + table: 'Таблица' + }, + hr: { + insert: 'Вставить горизонтальную линию' + }, + style: { + style: 'Стиль', + p: 'Нормальный', + 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: 'Стиль документа', + extraKeys: 'Дополнительные комбинации' + }, + history: { + undo: 'Отменить', + redo: 'Повтор' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-sk-SK.js b/public/admin/view/javascript/summernote/lang/summernote-sk-SK.js new file mode 100644 index 0000000..fa13ce0 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-sk-SK.js @@ -0,0 +1,102 @@ +(function ($) { + $.extend($.summernote.lang, { + 'sk-SK': { + font: { + bold: 'Tučné', + italic: 'Kurzíva', + underline: 'Podčiarknutie', + clear: 'Odstrániť štýl písma', + height: 'Výška riadku', + strikethrough: 'Prečiarknuté', + size: 'Veľkosť písma' + }, + image: { + image: 'Obrázok', + insert: 'Vložiť obrázok', + resizeFull: 'Pôvodná veľkosť', + resizeHalf: 'Polovičná veľkosť', + resizeQuarter: 'Štvrtinová veľkosť', + floatLeft: 'Umiestniť doľava', + floatRight: 'Umiestniť doprava', + floatNone: 'Bez zarovnania', + dragImageHere: 'Pretiahnuť sem obrázok', + selectFromFiles: 'Vybrať súbor', + url: 'URL obrázku' + }, + video: { + video: 'Video', + videoLink: 'Odkaz videa', + insert: 'Vložiť video', + url: 'URL videa?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion alebo Youku)' + }, + link: { + link: 'Odkaz', + insert: 'Vytvoriť odkaz', + unlink: 'Zrušiť odkaz', + edit: 'Upraviť', + textToDisplay: 'Zobrazovaný text', + url: 'Na akú URL adresu má tento odkaz viesť?', + openInNewWindow: 'Otvoriť v novom okne' + }, + table: { + table: 'Tabuľka' + }, + hr: { + insert: 'Vložit vodorovnú čiaru' + }, + style: { + style: 'Štýl', + p: 'Normálny', + blockquote: 'Citácia', + pre: 'Kód', + h1: 'Nadpis 1', + h2: 'Nadpis 2', + h3: 'Nadpis 3', + h4: 'Nadpis 4', + h5: 'Nadpis 5', + h6: 'Nadpis 6' + }, + lists: { + unordered: 'Odrážkový zoznam', + ordered: 'Číselný zoznam' + }, + options: { + help: 'Pomoc', + fullscreen: 'Celá obrazovka', + codeview: 'HTML kód' + }, + paragraph: { + paragraph: 'Odsek', + outdent: 'Zväčšiť odsadenie', + indent: 'Zmenšiť odsadenie', + left: 'Zarovnať doľava', + center: 'Zarovnať na stred', + right: 'Zarovnať doprava', + justify: 'Zarovnať obojstranne' + }, + color: { + recent: 'Aktuálna farba', + more: 'Dalšie farby', + background: 'Farba pozadia', + foreground: 'Farba písma', + transparent: 'Priehľadnosť', + setTransparent: 'Nastaviť priehľadnosť', + reset: 'Obnoviť', + resetToDefault: 'Obnoviť prednastavené' + }, + shortcut: { + shortcuts: 'Klávesové skratky', + close: 'Zavrieť', + textFormatting: 'Formátovanie textu', + action: 'Akcia', + paragraphFormatting: 'Formátovanie odseku', + documentStyle: 'Štýl dokumentu' + }, + history: { + undo: 'Krok vzad', + redo: 'Krok dopredu' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-sl-SI.js b/public/admin/view/javascript/summernote/lang/summernote-sl-SI.js new file mode 100644 index 0000000..330c212 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-sl-SI.js @@ -0,0 +1,106 @@ +(function ($) { + $.extend($.summernote.lang, { + 'sl-SI': { + font: { + bold: 'Krepko', + italic: 'Ležeče', + underline: 'Podčrtano', + clear: 'Počisti oblikovanje izbire', + height: 'Razmik med vrsticami', + name: 'Pisava', + strikethrough: 'Prečrtano', + subscript: 'Podpisano', + superscript: 'Nadpisano', + size: 'Velikost pisave' + }, + image: { + image: 'Slika', + insert: 'Vstavi sliko', + resizeFull: 'Razširi na polno velikost', + resizeHalf: 'Razširi na polovico velikosti', + resizeQuarter: 'Razširi na četrtino velikosti', + floatLeft: 'Leva poravnava', + floatRight: 'Desna poravnava', + floatNone: 'Brez poravnave', + dragImageHere: 'Sem povlecite sliko', + selectFromFiles: 'Izberi sliko za nalaganje', + url: 'URL naslov slike', + remove: 'Odstrani sliko' + }, + video: { + video: 'Video', + videoLink: 'Video povezava', + insert: 'Vstavi video', + url: 'Povezava do videa', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ali Youku)' + }, + link: { + link: 'Povezava', + insert: 'Vstavi povezavo', + unlink: 'Odstrani povezavo', + edit: 'Uredi', + textToDisplay: 'Prikazano besedilo', + url: 'Povezava', + openInNewWindow: 'Odpri v novem oknu' + }, + table: { + table: 'Tabela' + }, + hr: { + insert: 'Vstavi horizontalno črto' + }, + style: { + style: 'Slogi', + p: 'Navadno besedilo', + blockquote: 'Citat', + pre: 'Koda', + h1: 'Naslov 1', + h2: 'Naslov 2', + h3: 'Naslov 3', + h4: 'Naslov 4', + h5: 'Naslov 5', + h6: 'Naslov 6' + }, + lists: { + unordered: 'Označen seznam', + ordered: 'Oštevilčen seznam' + }, + options: { + help: 'Pomoč', + fullscreen: 'Celozaslonski način', + codeview: 'Pregled HTML kode' + }, + paragraph: { + paragraph: 'Slogi odstavka', + outdent: 'Zmanjšaj odmik', + indent: 'Povečaj odmik', + left: 'Leva poravnava', + center: 'Desna poravnava', + right: 'Sredinska poravnava', + justify: 'Obojestranska poravnava' + }, + color: { + recent: 'Uporabi zadnjo barvo', + more: 'Več barv', + background: 'Barva ozadja', + foreground: 'Barva besedila', + transparent: 'Brez barve', + setTransparent: 'Brez barve', + reset: 'Ponastavi', + resetToDefault: 'Ponastavi na privzeto' + }, + shortcut: { + shortcuts: 'Bljižnice', + close: 'Zapri', + textFormatting: 'Oblikovanje besedila', + action: 'Dejanja', + paragraphFormatting: 'Oblikovanje odstavka', + documentStyle: 'Oblikovanje naslova' + }, + history: { + undo: 'Razveljavi', + redo: 'Uveljavi' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-sr-RS-Latin.js b/public/admin/view/javascript/summernote/lang/summernote-sr-RS-Latin.js new file mode 100644 index 0000000..03ca108 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-sr-RS-Latin.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'sr-RS': { + font: { + bold: 'Podebljano', + italic: 'Kurziv', + underline: 'Podvučeno', + clear: 'Ukloni stilove fonta', + height: 'Visina linije', + strikethrough: 'Precrtano', + size: 'Veličina fonta' + }, + image: { + image: 'Slika', + insert: 'Umetni sliku', + resizeFull: 'Puna veličina', + resizeHalf: 'Umanji na 50%', + resizeQuarter: 'Umanji na 25%', + floatLeft: 'Uz levu ivicu', + floatRight: 'Uz desnu ivicu', + floatNone: 'Bez ravnanja', + dragImageHere: 'Prevuci sliku ovde', + selectFromFiles: 'Izaberi iz datoteke', + url: 'Adresa slike', + remove: 'Ukloni sliku' + }, + video: { + video: 'Video', + videoLink: 'Veza ka videu', + insert: 'Umetni video', + url: 'URL video', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion ili Youku)' + }, + link: { + link: 'Veza', + insert: 'Umetni vezu', + unlink: 'Ukloni vezu', + edit: 'Uredi', + textToDisplay: 'Tekst za prikaz', + url: 'Internet adresa', + openInNewWindow: 'Otvori u novom prozoru' + }, + table: { + table: 'Tabela' + }, + hr: { + insert: 'Umetni horizontalnu liniju' + }, + style: { + style: 'Stil', + p: 'pni', + blockquote: 'Citat', + pre: 'Kod', + h1: 'Zaglavlje 1', + h2: 'Zaglavlje 2', + h3: 'Zaglavlje 3', + h4: 'Zaglavlje 4', + h5: 'Zaglavlje 5', + h6: 'Zaglavlje 6' + }, + lists: { + unordered: 'Obična lista', + ordered: 'Numerisana lista' + }, + options: { + help: 'Pomoć', + fullscreen: 'Preko celog ekrana', + codeview: 'Izvorni kod' + }, + paragraph: { + paragraph: 'Paragraf', + outdent: 'Smanji uvlačenje', + indent: 'Povečaj uvlačenje', + left: 'Poravnaj u levo', + center: 'Centrirano', + right: 'Poravnaj u desno', + justify: 'Poravnaj obostrano' + }, + color: { + recent: 'Poslednja boja', + more: 'Više boja', + background: 'Boja pozadine', + foreground: 'Boja teksta', + transparent: 'Providna', + setTransparent: 'Providna', + reset: 'Opoziv', + resetToDefault: 'Podrazumevana' + }, + shortcut: { + shortcuts: 'Prečice sa tastature', + close: 'Zatvori', + textFormatting: 'Formatiranje teksta', + action: 'Akcija', + paragraphFormatting: 'Formatiranje paragrafa', + documentStyle: 'Stil dokumenta', + extraKeys: 'Dodatne kombinacije' + }, + history: { + undo: 'Poništi', + redo: 'Ponovi' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-sr-RS.js b/public/admin/view/javascript/summernote/lang/summernote-sr-RS.js new file mode 100644 index 0000000..d625e5b --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-sr-RS.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'sr-RS': { + font: { + bold: 'Подебљано', + italic: 'Курзив', + underline: 'Подвучено', + clear: 'Уклони стилове фонта', + height: 'Висина линије', + strikethrough: 'Прецртано', + size: 'Величина фонта' + }, + image: { + image: 'Слика', + insert: 'Уметни слику', + resizeFull: 'Пуна величина', + resizeHalf: 'Умањи на 50%', + resizeQuarter: 'Умањи на 25%', + floatLeft: 'Уз леву ивицу', + floatRight: 'Уз десну ивицу', + floatNone: 'Без равнања', + dragImageHere: 'Превуци слику овде', + selectFromFiles: 'Изабери из датотеке', + url: 'Адреса слике', + remove: 'Уклони слику' + }, + video: { + video: 'Видео', + videoLink: 'Веза ка видеу', + insert: 'Уметни видео', + url: 'URL видео', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion или Youku)' + }, + link: { + link: 'Веза', + insert: 'Уметни везу', + unlink: 'Уклони везу', + edit: 'Уреди', + textToDisplay: 'Текст за приказ', + url: 'Интернет адреса', + openInNewWindow: 'Отвори у новом прозору' + }, + table: { + table: 'Табела' + }, + hr: { + insert: 'Уметни хоризонталну линију' + }, + style: { + style: 'Стил', + p: 'Нормални', + 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: 'Стил документа', + extraKeys: 'Додатне комбинације' + }, + history: { + undo: 'Поништи', + redo: 'Понови' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-sv-SE.js b/public/admin/view/javascript/summernote/lang/summernote-sv-SE.js new file mode 100644 index 0000000..1fc63e6 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-sv-SE.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'sv-SE': { + font: { + bold: 'Fet', + italic: 'Kursiv', + underline: 'Understruken', + clear: 'Radera formatering', + height: 'Radavstånd', + name: 'Teckensnitt', + strikethrough: 'Genomstruken', + size: 'Teckenstorlek' + }, + image: { + image: 'Bild', + insert: 'Infoga bild', + resizeFull: 'Full storlek', + resizeHalf: 'Halv storlek', + resizeQuarter: 'En fjärdedel i storlek', + floatLeft: 'Vänsterjusterad', + floatRight: 'Högerjusterad', + floatNone: 'Ingen justering', + dragImageHere: 'Dra en bild hit', + selectFromFiles: 'Välj från filer', + url: 'Länk till bild', + remove: 'Ta bort bild' + }, + video: { + video: 'Filmklipp', + videoLink: 'Länk till filmklipp', + insert: 'Infoga filmklipp', + url: 'Länk till filmklipp', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion eller Youku)' + }, + link: { + link: 'Länk', + insert: 'Infoga länk', + unlink: 'Ta bort länk', + edit: 'Redigera', + textToDisplay: 'Visningstext', + url: 'Till vilken URL ska denna länk peka?', + openInNewWindow: 'Öppna i ett nytt fönster' + }, + table: { + table: 'Tabell' + }, + hr: { + insert: 'Infoga horisontell linje' + }, + style: { + style: 'Stil', + p: 'p', + blockquote: 'Citat', + pre: 'Kod', + h1: 'Rubrik 1', + h2: 'Rubrik 2', + h3: 'Rubrik 3', + h4: 'Rubrik 4', + h5: 'Rubrik 5', + h6: 'Rubrik 6' + }, + lists: { + unordered: 'Punktlista', + ordered: 'Numrerad lista' + }, + options: { + help: 'Hjälp', + fullscreen: 'Fullskärm', + codeview: 'HTML-visning' + }, + paragraph: { + paragraph: 'Justera text', + outdent: 'Minska indrag', + indent: 'Öka indrag', + left: 'Vänsterjusterad', + center: 'Centrerad', + right: 'Högerjusterad', + justify: 'Justera text' + }, + color: { + recent: 'Senast använda färg', + more: 'Fler färger', + background: 'Bakgrundsfärg', + foreground: 'Teckenfärg', + transparent: 'Genomskinlig', + setTransparent: 'Gör genomskinlig', + reset: 'Nollställ', + resetToDefault: 'Återställ till standard' + }, + shortcut: { + shortcuts: 'Kortkommandon', + close: 'Stäng', + textFormatting: 'Textformatering', + action: 'Funktion', + paragraphFormatting: 'Avsnittsformatering', + documentStyle: 'Dokumentstil' + }, + history: { + undo: 'Ångra', + redo: 'Gör om' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-th-TH.js b/public/admin/view/javascript/summernote/lang/summernote-th-TH.js new file mode 100644 index 0000000..47ae58c --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-th-TH.js @@ -0,0 +1,106 @@ +(function ($) { + $.extend($.summernote.lang, { + 'th-TH': { + 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: 'ลบรูปภาพ' + }, + video: { + video: 'วีดีโอ', + videoLink: 'ลิงก์ของวีดีโอ', + insert: 'แทรกวีดีโอ', + url: 'ที่อยู่ URL ของวีดีโอ?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion หรือ Youku)' + }, + link: { + link: 'ตัวเชื่อมโยง', + insert: 'แทรกตัวเชื่อมโยง', + unlink: 'ยกเลิกตัวเชื่อมโยง', + edit: 'แก้ไข', + textToDisplay: 'ข้อความที่ให้แสดง', + url: 'ที่อยู่เว็บไซต์ที่ต้องการให้เชื่อมโยงไปถึง?', + openInNewWindow: 'เปิดในหน้าต่างใหม่' + }, + table: { + table: 'ตาราง' + }, + hr: { + insert: 'แทรกเส้นคั่น' + }, + style: { + style: 'รูปแบบ', + p: 'ปกติ', + 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); diff --git a/public/admin/view/javascript/summernote/lang/summernote-tr-TR.js b/public/admin/view/javascript/summernote/lang/summernote-tr-TR.js new file mode 100644 index 0000000..e9e21d4 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-tr-TR.js @@ -0,0 +1,147 @@ +(function ($) { + $.extend($.summernote.lang, { + 'tr-TR': { + font: { + bold: 'Kalın', + italic: 'İtalik', + underline: 'Altı çizili', + clear: 'Temizle', + height: 'Satır yüksekliği', + name: 'Yazı Tipi', + strikethrough: 'Üstü çizili', + subscript: 'Alt Simge', + superscript: 'Üst Simge', + size: 'Yazı tipi boyutu' + }, + image: { + image: 'Resim', + insert: 'Resim ekle', + resizeFull: 'Orjinal boyut', + resizeHalf: '1/2 boyut', + resizeQuarter: '1/4 boyut', + floatLeft: 'Sola hizala', + floatRight: 'Sağa hizala', + floatNone: 'Hizalamayı kaldır', + shapeRounded: 'Şekil: Yuvarlatılmış Köşe', + shapeCircle: 'Şekil: Daire', + shapeThumbnail: 'Şekil: K.Resim', + shapeNone: 'Şekil: Yok', + dragImageHere: 'Buraya sürükleyin', + dropImage: 'Resim veya metni bırakın', + selectFromFiles: 'Dosya seçin', + maximumFileSize: 'Maksimum dosya boyutu', + maximumFileSizeError: 'Maksimum dosya boyutu aşıldı.', + url: 'Resim bağlantısı', + remove: 'Resimi Kaldır' + }, + video: { + video: 'Video', + videoLink: 'Video bağlantısı', + insert: 'Video ekle', + url: 'Video bağlantısı?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion veya Youku)' + }, + link: { + link: 'Bağlantı', + insert: 'Bağlantı ekle', + unlink: 'Bağlantıyı kaldır', + edit: 'Bağlantıyı düzenle', + textToDisplay: 'Görüntülemek için', + url: 'Bağlantı adresi?', + openInNewWindow: 'Yeni pencerede aç' + }, + table: { + table: 'Tablo' + }, + hr: { + insert: 'Yatay çizgi ekle' + }, + style: { + style: 'Biçim', + p: 'p', + blockquote: 'Alıntı', + pre: 'Önbiçimli', + h1: 'Başlık 1', + h2: 'Başlık 2', + h3: 'Başlık 3', + h4: 'Başlık 4', + h5: 'Başlık 5', + h6: 'Başlık 6' + }, + lists: { + unordered: 'Madde işaretli liste', + ordered: 'Numaralı liste' + }, + options: { + help: 'Yardım', + fullscreen: 'Tam ekran', + codeview: 'HTML Kodu' + }, + paragraph: { + paragraph: 'Paragraf', + outdent: 'Girintiyi artır', + indent: 'Girintiyi azalt', + left: 'Sola hizala', + center: 'Ortaya hizala', + right: 'Sağa hizala', + justify: 'Yasla' + }, + color: { + recent: 'Son renk', + more: 'Daha fazla renk', + background: 'Arka plan rengi', + foreground: 'Yazı rengi', + transparent: 'Seffaflık', + setTransparent: 'Şeffaflığı ayarla', + reset: 'Sıfırla', + resetToDefault: 'Varsayılanlara sıfırla' + }, + shortcut: { + shortcuts: 'Kısayollar', + close: 'Kapat', + textFormatting: 'Yazı biçimlendirme', + action: 'Eylem', + paragraphFormatting: 'Paragraf biçimlendirme', + documentStyle: 'Biçim', + extraKeys: 'İlave anahtarlar' + }, + help: { + 'insertParagraph': 'Paragraf ekler', + 'undo': 'Son komudu geri alır', + 'redo': 'Son komudu yineler', + 'tab': 'Girintiyi artırır', + 'untab': 'Girintiyi azaltır', + 'bold': 'Kalın yazma stilini ayarlar', + 'italic': 'İtalik yazma stilini ayarlar', + 'underline': 'Altı çizgili yazma stilini ayarlar', + 'strikethrough': 'Üstü çizgili yazma stilini ayarlar', + 'removeFormat': 'Biçimlendirmeyi temizler', + 'justifyLeft': 'Yazıyı sola hizalar', + 'justifyCenter': 'Yazıyı ortalar', + 'justifyRight': 'Yazıyı sağa hizalar', + 'justifyFull': 'Yazıyı her iki tarafa yazlar', + 'insertUnorderedList': 'Madde işaretli liste ekler', + 'insertOrderedList': 'Numaralı liste ekler', + 'outdent': 'Aktif paragrafın girintisini azaltır', + 'indent': 'Aktif paragrafın girintisini artırır', + 'formatPara': 'Aktif bloğun biçimini paragraf (p) olarak değiştirir', + 'formatH1': 'Aktif bloğun biçimini başlık 1 (h1) olarak değiştirir', + 'formatH2': 'Aktif bloğun biçimini başlık 2 (h2) olarak değiştirir', + 'formatH3': 'Aktif bloğun biçimini başlık 3 (h3) olarak değiştirir', + 'formatH4': 'Aktif bloğun biçimini başlık 4 (h4) olarak değiştirir', + 'formatH5': 'Aktif bloğun biçimini başlık 5 (h5) olarak değiştirir', + 'formatH6': 'Aktif bloğun biçimini başlık 6 (h6) olarak değiştirir', + 'insertHorizontalRule': 'Yatay çizgi ekler', + 'linkDialog.show': 'Bağlantı ayar kutusunu gösterir' + }, + history: { + undo: 'Geri al', + redo: 'Yinele' + }, + specialChar: { + specialChar: 'ÖZEL KARAKTERLER', + select: 'Özel Karakterleri seçin' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-uk-UA.js b/public/admin/view/javascript/summernote/lang/summernote-uk-UA.js new file mode 100644 index 0000000..e210572 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-uk-UA.js @@ -0,0 +1,111 @@ +(function ($) { + $.extend($.summernote.lang, { + 'uk-UA': { + font: { + bold: 'Напівжирний', + italic: 'Курсив', + underline: 'Підкреслений', + clear: 'Прибрати стилі шрифту', + height: 'Висота лінії', + name: 'Шрифт', + strikethrough: 'Закреслений', + subscript: 'Нижній індекс', + superscript: 'Верхній індекс', + size: 'Розмір шрифту' + }, + image: { + image: 'Картинка', + insert: 'Вставити картинку', + resizeFull: 'Відновити розмір', + resizeHalf: 'Зменшити до 50%', + resizeQuarter: 'Зменшити до 25%', + floatLeft: 'Розташувати ліворуч', + floatRight: 'Розташувати праворуч', + floatNone: 'Початкове розташування', + shapeRounded: 'Форма: Заокруглена', + shapeCircle: 'Форма: Коло', + shapeThumbnail: 'Форма: Мініатюра', + shapeNone: 'Форма: Немає', + dragImageHere: 'Перетягніть сюди картинку', + dropImage: 'Перетягніть картинку', + selectFromFiles: 'Вибрати з файлів', + url: 'URL картинки', + remove: 'Видалити картинку' + }, + video: { + video: 'Відео', + videoLink: 'Посилання на відео', + insert: 'Вставити відео', + url: 'URL відео', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion чи Youku)' + }, + link: { + link: 'Посилання', + insert: 'Вставити посилання', + unlink: 'Прибрати посилання', + edit: 'Редагувати', + textToDisplay: 'Текст, що відображається', + url: 'URL для переходу', + openInNewWindow: 'Відкривати у новому вікні' + }, + table: { + table: 'Таблиця' + }, + hr: { + insert: 'Вставити горизонтальну лінію' + }, + style: { + style: 'Стиль', + p: 'Нормальний', + 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); diff --git a/public/admin/view/javascript/summernote/lang/summernote-vi-VN.js b/public/admin/view/javascript/summernote/lang/summernote-vi-VN.js new file mode 100644 index 0000000..917e629 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-vi-VN.js @@ -0,0 +1,104 @@ +(function ($) { + $.extend($.summernote.lang, { + 'vi-VN': { + font: { + bold: 'In Đậm', + italic: 'In Nghiêng', + underline: 'Gạch dưới', + clear: 'Bỏ định dạng', + height: 'Chiều cao dòng', + name: 'Phông chữ', + strikethrough: 'Gạch ngang', + size: 'Cỡ chữ' + }, + image: { + image: 'Hình ảnh', + insert: 'Chèn', + resizeFull: '100%', + resizeHalf: '50%', + resizeQuarter: '25%', + floatLeft: 'Trôi về trái', + floatRight: 'Trôi về phải', + floatNone: 'Không trôi', + dragImageHere: 'Thả Ảnh ở vùng này', + selectFromFiles: 'Chọn từ File', + url: 'URL', + remove: 'Xóa' + }, + video: { + video: 'Video', + videoLink: 'Link đến Video', + insert: 'Chèn Video', + url: 'URL', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion và Youku)' + }, + link: { + link: 'Link', + insert: 'Chèn Link', + unlink: 'Gỡ Link', + edit: 'Sửa', + textToDisplay: 'Văn bản hiển thị', + url: 'URL', + openInNewWindow: 'Mở ở Cửa sổ mới' + }, + table: { + table: 'Bảng' + }, + hr: { + insert: 'Chèn' + }, + style: { + style: 'Kiểu chữ', + p: 'Chữ thường', + blockquote: 'Đoạn trích', + pre: 'Mã Code', + h1: 'H1', + h2: 'H2', + h3: 'H3', + h4: 'H4', + h5: 'H5', + h6: 'H6' + }, + lists: { + unordered: 'Liệt kê danh sách', + ordered: 'Liệt kê theo thứ tự' + }, + options: { + help: 'Trợ giúp', + fullscreen: 'Toàn Màn hình', + codeview: 'Xem Code' + }, + paragraph: { + paragraph: 'Canh lề', + outdent: 'Dịch sang trái', + indent: 'Dịch sang phải', + left: 'Canh trái', + center: 'Canh giữa', + right: 'Canh phải', + justify: 'Canh đều' + }, + color: { + recent: 'Màu chữ', + more: 'Mở rộng', + background: 'Màu nền', + foreground: 'Màu chữ', + transparent: 'trong suốt', + setTransparent: 'Nền trong suốt', + reset: 'Thiết lập lại', + resetToDefault: 'Trở lại ban đầu' + }, + shortcut: { + shortcuts: 'Phím tắt', + close: 'Đóng', + textFormatting: 'Định dạng Văn bản', + action: 'Hành động', + paragraphFormatting: 'Định dạng', + documentStyle: 'Kiểu văn bản' + }, + history: { + undo: 'Lùi lại', + redo: 'Làm lại' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-zh-CN.js b/public/admin/view/javascript/summernote/lang/summernote-zh-CN.js new file mode 100644 index 0000000..99e5194 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-zh-CN.js @@ -0,0 +1,113 @@ +(function ($) { + $.extend($.summernote.lang, { + 'zh-CN': { + font: { + bold: '粗体', + italic: '斜体', + underline: '下划线', + clear: '清除格式', + height: '行高', + name: '字体', + strikethrough: '删除线', + subscript: '下标', + superscript: '上标', + size: '字号' + }, + image: { + image: '图片', + insert: '插入图片', + resizeFull: '缩放至 100%', + resizeHalf: '缩放至 50%', + resizeQuarter: '缩放至 25%', + floatLeft: '靠左浮动', + floatRight: '靠右浮动', + floatNone: '取消浮动', + shapeRounded: '形状: 圆角', + shapeCircle: '形状: 圆', + shapeThumbnail: '形状: 缩略图', + shapeNone: '形状: 无', + dragImageHere: '将图片拖拽至此处', + selectFromFiles: '从本地上传', + maximumFileSize: '文件大小最大值', + maximumFileSizeError: '文件大小超出最大值。', + url: '图片地址', + remove: '移除图片' + }, + video: { + video: '视频', + videoLink: '视频链接', + insert: '插入视频', + url: '视频地址', + providers: '(优酷, Instagram, DailyMotion, Youtube等)' + }, + link: { + link: '链接', + insert: '插入链接', + unlink: '去除链接', + edit: '编辑链接', + textToDisplay: '显示文本', + url: '链接地址', + openInNewWindow: '在新窗口打开' + }, + table: { + table: '表格' + }, + hr: { + insert: '水平线' + }, + style: { + style: '样式', + p: '普通', + 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: '文档样式', + extraKeys: '额外按键' + }, + history: { + undo: '撤销', + redo: '重做' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/lang/summernote-zh-TW.js b/public/admin/view/javascript/summernote/lang/summernote-zh-TW.js new file mode 100644 index 0000000..775e217 --- /dev/null +++ b/public/admin/view/javascript/summernote/lang/summernote-zh-TW.js @@ -0,0 +1,113 @@ +(function ($) { + $.extend($.summernote.lang, { + 'zh-TW': { + font: { + bold: '粗體', + italic: '斜體', + underline: '底線', + clear: '清除格式', + height: '行高', + name: '字體', + strikethrough: '刪除線', + subscript: '下標', + superscript: '上標', + size: '字號' + }, + image: { + image: '圖片', + insert: '插入圖片', + resizeFull: '縮放至100%', + resizeHalf: '縮放至 50%', + resizeQuarter: '縮放至 25%', + floatLeft: '靠左浮動', + floatRight: '靠右浮動', + floatNone: '取消浮動', + shapeRounded: '形狀: 圓角', + shapeCircle: '形狀: 圓', + shapeThumbnail: '形狀: 縮略圖', + shapeNone: '形狀: 無', + dragImageHere: '將圖片拖曳至此處', + selectFromFiles: '從本機上傳', + maximumFileSize: '文件大小最大值', + maximumFileSizeError: '文件大小超出最大值。', + url: '圖片網址', + remove: '移除圖片' + }, + video: { + video: '影片', + videoLink: '影片連結', + insert: '插入影片', + url: '影片網址', + providers: '(優酷, Instagram, DailyMotion, Youtube等)' + }, + link: { + link: '連結', + insert: '插入連結', + unlink: '取消連結', + edit: '編輯連結', + textToDisplay: '顯示文字', + url: '連結網址', + openInNewWindow: '在新視窗開啟' + }, + table: { + table: '表格' + }, + hr: { + insert: '水平線' + }, + style: { + style: '樣式', + p: '一般', + 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: '文件格式', + extraKeys: '額外按鍵' + }, + history: { + undo: '復原', + redo: '取消復原' + } + } + }); +})(jQuery); diff --git a/public/admin/view/javascript/summernote/opencart.js b/public/admin/view/javascript/summernote/opencart.js new file mode 100644 index 0000000..64b90dc --- /dev/null +++ b/public/admin/view/javascript/summernote/opencart.js @@ -0,0 +1,85 @@ +$(document).ready(function() { + // Override summernotes image manager + $('[data-toggle=\'summernote\']').each(function() { + var element = this; + + if ($(this).attr('data-lang')) { + $('head').append('<script type="text/javascript" src="view/javascript/summernote/lang/summernote-' + $(this).attr('data-lang') + '.js"></script>'); + } + + $(element).summernote({ + lang: $(this).attr('data-lang'), + disableDragAndDrop: true, + height: 300, + emptyPara: '', + codemirror: { // codemirror options + mode: 'text/html', + htmlMode: true, + lineNumbers: true, + theme: 'monokai' + }, + fontsize: ['8', '9', '10', '11', '12', '14', '16', '18', '20', '24', '30', '36', '48' , '64'], + toolbar: [ + ['style', ['style']], + ['font', ['bold', 'underline', 'clear']], + ['fontname', ['fontname']], + ['fontsize', ['fontsize']], + ['color', ['color']], + ['para', ['ul', 'ol', 'paragraph']], + ['table', ['table']], + ['insert', ['link', 'image', 'video']], + ['view', ['fullscreen', 'codeview', 'help']] + ], + popover: { + image: [ + ['custom', ['imageAttributes']], + ['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']], + ['float', ['floatLeft', 'floatRight', 'floatNone']], + ['remove', ['removeMedia']] + ], + }, + buttons: { + image: function() { + var ui = $.summernote.ui; + + // create button + var button = ui.button({ + contents: '<i class="note-icon-picture" />', + tooltip: $.summernote.lang[$.summernote.options.lang].image.image, + click: function () { + $('#modal-image').remove(); + + $.ajax({ + url: 'index.php?route=common/filemanager&user_token=' + getURLVar('user_token'), + dataType: 'html', + beforeSend: function() { + $('#button-image i').replaceWith('<i class="fa fa-circle-o-notch fa-spin"></i>'); + $('#button-image').prop('disabled', true); + }, + complete: function() { + $('#button-image i').replaceWith('<i class="fa fa-upload"></i>'); + $('#button-image').prop('disabled', false); + }, + success: function(html) { + $('body').append('<div id="modal-image" class="modal">' + html + '</div>'); + + $('#modal-image').modal('show'); + + $('#modal-image').delegate('a.thumbnail', 'click', function(e) { + e.preventDefault(); + + $(element).summernote('insertImage', $(this).attr('href')); + + $('#modal-image').modal('hide'); + }); + } + }); + } + }); + + return button.render(); + } + } + }); + }); +});
\ No newline at end of file diff --git a/public/admin/view/javascript/summernote/plugin/hello/summernote-ext-hello.js b/public/admin/view/javascript/summernote/plugin/hello/summernote-ext-hello.js new file mode 100644 index 0000000..7c6434a --- /dev/null +++ b/public/admin/view/javascript/summernote/plugin/hello/summernote-ext-hello.js @@ -0,0 +1,82 @@ +(function (factory) { + /* global define */ + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(window.jQuery); + } +}(function ($) { + + // Extends plugins for adding hello. + // - plugin is external module for customizing. + $.extend($.summernote.plugins, { + /** + * @param {Object} context - context object has status of editor. + */ + 'hello': function (context) { + var self = this; + + // ui has renders to build ui elements. + // - you can create a button with `ui.button` + var ui = $.summernote.ui; + + // add hello button + context.memo('button.hello', function () { + // create button + var button = ui.button({ + contents: '<i class="fa fa-child"/> Hello', + tooltip: 'hello', + click: function () { + self.$panel.show(); + self.$panel.hide(500); + // invoke insertText method with 'hello' on editor module. + context.invoke('editor.insertText', 'hello'); + } + }); + + // create jQuery object from button instance. + var $hello = button.render(); + return $hello; + }); + + // This events will be attached when editor is initialized. + this.events = { + // This will be called after modules are initialized. + 'summernote.init': function (we, e) { + console.log('summernote initialized', we, e); + }, + // This will be called when user releases a key on editable. + 'summernote.keyup': function (we, e) { + console.log('summernote keyup', we, e); + } + }; + + // This method will be called when editor is initialized by $('..').summernote(); + // You can create elements for plugin + this.initialize = function () { + this.$panel = $('<div class="hello-panel"/>').css({ + position: 'absolute', + width: 100, + height: 100, + left: '50%', + top: '50%', + background: 'red' + }).hide(); + + this.$panel.appendTo('body'); + }; + + // This methods will be called when editor is destroyed by $('..').summernote('destroy'); + // You should remove elements on `initialize`. + this.destroy = function () { + this.$panel.remove(); + this.$panel = null; + }; + } + }); +})); diff --git a/public/admin/view/javascript/summernote/plugin/specialchars/summernote-ext-specialchars.js b/public/admin/view/javascript/summernote/plugin/specialchars/summernote-ext-specialchars.js new file mode 100644 index 0000000..230e750 --- /dev/null +++ b/public/admin/view/javascript/summernote/plugin/specialchars/summernote-ext-specialchars.js @@ -0,0 +1,315 @@ +(function (factory) { + /* global define */ + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(window.jQuery); + } +}(function ($) { + $.extend($.summernote.plugins, { + 'specialchars': function (context) { + var self = this; + var ui = $.summernote.ui; + + var $editor = context.layoutInfo.editor; + var options = context.options; + var lang = options.langInfo; + + var KEY = { + UP: 38, + DOWN: 40, + LEFT: 37, + RIGHT: 39, + ENTER: 13 + }; + var COLUMN_LENGTH = 15; + var COLUMN_WIDTH = 35; + + var currentColumn, currentRow, totalColumn, totalRow = 0; + + // special characters data set + var specialCharDataSet = [ + '"', '&', '<', '>', '¡', '¢', + '£', '¤', '¥', '¦', '§', + '¨', '©', 'ª', '«', '¬', + '®', '¯', '°', '±', '²', + '³', '´', 'µ', '¶', '·', + '¸', '¹', 'º', '»', '¼', + '½', '¾', '¿', '×', '÷', + 'ƒ', 'ˆ', '˜', '–', '—', + '‘', '’', '‚', '“', '”', + '„', '†', '‡', '•', '…', + '‰', '′', '″', '‹', '›', + '‾', '⁄', '€', 'ℑ', '℘', + 'ℜ', '™', 'ℵ', '←', '↑', + '→', '↓', '↔', '↵', '⇐', + '⇑', '⇒', '⇓', '⇔', '∀', + '∂', '∃', '∅', '∇', '∈', + '∉', '∋', '∏', '∑', '−', + '∗', '√', '∝', '∞', '∠', + '∧', '∨', '∩', '∪', '∫', + '∴', '∼', '≅', '≈', '≠', + '≡', '≤', '≥', '⊂', '⊃', + '⊄', '⊆', '⊇', '⊕', '⊗', + '⊥', '⋅', '⌈', '⌉', '⌊', + '⌋', '◊', '♠', '♣', '♥', + '♦' + ]; + + context.memo('button.specialCharacter', function () { + return ui.button({ + contents: '<i class="fa fa-font fa-flip-vertical">', + tooltip: lang.specialChar.specialChar, + click: function () { + self.show(); + } + }).render(); + }); + + /** + * Make Special Characters Table + * + * @member plugin.specialChar + * @private + * @return {jQuery} + */ + this.makeSpecialCharSetTable = function () { + var $table = $('<table/>'); + $.each(specialCharDataSet, function (idx, text) { + var $td = $('<td/>').addClass('note-specialchar-node'); + var $tr = (idx % COLUMN_LENGTH === 0) ? $('<tr/>') : $table.find('tr').last(); + + var $button = ui.button({ + callback: function ($node) { + $node.html(text); + $node.attr('title', text); + $node.attr('data-value', encodeURIComponent(text)); + $node.css({ + width: COLUMN_WIDTH, + 'margin-right': '2px', + 'margin-bottom': '2px' + }); + } + }).render(); + + $td.append($button); + + $tr.append($td); + if (idx % COLUMN_LENGTH === 0) { + $table.append($tr); + } + }); + + totalRow = $table.find('tr').length; + totalColumn = COLUMN_LENGTH; + + return $table; + }; + + this.initialize = function () { + var $container = options.dialogsInBody ? $(document.body) : $editor; + + var body = '<div class="form-group row-fluid">' + this.makeSpecialCharSetTable()[0].outerHTML + '</div>'; + + this.$dialog = ui.dialog({ + title: lang.specialChar.select, + body: body + }).render().appendTo($container); + }; + + this.show = function () { + var text = context.invoke('editor.getSelectedText'); + context.invoke('editor.saveRange'); + this.showSpecialCharDialog(text).then(function (selectChar) { + context.invoke('editor.restoreRange'); + + // build node + var $node = $('<span></span>').html(selectChar)[0]; + + if ($node) { + // insert video node + context.invoke('editor.insertNode', $node); + } + }).fail(function () { + context.invoke('editor.restoreRange'); + }); + }; + + /** + * show image dialog + * + * @param {jQuery} $dialog + * @return {Promise} + */ + this.showSpecialCharDialog = function (text) { + return $.Deferred(function (deferred) { + var $specialCharDialog = self.$dialog; + var $specialCharNode = $specialCharDialog.find('.note-specialchar-node'); + var $selectedNode = null; + var ARROW_KEYS = [KEY.UP, KEY.DOWN, KEY.LEFT, KEY.RIGHT]; + var ENTER_KEY = KEY.ENTER; + + function addActiveClass($target) { + if (!$target) { + return; + } + $target.find('button').addClass('active'); + $selectedNode = $target; + } + + function removeActiveClass($target) { + $target.find('button').removeClass('active'); + $selectedNode = null; + } + + // find next node + function findNextNode(row, column) { + var findNode = null; + $.each($specialCharNode, function (idx, $node) { + var findRow = Math.ceil((idx + 1) / COLUMN_LENGTH); + var findColumn = ((idx + 1) % COLUMN_LENGTH === 0) ? COLUMN_LENGTH : (idx + 1) % COLUMN_LENGTH; + if (findRow === row && findColumn === column) { + findNode = $node; + return false; + } + }); + return $(findNode); + } + + function arrowKeyHandler(keyCode) { + // left, right, up, down key + var $nextNode; + var lastRowColumnLength = $specialCharNode.length % totalColumn; + + if (KEY.LEFT === keyCode) { + + if (currentColumn > 1) { + currentColumn = currentColumn - 1; + } else if (currentRow === 1 && currentColumn === 1) { + currentColumn = lastRowColumnLength; + currentRow = totalRow; + } else { + currentColumn = totalColumn; + currentRow = currentRow - 1; + } + + } else if (KEY.RIGHT === keyCode) { + + if (currentRow === totalRow && lastRowColumnLength === currentColumn) { + currentColumn = 1; + currentRow = 1; + } else if (currentColumn < totalColumn) { + currentColumn = currentColumn + 1; + } else { + currentColumn = 1; + currentRow = currentRow + 1; + } + + } else if (KEY.UP === keyCode) { + if (currentRow === 1 && lastRowColumnLength < currentColumn) { + currentRow = totalRow - 1; + } else { + currentRow = currentRow - 1; + } + } else if (KEY.DOWN === keyCode) { + currentRow = currentRow + 1; + } + + if (currentRow === totalRow && currentColumn > lastRowColumnLength) { + currentRow = 1; + } else if (currentRow > totalRow) { + currentRow = 1; + } else if (currentRow < 1) { + currentRow = totalRow; + } + + $nextNode = findNextNode(currentRow, currentColumn); + + if ($nextNode) { + removeActiveClass($selectedNode); + addActiveClass($nextNode); + } + } + + function enterKeyHandler() { + if (!$selectedNode) { + return; + } + + deferred.resolve(decodeURIComponent($selectedNode.find('button').attr('data-value'))); + $specialCharDialog.modal('hide'); + } + + function keyDownEventHandler(event) { + event.preventDefault(); + var keyCode = event.keyCode; + if (keyCode === undefined || keyCode === null) { + return; + } + // check arrowKeys match + if (ARROW_KEYS.indexOf(keyCode) > -1) { + if ($selectedNode === null) { + addActiveClass($specialCharNode.eq(0)); + currentColumn = 1; + currentRow = 1; + return; + } + arrowKeyHandler(keyCode); + } else if (keyCode === ENTER_KEY) { + enterKeyHandler(); + } + return false; + } + + // remove class + removeActiveClass($specialCharNode); + + // find selected node + if (text) { + for (var i = 0; i < $specialCharNode.length; i++) { + var $checkNode = $($specialCharNode[i]); + if ($checkNode.text() === text) { + addActiveClass($checkNode); + currentRow = Math.ceil((i + 1) / COLUMN_LENGTH); + currentColumn = (i + 1) % COLUMN_LENGTH; + } + } + } + + ui.onDialogShown(self.$dialog, function () { + + $(document).on('keydown', keyDownEventHandler); + + self.$dialog.find('button').tooltip(); + + $specialCharNode.on('click', function (event) { + event.preventDefault(); + deferred.resolve(decodeURIComponent($(event.currentTarget).find('button').attr('data-value'))); + ui.hideDialog(self.$dialog); + }); + + }); + + ui.onDialogHidden(self.$dialog, function () { + $specialCharNode.off('click'); + + self.$dialog.find('button').tooltip('destroy'); + + $(document).off('keydown', keyDownEventHandler); + + if (deferred.state() === 'pending') { + deferred.reject(); + } + }); + + ui.showDialog(self.$dialog); + }); + }; + } + }); +})); diff --git a/public/admin/view/javascript/summernote/summernote-image-attributes.js b/public/admin/view/javascript/summernote/summernote-image-attributes.js new file mode 100644 index 0000000..d41587f --- /dev/null +++ b/public/admin/view/javascript/summernote/summernote-image-attributes.js @@ -0,0 +1,653 @@ +/** + * Summernote Image Attributes + * https://github.com/StudioJunkyard/summernote-image-attributes + */ +(function(factory){ + if(typeof define==='function'&&define.amd){ + define(['jquery'],factory); + }else if(typeof module==='object'&&module.exports){ + module.exports=factory(require('jquery')); + }else{ + factory(window.jQuery); + } +}(function($){ + var readFileAsDataURL=function(file){ + return $.Deferred(function(deferred){ + $.extend(new FileReader(),{ + onload:function(e){ + var sDataURL=e.target.result; + deferred.resolve(sDataURL); + }, + onerror:function(){ + deferred.reject(this); + } + }).readAsDataURL(file); + }).promise(); + }; + $.extend(true,$.summernote.lang,{ + 'en-US':{ /* English */ + imageAttributes:{ + dialogTitle:'Image Attributes', + tooltip:'Image Attributes', + pluginImageTitle:'Image Attributes', + pluginLinkTitle:'Link Attributes', + title:'Title', + src:'Source', + srcHelp:'Selecting an image will replace existing image with an Inlined Image.', + alt:'Alt', + class:'Class', + classSelect:'Select Class', + style:'Style', + role:'Role', + href:'URL', + target:'Target', + linkClass:'Class', + linkRole:'Role', + rel:'Rel', + relBlank:'Do not use Rel Attribute', + relAlternate:'Alternate: Links to an alternate version of the document', + relAuthor:'Author: Links to the Author of the Document', + relBookmark:'Bookmark: Permanent URL used for Bookmarking', + relHelp:'Help: Links to a Help Document', + relLicense:'License: Links to copyright information for the document', + relNext:'Next: The next document in a selection', + relNofollow:'NoFollow: Links to an unendorsed document, like a paid link, also stops Search Engines following this link', + relNoreferrer:'NoReferrer: Specifies that the browser should not send a HTTP Header', + relPrefetch:'PreFetch: Specifies that the target document should be cached', + relPrev:'Prev: The previous document in a selection', + relSearch:'Search: Links to a search tool for the document', + relTag:'Tag: A tag (Keyword) for the current document' + } + }, + 'es-ES':{ /* Spanish */ + imageAttributes:{ + dialogTitle:'Propiedades de la Imagen', + tooltip:'Propiedades de la Imagen', + pluginImageTitle:'Atributos de la Imagen', + pluginLinkTitle:'Atributos del Enlace', + title:'Titulo', + src:'Fuente', + srcHelp:'La selección de una imagen reemplazará la imagen existente con una imagen Inline.', + alt:'Alternativo', + class:'Clases', + classSelect:'Selecciona Forma', + style:'Estilo', + role:'Papel', + href:'URL', + target:'Destino', + linkClass:'Clase', + linkRole:'Papel', + rel:'Rel', + relBlank:'No usar atributo Rel', + relAlternate:'Alternate: Enlaza a una versión alternativa del documento', + relAuthor:'Author: Enlaza al autor del documento', + relBookmark:'Bookmark: URL permanente utilizada para enlazar', + relHelp:'Help: Enlaza a un documento de Ayuda', + relLicense:'License: Enlaza a un documento de información de Copyright', + relNext:'Next: Enlaza al siguiente documento en una selección', + relNofollow:'NoFollow: Enlaza a un documento no confirmado, como un enlace de pago, también evita que los buscadores sigan este enlace', + relNoreferrer:'NoReferrer: Specifies that the browser should not send a HTTP Header', + relPrefetch:'PreFetch: Specifies that the target document should be cached', + relPrev:'Prev: Enlaza al documento anterior en una selección', + relSearch:'Search: Enlaza a una herramienta de búsqueda para el documento', + relTag:'Tag: Un etiqueta (palabra clave) para el documento actual' + } + }, + 'pt-BR':{ /* Spanish */ + imageAttributes:{ + dialogTitle:'Propriedades da Imagem', + tooltip:'Propriedades da Imagem', + pluginImageTitle:'Propriedades da Imagem', + pluginLinkTitle:'Propriedades do Link', + title:'Título', + src:'Fonte', + srcHelp:'Selecionar uma imagem irá substituir a imagem existente com uma imagem inline.', + alt:'Alt', + class:'Class', + classSelect:'Selecione a Classe', + style:'Estilo', + role:'Papel', + href:'URL', + target:'Destino', + linkClass:'Classe', + linkRole:'Papel', + rel:'Rel', + relBlank:'Não use o atribudo Rel', + relAlternate:'Alternate: Links para uma versão alternativa do documento', + relAuthor:'Author: Links para o autor do documento', + relBookmark:'Bookmark: URL permanente usada para favoritos', + relHelp:'Help: Links para um documento de ajuda', + relLicense:'License: Links para a informação de copyright do documento', + relNext:'Next: O próximo documento em uma seleção', + relNofollow:'NoFollow: Links para um documento não confirmado, como um link pago, também impede mecanismos de busca de seguir esse link', + relNoreferrer:'NoReferrer: Especifica que o navegador não deve enviar um cabeçalho HTTP', + relPrefetch:'PreFetch: Especifica que o documento de destino deve ser cacheado', + relPrev:'Prev: O documento anterior em uma seleção', + relSearch:'Search: Links para um mecanismos de busca para o documento', + relTag:'Tag: Uma etiqueta (palavra-chave) para o documento atual' + } + }, + 'fr-FR':{ /* French */ + imageAttributes:{ + dialogTitle:'Attributs de l\'image', + tooltip:'Attributs de l\'image', + pluginImageTitle:'Attributs de l\'image', + pluginLinkTitle:'Attributs du lien', + title:'Titre', + src:'La source', + srcHelp:'La sélection d\'une image remplacera l\'image existante par une Image Inline.', + alt:'Alt', + class:'Class CSS', + classSelect:'Choisir une Class', + style:'Style', + role:'Rôle', + href:'URL', + target:'Cible', + linkClass:'Class CSS du lien', + linkRole:'Rôle', + rel:'Lien Rel', + relBlank:'Ne pas utiliser d\'attribut Rel', + relAlternate:'Alternate: Lien vers une autre version du document', + relAuthor:'Author: Lien vers l\'auteur du document', + relBookmark:'Bookmark: Lien permant utilisé pour les signets', + relHelp:'Help: Lien vers un document d\'aide', + relLicense:'License: Lien vers les informations de droits d\'auteur du document', + relNext:'Next: La page suivante de ce document', + relNofollow:'NoFollow: Empêcher les moteurs de recherche de suivre ce lien', + relNoreferrer:'NoReferrer: Précise que le navigateur ne doit pas envoyer d\'entête HTTP', + relPrefetch:'PreFetch: Précise que le document cible doit être mis en cache', + relPrev:'Prev: La page précédente de ce document', + relSearch:'Search: Lien vers un outil de recherche du document', + relTag:'Tag: Mot-clé du document' + } + }, + 'zh-TW':{ /* Chinese */ + imageAttributes:{ + dialogTitle:'圖片提示', + tooltip:'圖片提示', + pluginImageTitle:'圖片屬性', + pluginLinkTitle:'連結屬性', + title:'標題', + src:'資源', + srcHelp:'選擇圖像將用內聯圖像替換現有圖像.', + alt:'圖片說明', + class:'类', + classSelect:'選擇 类', + style:'样式', + role:'角色', + href:'URL', + target:'目標', + linkClass:'連結樣式', + linkRole:'角色', + rel:'描述', + relBlank:'不使用連結說明', + rel:'不使用鏈結說明', + relBlank:'不使用鏈結說明', + relAlternate:'替代說明: 連至替代說明文件', + relAuthor:'作者: 連至來源位置', + relBookmark:'書籤: 提供加入書籤', + relHelp:'幫助: 連結至幫助文件', + relLicense:'版權: 連結至版權宣告頁面', + relNext:'下一步: 連結至下一個被選擇的頁面', + relNofollow:'不追蹤: 連結設置取消追蹤選項, 例如付費頁面, 並且禁止搜尋引擎追蹤該頁面', + relNoreferrer:'NoReferrer: 指定發送時取消 HTTP 的開頭', + relPrefetch:'預存: 指定該頁面啟用預存瀏覽', + relPrev:'上一步: 上一個被選擇的頁面', + relSearch:'搜尋: 連至搜尋文件', + relTag:'標籤: 為該文件設定標籤(關鍵字)' + } + }, + 'it-IT':{ /* Italian */ + imageAttributes:{ + dialogTitle:'Attributi Immagine', + tooltip:'Attributi Immagine', + pluginImageTitle:'Attributi Immagine', + pluginLinkTitle:'Attributi Collegamento', + title:'Titolo', + src:'Fonte', + srcHelp:'elezione di un\'immagine sostituirà immagine esistente con un inline Immagine.', + alt:'Alt', + class:'Classe', + classSelect:'Seleziona Classe', + style:'Stile', + role:'Ruolo', + href:'URL', + target:'Bersaglio', + linkClass:'Classe per il collegamento', + linkRole:'Ruolo', + rel:'Link Rel', + relBlank:'Non usare attributo Rel', + relAlternate:'Alternate: Collegamento ad una versione alternativa del documento', + relAuthor:'Author: Collegamento all\'autore del documento', + relBookmark:'Bookmark: URL permanente per i preferiti', + relHelp:'Help: Collegamento ad una pagina di aiuto per questo documento', + relLicense:'License: Collegamento alle informazioni sul copyright di questo docuemnto', + relNext:'Next: Pagina successiva di questo documento', + relNofollow:'NoFollow: Impedisce ai motori di ricerca di seguire questo collegamento', + relNoreferrer:'NoReferrer: Specifica al browser di non inviare Header HTTP', + relPrefetch:'PreFetch: Specifica che il documento di destinazione deve essere memorizzato nella cache', + relPrev:'Prev: Pagina precedente di questo documento', + relSearch:'Search: Collegamenti a uno strumento di ricerca per questo documento', + relTag:'Tag: Un tag (parola chiave) per questo documento' + } + }, + 'de-DE':{ /* German */ + imageAttributes:{ + dialogTitle:'Bild Eigenschaften', + tooltip:'Bild Eigenschaften', + pluginImageTitle:'Bild Eigenschaften', + pluginLinkTitle:'Link Eigenschaften', + title:'Titel', + src:'Quelle', + srcHelp:'Wenn Sie ein Bild auswählen, wird das bestehende Bild durch ein Inlined Image ersetzt.', + alt:'Alt Tag', + class:'CSS Klasse', + classSelect:'wähle CSS Klasse', + style:'Stil', + role:'Rolle', + href:'URL', + target:'Ziel (target)', + linkClass:'CSS Link Klasse', + linkRole:'Ruolo', + rel:'Link Beziehung (Relation)', + relBlank:'Keine Link Beziehung', + relAlternate:'Alternate: Link zu einer alternativen Version', + relAuthor:'Author: Link zum Autor des Artikels', + relBookmark:'Bookmark: Permanent URL für Lesezeichen', + relHelp:'Help: Link zur Hilfe', + relLicense:'License: Link zu Urheber und Lizenzinformationen', + relNext:'Next: Die nächste aktive Seite', + relNofollow:'NoFollow: Suchmaschinen sollen dem Link nicht folgen', + relNoreferrer:'NoReferrer: Browser soll keinen HTTP Header senden', + relPrefetch:'PreFetch: Gibt an, dass die Seite gecacht werden soll', + relPrev:'Prev: Die zuletzt aktive Seite', + relSearch:'Search: Link zur Dokumentsuche', + relTag:'Tag: Ein Schlüsselwort (keyword) für diese Seite' + } + }, + 'tr-TR':{ /* Turkish */ + imageAttributes:{ + dialogTitle:'Resim Özellikleri', + tooltip:'Resim Özellikleri', + pluginImageTitle:'Resim Özellikleri', + pluginLinkTitle:'Bağlantı Özellikleri', + title:'Başlık', + src:'Kaynak', + srcHelp:'Bir görüntüyü seçmek, var olan resmi Inlined Image ile değiştirecektir.', + alt:'Alt. Metin', + class:'Sınıf', + classSelect:'Sınıf Seçin', + style:'Stil', + role:'Rol', + href:'URL', + target:'Hedef', + linkClass:'Bağlantı Sınıfı', + linkRole:'Rol', + rel:'Bağlantı İlişkisi(Rel)', + relBlank:'İlişki özelliğini kullanma', + relAlternate:'Alternatif: Belgenin farklı bir versiyonuna bağlantı', + relAuthor:'Yazar: Belgenin yazarına bağlantı', + relBookmark:'Yer İmi: Yer İmi eklemek için kalıcı adres', + relHelp:'Yardım: Yardım dökümanına giden bağlantı', + relLicense:'Lisans: Belgenin telif hakkı bilgisine bağlantı', + relNext:'Sonraki: Sıradaki belgeye giden bağlantı', + relNofollow:'Takip Etme (NoFollow): Arama motorlarının bu bağlantıyı takip etmemesini sağlar', + relNoreferrer:'Referanssız (NoReferrer): Tarayıcının bu bağlantıya referans adresi göndermemesi gerektiğini belirtir', + relPrefetch:'ÖnBellek(PreFetch): Hedef bağlantının ön belleğe alınması gerektiğini belirtir', + relPrev:'Önceki: Önceki belgeye giden bağlantı', + relSearch:'Arama: Belge için bir arama aracına bağlantı olduğunu belirtir.', + relTag:'Etiket: Belge için bir etiket olduğunu belirtir' + } + } + }); + $.extend($.summernote.options,{ + imageDialogLayout:'default', /* default|horizontal */ + imageAttributes:{ + icon:'<i class="note-icon-pencil"/>', + removeEmpty:true, + }, + displayFields:{ + imageBasic:true, + imageExtra:false, + linkBasic:true, + linkExtra:false + } + }); + $.extend($.summernote.plugins,{ + 'imageAttributes':function(context){ + var self=this; + var ui=$.summernote.ui; + var $note=context.layoutInfo.note; + var $editor=context.layoutInfo.editor; + var $editable=context.layoutInfo.editable; + var options=context.options; + var lang=options.langInfo; + var imageLimitation=''; + if(options.maximumImageFileSize){ + var unit=Math.floor(Math.log(options.maximumImageFileSize)/Math.log(1024)); + var readableSize=(options.maximumImageFileSize/Math.pow(1024,unit)).toFixed(2)*1+' '+' KMGTP'[unit]+'B'; + imageLimitation='<small>'+lang.image.maximumFileSize+' : '+readableSize+'</small>'; + } + context.memo('button.imageAttributes',function(){ + var button=ui.button({ + contents:options.imageAttributes.icon, + tooltip:lang.imageAttributes.tooltip, + click:function(e){ + context.invoke('imageAttributes.show'); + } + }); + return button.render(); + }); + this.initialize=function(){ + var $container=options.dialogsInBody?$(document.body):$editor; + if(options.imageDialogLayout=='horizontal'){ + var body='<dl class="dl-horizontal">'; + if (options.displayFields.imageBasic) { + body += '<dt><label for="note-image-attributes-title">'+lang.imageAttributes.title+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-title" class="note-image-attributes-title form-control"></dd>'+ + '<dt><label for="note-image-attributes-src">'+lang.imageAttributes.src+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-src" class="note-image-attributes-src form-control"></dd>'+ + '<dt><label for="note-group-select-from-files"></label></dt>'+ + '<dd><input type="file" id="note-group-select-from-files" name="file" accept="image/*" class="note-image-input form-control">'+imageLimitation+'</dd>'+ + '<dt></dt>'+ + '<dd><small class="help-block">'+lang.imageAttributes.srcHelp+'</small></dd>'+ + '<dt><label for="note-image-attributes-alt">'+lang.imageAttributes.alt+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-alt" class="note-image-attributes-alt form-control"></dd>'; + } + if (options.displayFields.imageExtra) { + body += '<dt><label for="note-image-attributes-class">'+lang.imageAttributes.class+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-class" class="note-image-attributes-class form-control"></dd>'+ + '<dt><label for="note-image-attributes-style">'+lang.imageAttributes.style+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-style" class="note-image-attributes-style form-control"></dd>'+ + '<dt><label for="note-image-attributes-role">'+lang.imageAttributes.role+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-role" class="note-image-attributes-role form-control"></dd>'; + } + body += '</dl>'+ + '<hr>'; + if (options.displayFields.linkBasic) { + body += '<h4>'+lang.imageAttributes.pluginLinkTitle+'</h4>'+ + '<dl class="dl-horizontal">'+ + '<dt><label for="note-image-attributes-link-href">'+lang.imageAttributes.href+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-link-href" class="note-image-attributes-href form-control"></dd>'+ + '<dt><label for="note-image-attributes-link-target">'+lang.imageAttributes.target+'</label></dt>'+ + '<dd><select id="note-image-attributes-link-target" class="note-image-attributes-target form-control">'+ + '<option value="_self">Self</option>'+ + '<option value="_blank">Blank</option>'+ + '<option value="_top">Top</option>'+ + '<option value="_parent">Parent</option>'+ + '</select></dd>'; + } + if (options.displayFields.linkExtra) { + body += '<dt><label for="note-image-attributes-link-class">'+lang.imageAttributes.linkClass+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-link-class" class="note-image-attributes-link-class form-control"></dd>'+ + '<dt><label for="note-image-attributes-link-rel">'+lang.imageAttributes.rel+'</label></dt>'+ + '<dd><select id="note-image-attributes-link-rel" class="note-image-attributes-link-rel form-control">'+ + '<option value="">'+lang.imageAttributes.relBlank+'</option>'+ + '<option value="alternate">'+lang.imageAttributes.relAlternate+'</option>'+ + '<option value="author">'+lang.imageAttributes.relAuthor+'</option>'+ + '<option value="bookmark">'+lang.imageAttributes.relBookmark+'</option>'+ + '<option value="help">'+lang.imageAttributes.relHelp+'</option>'+ + '<option value="license">'+lang.imageAttributes.relLicense+'</option>'+ + '<option value="next">'+lang.imageAttributes.relNext+'</option>'+ + '<option value="nofollow">'+lang.imageAttributes.relNofollow+'</option>'+ + '<option value="noreferrer">'+lang.imageAttributes.relNoreferrer+'</option>'+ + '<option value="prefetch">'+lang.imageAttributes.relPrefetch+'</option>'+ + '<option value="prev">'+lang.imageAttributes.relPrev+'</option>'+ + '<option value="search">'+lang.imageAttributes.relSearch+'</option>'+ + '<option value="tag">'+lang.imageAttributes.relTag+'</option>'+ + '</select></dd>'+ + '<dt><label for="note-image-attributes-link-role">'+lang.imageAttributes.linkRole+'</label></dt>'+ + '<dd><input type="text" id="note-image-attributes-link-role" class="note-image-attributes-link-role form-control"></dd>'; + } + body += '</dl>'; + }else{ + var body='<div class="form-group">'; + if (options.displayFields.imageBasic) { + body += '<label for="note-image-attributes-title" class="control-label col-xs-2">'+lang.imageAttributes.title+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-title" class="note-image-attributes-title form-control">'+ + '</div>'+ + '</div>'+ + '<div class="form-group">'+ + '<label for="note-image-attributes-src" class="control-label col-xs-2">'+lang.imageAttributes.src+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-src" class="note-image-attributes-src form-control">'+ + '</div>'+ + '</div>'+ + '<div class="form-group note-group-select-from-files">'+ + '<label class="control-label col-xs-2"></label>'+ + '<div class="input-group col-xs-10">'+ + '<input class="note-image-input form-control" type="file" name="file" accept="image/*" />'+imageLimitation+ + '<small class="help-block">'+lang.imageAttributes.srcHelp+'</small>'+ + '</div>'+ + '</div>'+ + '<div class="form-group">'+ + '<label for="note-image-attributes-alt" class="control-label col-xs-2">'+lang.imageAttributes.alt+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-alt" class="note-image-attributes-alt form-control">'+ + '</div>'+ + '</div>'; + } + if (options.displayFields.imageExtra) { + body += '<div class="form-group">'+ + '<label for="note-image-attributes-class" class="control-label col-xs-2">'+lang.imageAttributes.class+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-class" class="note-image-attributes-class form-control">'+ + '</div>'+ + '</div>'+ + '<div class="form-group">'+ + '<label for="note-image-attributes-style" class="control-label col-xs-2">'+lang.imageAttributes.style+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-style" class="note-image-attributes-style form-control">'+ + '</div>'+ + '</div>'+ + '<div class="form-group">'+ + '<label for="note-image-attributes-role" class="control-label col-xs-2">'+lang.imageAttributes.role+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-role" class="note-image-attributes-role form-control">'+ + '</div>'+ + '</div>'; + } + if (options.displayFields.linkBasic || options.displayFields.linkExtra) { + body += '<h4>'+lang.imageAttributes.pluginLinkTitle+'</h4>'+ + '<hr>'; + } + if (options.displayFields.linkBasic) { + body += '<div class="form-group">'+ + '<label for="note-image-attributes-link-href" class="control-label col-xs-2">'+lang.imageAttributes.href+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-link-href" class="note-image-attributes-href form-control">'+ + '</div>'+ + '</div>'+ + '<div class="form-group">'+ + '<label for="note-image-attributes-link-target" class="control-label col-xs-2">'+lang.imageAttributes.target+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<select id="note-image-attributes-link-target" class="note-image-attributes-target form-control">'+ + '<option value="_self">Self</option>'+ + '<option value="_blank">Blank</option>'+ + '<option value="_top">Top</option>'+ + '<option value="_parent">Parent</option>'+ + '</select>'+ + '</div>'+ + '</div>'; + } + if (options.displayFields.linkExtra) { + body += '<div class="form-group">'+ + '<label for="note-image-attributes-link-class" class="control-label col-xs-2">'+lang.imageAttributes.linkClass+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-link-class" class="note-image-attributes-link-class form-control">'+ + '</div>'+ + '</div>'+ + '<div class="form-group">'+ + '<label for="note-image-attributes-link-rel" class="control-label col-xs-2">'+lang.imageAttributes.rel+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<select id="note-image-attributes-link-rel" class="note-image-attributes-link-rel form-control">'+ + '<option value="">'+lang.imageAttributes.relBlank+'</option>'+ + '<option value="alternate">'+lang.imageAttributes.relAlternate+'</option>'+ + '<option value="author">'+lang.imageAttributes.relAuthor+'</option>'+ + '<option value="bookmark">'+lang.imageAttributes.relBookmark+'</option>'+ + '<option value="help">'+lang.imageAttributes.relHelp+'</option>'+ + '<option value="license">'+lang.imageAttributes.relLicense+'</option>'+ + '<option value="next">'+lang.imageAttributes.relNext+'</option>'+ + '<option value="nofollow">'+lang.imageAttributes.relNofollow+'</option>'+ + '<option value="noreferrer">'+lang.imageAttributes.relNoreferrer+'</option>'+ + '<option value="prefetch">'+lang.imageAttributes.relPrefetch+'</option>'+ + '<option value="prev">'+lang.imageAttributes.relPrev+'</option>'+ + '<option value="search">'+lang.imageAttributes.relSearch+'</option>'+ + '<option value="tag">'+lang.imageAttributes.relTag+'</option>'+ + '</select>'+ + '</div>'+ + '</div>'+ + '<div class="form-group">'+ + '<label for="note-image-attributes-link-role" class="control-label col-xs-2">'+lang.imageAttributes.linkRole+'</label>'+ + '<div class="input-group col-xs-10">'+ + '<input type="text" id="note-image-attributes-link-role" class="note-image-attributes-link-role form-control">'+ + '</div>'+ + '</div>'; + } + } + this.$dialog=ui.dialog({ + title:lang.imageAttributes.dialogTitle, + body:body, + footer:'<button href="#" class="btn btn-primary note-image-attributes-btn">OK</button>' + }).render().appendTo($container); + }; + this.destroy=function(){ + ui.hideDialog(this.$dialog); + this.$dialog.remove(); + }; + this.bindEnterKey=function($input,$btn){ + $input.on('keypress',function(event){ + if(event.keyCode===13)$btn.trigger('click'); + }); + }; + this.bindLabels=function(){ + self.$dialog.find('.form-control:first').focus().select(); + self.$dialog.find('label').on('click',function(){ + $(this).parent().find('.form-control:first').focus(); + }); + }; + this.show=function(){ + var $img=$($editable.data('target')); + var imgInfo={ + imgDom:$img, + title:$img.attr('title'), + src:$img.attr('src'), + alt:$img.attr('alt'), + role:$img.attr('role'), + class:$img.attr('class'), + style:$img.attr('style'), + imgLink:$($img.context).parent().is("a")?$($img.context).parent():null + }; + this.showLinkDialog(imgInfo) + .then(function(imgInfo){ + ui.hideDialog(self.$dialog); + var $img=imgInfo.imgDom; + if(options.imageAttributes.removeEmpty){ + if(imgInfo.alt)$img.attr('alt',imgInfo.alt);else $img.removeAttr('alt'); + if(imgInfo.title)$img.attr('title',imgInfo.title);else $img.removeAttr('title'); + if(imgInfo.src)$img.attr('src',imgInfo.src);else $img.attr('src', '#'); + if(imgInfo.class)$img.attr('class',imgInfo.class);else $img.removeAttr('class'); + if(imgInfo.style)$img.attr('style',imgInfo.style);else $img.removeAttr('style'); + if(imgInfo.role)$img.attr('role',imgInfo.role);else $img.removeAttr('role'); + }else{ + $img.attr('alt',imgInfo.alt); + $img.attr('title',imgInfo.title); + $img.attr('class',imgInfo.class); + $img.attr('style',imgInfo.style); + $img.attr('role',imgInfo.role); + } + if($img.parent().is("a"))$img.unwrap(); + var hrefRegex=new RegExp(/(http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi); + if(imgInfo.href.match(hrefRegex)){ + var lnktxt='<a'; + if(imgInfo.linkClass)lnktxt+=' class="'+imgInfo.linkClass+'"'; + lnktxt+=' href="'+imgInfo.href+'" target="'+imgInfo.target+'"'; + if(imgInfo.linkRel)lnktxt+=' rel="'+imgInfo.linkRel+'"'; + if(imgInfo.linkRole)lnktxt+=' role="'+imgInfo.linkRole+'"'; + lnktxt+='></a>'; + $img.wrap(lnktxt); + } + $note.val(context.invoke('code')); + $note.change(); + }); + }; + this.showLinkDialog=function(imgInfo){ + return $.Deferred(function(deferred){ + var $imageTitle=self.$dialog.find('.note-image-attributes-title'), + $imageInput=self.$dialog.find('.note-image-input'), + $imageSrc=self.$dialog.find('.note-image-attributes-src'), + $imageAlt=self.$dialog.find('.note-image-attributes-alt'), + $imageClass=self.$dialog.find('.note-image-attributes-class'), + $imageStyle=self.$dialog.find('.note-image-attributes-style'), + $imageRole=self.$dialog.find('.note-image-attributes-role'), + $linkHref=self.$dialog.find('.note-image-attributes-href'), + $linkTarget=self.$dialog.find('.note-image-attributes-target'), + $linkClass=self.$dialog.find('.note-image-attributes-link-class'), + $linkRel=self.$dialog.find('.note-image-attributes-link-rel'), + $linkRole=self.$dialog.find('.note-image-attributes-link-role'), + $editBtn=self.$dialog.find('.note-image-attributes-btn'); + if(imgInfo.imgLink){ + $linkHref.val(imgInfo.imgLink.attr('href')); + $linkClass.val(imgInfo.imgLink.attr('class')); + $linkRole.val(imgInfo.imgLink.attr('role')); + $linkTarget.find('option').each(function(){ + if($(this).val()==imgInfo.imgLink.attr('target'))$(this).attr('selected','selected'); + }); + $linkRel.find('option').each(function(){ + if($(this).val()==imgInfo.imgLink.attr('rel'))$(this).attr('selected','selected'); + }); + } + ui.onDialogShown(self.$dialog,function(){ + context.triggerEvent('dialog.shown'); + $imageInput.replaceWith( + $imageInput.clone() + .on('change',function(){ + var callbacks=options.callbacks; + if(callbacks.onImageUpload){ + context.triggerEvent('image.upload',this.files[0]); + }else{ + readFileAsDataURL(this.files[0]).then(function(dataURL){ + $imageSrc.val(dataURL) + }).fail(function(){ + context.triggerEvent('image.upload.error'); + }); + } + }).val('') + ); + $editBtn.click(function(e){ + e.preventDefault(); + deferred.resolve({ + imgDom:imgInfo.imgDom, + title:$imageTitle.val(), + src:$imageSrc.val(), + alt:$imageAlt.val(), + class:$imageClass.val(), + style:$imageStyle.val(), + role:$imageRole.val(), + href:$linkHref.val(), + target:$linkTarget.val(), + linkClass:$linkClass.val(), + linkRel:$linkRel.val(), + linkRole:$linkRole.val() + }); + }); + $imageTitle.val(imgInfo.title).focus; + $imageSrc.val(imgInfo.src) + $imageAlt.val(imgInfo.alt); + $imageClass.val(imgInfo.class); + $imageStyle.val(imgInfo.style); + $imageRole.val(imgInfo.role); + self.bindEnterKey($editBtn); + self.bindLabels(); + }); + ui.onDialogHidden(self.$dialog,function(){ + $editBtn.off('click'); + if(deferred.state()==='pending')deferred.reject(); + }); + ui.showDialog(self.$dialog); + }); + }; + } + }); +})); diff --git a/public/admin/view/javascript/summernote/summernote.css b/public/admin/view/javascript/summernote/summernote.css new file mode 100644 index 0000000..7b23e34 --- /dev/null +++ b/public/admin/view/javascript/summernote/summernote.css @@ -0,0 +1 @@ +@font-face{font-family:"summernote";font-style:normal;font-weight:normal;src:url("font/summernote.eot?ad8d7e2d177d2473aecd9b35d16211fb");src:url("font/summernote.eot?#iefix") format("embedded-opentype"),url("font/summernote.woff?ad8d7e2d177d2473aecd9b35d16211fb") format("woff"),url("font/summernote.ttf?ad8d7e2d177d2473aecd9b35d16211fb") format("truetype")}[class^="note-icon-"]:before,[class*=" note-icon-"]:before{display:inline-block;font:normal normal normal 14px summernote;font-size:inherit;-webkit-font-smoothing:antialiased;text-decoration:inherit;text-rendering:auto;text-transform:none;vertical-align:middle;speak:none;-moz-osx-font-smoothing:grayscale}.note-icon-align-center:before{content:"\f101"}.note-icon-align-indent:before{content:"\f102"}.note-icon-align-justify:before{content:"\f103"}.note-icon-align-left:before{content:"\f104"}.note-icon-align-outdent:before{content:"\f105"}.note-icon-align-right:before{content:"\f106"}.note-icon-align:before{content:"\f107"}.note-icon-arrows-alt:before{content:"\f108"}.note-icon-bold:before{content:"\f109"}.note-icon-caret:before{content:"\f10a"}.note-icon-chain-broken:before{content:"\f10b"}.note-icon-circle:before{content:"\f10c"}.note-icon-close:before{content:"\f10d"}.note-icon-code:before{content:"\f10e"}.note-icon-eraser:before{content:"\f10f"}.note-icon-font:before{content:"\f110"}.note-icon-frame:before{content:"\f111"}.note-icon-italic:before{content:"\f112"}.note-icon-link:before{content:"\f113"}.note-icon-magic:before{content:"\f114"}.note-icon-menu-check:before{content:"\f115"}.note-icon-minus:before{content:"\f116"}.note-icon-orderedlist:before{content:"\f117"}.note-icon-pencil:before{content:"\f118"}.note-icon-picture:before{content:"\f119"}.note-icon-question:before{content:"\f11a"}.note-icon-redo:before{content:"\f11b"}.note-icon-special-character:before{content:"\f11c"}.note-icon-square:before{content:"\f11d"}.note-icon-strikethrough:before{content:"\f11e"}.note-icon-subscript:before{content:"\f11f"}.note-icon-summernote:before{content:"\f120"}.note-icon-superscript:before{content:"\f121"}.note-icon-table:before{content:"\f122"}.note-icon-text-height:before{content:"\f123"}.note-icon-trash:before{content:"\f124"}.note-icon-underline:before{content:"\f125"}.note-icon-undo:before{content:"\f126"}.note-icon-unorderedlist:before{content:"\f127"}.note-icon-video:before{content:"\f128"}.note-editor{position:relative}.note-editor .note-dropzone{position:absolute;z-index:100;display:none;color:#87cefa;background-color:white;opacity:.95}.note-editor .note-dropzone .note-dropzone-message{display:table-cell;font-size:28px;font-weight:bold;text-align:center;vertical-align:middle}.note-editor .note-dropzone.hover{color:#098ddf}.note-editor.dragover .note-dropzone{display:table}.note-editor .note-editing-area{position:relative}.note-editor .note-editing-area .note-editable{outline:0}.note-editor .note-editing-area .note-editable sup{vertical-align:super}.note-editor .note-editing-area .note-editable sub{vertical-align:sub}.note-editor.note-frame{border:1px solid #a9a9a9}.note-editor.note-frame.codeview .note-editing-area .note-editable{display:none}.note-editor.note-frame.codeview .note-editing-area .note-codable{display:block}.note-editor.note-frame .note-editing-area{overflow:hidden}.note-editor.note-frame .note-editing-area .note-editable{padding:10px;overflow:auto;color:#000;background-color:#fff}.note-editor.note-frame .note-editing-area .note-editable[contenteditable="false"]{background-color:#e5e5e5}.note-editor.note-frame .note-editing-area .note-codable{display:none;width:100%;padding:10px;margin-bottom:0;font-family:Menlo,Monaco,monospace,sans-serif;font-size:14px;color:#ccc;background-color:#222;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;box-shadow:none;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;-ms-box-sizing:border-box;box-sizing:border-box;resize:none}.note-editor.note-frame.fullscreen{position:fixed;top:0;left:0;z-index:1050;width:100%!important}.note-editor.note-frame.fullscreen .note-editable{background-color:white}.note-editor.note-frame.fullscreen .note-resizebar{display:none}.note-editor.note-frame .note-statusbar{background-color:#f5f5f5;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.note-editor.note-frame .note-statusbar .note-resizebar{width:100%;height:8px;padding-top:1px;cursor:ns-resize}.note-editor.note-frame .note-statusbar .note-resizebar .note-icon-bar{width:20px;margin:1px auto;border-top:1px solid #a9a9a9}.note-editor.note-frame .note-placeholder{padding:10px}.note-popover.popover{max-width:none}.note-popover.popover .popover-content a{display:inline-block;max-width:200px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;vertical-align:middle}.note-popover.popover .arrow{left:20px!important}.note-popover .popover-content,.panel-heading.note-toolbar{padding:0 0 5px 5px;margin:0}.note-popover .popover-content>.btn-group,.panel-heading.note-toolbar>.btn-group{margin-top:5px;margin-right:5px;margin-left:0}.note-popover .popover-content .btn-group .note-table,.panel-heading.note-toolbar .btn-group .note-table{min-width:0;padding:5px}.note-popover .popover-content .btn-group .note-table .note-dimension-picker,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker{font-size:18px}.note-popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-mousecatcher,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-mousecatcher{position:absolute!important;z-index:3;width:10em;height:10em;cursor:pointer}.note-popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-unhighlighted,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-unhighlighted{position:relative!important;z-index:1;width:5em;height:5em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIj4+Pjp6ekKlAqjAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKhmnaJzPAAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-popover .popover-content .btn-group .note-table .note-dimension-picker .note-dimension-picker-highlighted,.panel-heading.note-toolbar .btn-group .note-table .note-dimension-picker .note-dimension-picker-highlighted{position:absolute!important;z-index:2;width:1em;height:1em;background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASAgMAAAAroGbEAAAACVBMVEUAAIjd6vvD2f9LKLW+AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfYAR0BKwNDEVT0AAAAG0lEQVQI12NgAAOtVatWMTCohoaGUY+EmIkEAEruEzK2J7tvAAAAAElFTkSuQmCC') repeat}.note-popover .popover-content .note-style h1,.panel-heading.note-toolbar .note-style h1,.note-popover .popover-content .note-style h2,.panel-heading.note-toolbar .note-style h2,.note-popover .popover-content .note-style h3,.panel-heading.note-toolbar .note-style h3,.note-popover .popover-content .note-style h4,.panel-heading.note-toolbar .note-style h4,.note-popover .popover-content .note-style h5,.panel-heading.note-toolbar .note-style h5,.note-popover .popover-content .note-style h6,.panel-heading.note-toolbar .note-style h6,.note-popover .popover-content .note-style blockquote,.panel-heading.note-toolbar .note-style blockquote{margin:0}.note-popover .popover-content .note-color .dropdown-toggle,.panel-heading.note-toolbar .note-color .dropdown-toggle{width:20px;padding-left:5px}.note-popover .popover-content .note-color .dropdown-menu,.panel-heading.note-toolbar .note-color .dropdown-menu{min-width:340px}.note-popover .popover-content .note-color .dropdown-menu .btn-group,.panel-heading.note-toolbar .note-color .dropdown-menu .btn-group{margin:0}.note-popover .popover-content .note-color .dropdown-menu .btn-group:first-child,.panel-heading.note-toolbar .note-color .dropdown-menu .btn-group:first-child{margin:0 5px}.note-popover .popover-content .note-color .dropdown-menu .btn-group .note-palette-title,.panel-heading.note-toolbar .note-color .dropdown-menu .btn-group .note-palette-title{margin:2px 7px;font-size:12px;text-align:center;border-bottom:1px solid #eee}.note-popover .popover-content .note-color .dropdown-menu .btn-group .note-color-reset,.panel-heading.note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset{width:100%;padding:0 3px;margin:3px;font-size:11px;cursor:pointer;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.note-popover .popover-content .note-color .dropdown-menu .btn-group .note-color-row,.panel-heading.note-toolbar .note-color .dropdown-menu .btn-group .note-color-row{height:20px}.note-popover .popover-content .note-color .dropdown-menu .btn-group .note-color-reset:hover,.panel-heading.note-toolbar .note-color .dropdown-menu .btn-group .note-color-reset:hover{background:#eee}.note-popover .popover-content .note-para .dropdown-menu,.panel-heading.note-toolbar .note-para .dropdown-menu{min-width:216px;padding:5px}.note-popover .popover-content .note-para .dropdown-menu>div:first-child,.panel-heading.note-toolbar .note-para .dropdown-menu>div:first-child{margin-right:5px}.note-popover .popover-content .dropdown-menu,.panel-heading.note-toolbar .dropdown-menu{min-width:90px}.note-popover .popover-content .dropdown-menu.right,.panel-heading.note-toolbar .dropdown-menu.right{right:0;left:auto}.note-popover .popover-content .dropdown-menu.right::before,.panel-heading.note-toolbar .dropdown-menu.right::before{right:9px;left:auto!important}.note-popover .popover-content .dropdown-menu.right::after,.panel-heading.note-toolbar .dropdown-menu.right::after{right:10px;left:auto!important}.note-popover .popover-content .dropdown-menu.note-check li a i,.panel-heading.note-toolbar .dropdown-menu.note-check li a i{color:deepskyblue;visibility:hidden}.note-popover .popover-content .dropdown-menu.note-check li a.checked i,.panel-heading.note-toolbar .dropdown-menu.note-check li a.checked i{visibility:visible}.note-popover .popover-content .note-fontsize-10,.panel-heading.note-toolbar .note-fontsize-10{font-size:10px}.note-popover .popover-content .note-color-palette,.panel-heading.note-toolbar .note-color-palette{line-height:1}.note-popover .popover-content .note-color-palette div .note-color-btn,.panel-heading.note-toolbar .note-color-palette div .note-color-btn{width:20px;height:20px;padding:0;margin:0;border:1px solid #fff}.note-popover .popover-content .note-color-palette div .note-color-btn:hover,.panel-heading.note-toolbar .note-color-palette div .note-color-btn:hover{border:1px solid #000}.note-dialog>div{display:none}.note-dialog .form-group{margin-right:0;margin-left:0}.note-dialog .note-modal-form{margin:0}.note-dialog .note-image-dialog .note-dropzone{min-height:100px;margin-bottom:10px;font-size:30px;line-height:4;color:lightgray;text-align:center;border:4px dashed lightgray}@-moz-document url-prefix(){.note-image-input{height:auto}}.note-placeholder{position:absolute;display:none;color:gray}.note-handle .note-control-selection{position:absolute;display:none;border:1px solid black}.note-handle .note-control-selection>div{position:absolute}.note-handle .note-control-selection .note-control-selection-bg{width:100%;height:100%;background-color:black;-webkit-opacity:.3;-khtml-opacity:.3;-moz-opacity:.3;opacity:.3;-ms-filter:alpha(opacity=30);filter:alpha(opacity=30)}.note-handle .note-control-selection .note-control-handle{width:7px;height:7px;border:1px solid black}.note-handle .note-control-selection .note-control-holder{width:7px;height:7px;border:1px solid black}.note-handle .note-control-selection .note-control-sizing{width:7px;height:7px;background-color:white;border:1px solid black}.note-handle .note-control-selection .note-control-nw{top:-5px;left:-5px;border-right:0;border-bottom:0}.note-handle .note-control-selection .note-control-ne{top:-5px;right:-5px;border-bottom:0;border-left:none}.note-handle .note-control-selection .note-control-sw{bottom:-5px;left:-5px;border-top:0;border-right:0}.note-handle .note-control-selection .note-control-se{right:-5px;bottom:-5px;cursor:se-resize}.note-handle .note-control-selection .note-control-se.note-control-holder{cursor:default;border-top:0;border-left:none}.note-handle .note-control-selection .note-control-selection-info{right:0;bottom:0;padding:5px;margin:5px;font-size:12px;color:white;background-color:black;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;-webkit-opacity:.7;-khtml-opacity:.7;-moz-opacity:.7;opacity:.7;-ms-filter:alpha(opacity=70);filter:alpha(opacity=70)}.note-hint-popover{min-width:100px;padding:2px}.note-hint-popover .popover-content{max-height:150px;padding:3px;overflow:auto}.note-hint-popover .popover-content .note-hint-group .note-hint-item{display:block!important;padding:3px}.note-hint-popover .popover-content .note-hint-group .note-hint-item.active,.note-hint-popover .popover-content .note-hint-group .note-hint-item:hover{display:block;clear:both;font-weight:400;line-height:1.4;color:white;text-decoration:none;white-space:nowrap;cursor:pointer;background-color:#428bca;outline:0}
\ No newline at end of file diff --git a/public/admin/view/javascript/summernote/summernote.js b/public/admin/view/javascript/summernote/summernote.js new file mode 100644 index 0000000..a7cb3a7 --- /dev/null +++ b/public/admin/view/javascript/summernote/summernote.js @@ -0,0 +1,7046 @@ +/** + * Super simple wysiwyg editor v0.8.2 + * http://summernote.org/ + * + * summernote.js + * Copyright 2013-2016 Alan Hong. and other contributors + * summernote may be freely distributed under the MIT license./ + * + * Date: 2016-08-07T05:11Z + */ +(function (factory) { + /* global define */ + if (typeof define === 'function' && define.amd) { + // AMD. Register as an anonymous module. + define(['jquery'], factory); + } else if (typeof module === 'object' && module.exports) { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(window.jQuery); + } +}(function ($) { + 'use strict'; + + /** + * @class core.func + * + * func utils (for high-order func's arg) + * + * @singleton + * @alternateClassName func + */ + var func = (function () { + var eq = function (itemA) { + return function (itemB) { + return itemA === itemB; + }; + }; + + var eq2 = function (itemA, itemB) { + return itemA === itemB; + }; + + var peq2 = function (propName) { + return function (itemA, itemB) { + return itemA[propName] === itemB[propName]; + }; + }; + + var ok = function () { + return true; + }; + + var fail = function () { + return false; + }; + + var not = function (f) { + return function () { + return !f.apply(f, arguments); + }; + }; + + var and = function (fA, fB) { + return function (item) { + return fA(item) && fB(item); + }; + }; + + var self = function (a) { + return a; + }; + + var invoke = function (obj, method) { + return function () { + return obj[method].apply(obj, arguments); + }; + }; + + var idCounter = 0; + + /** + * generate a globally-unique id + * + * @param {String} [prefix] + */ + var uniqueId = function (prefix) { + var id = ++idCounter + ''; + return prefix ? prefix + id : id; + }; + + /** + * returns bnd (bounds) from rect + * + * - IE Compatibility Issue: http://goo.gl/sRLOAo + * - Scroll Issue: http://goo.gl/sNjUc + * + * @param {Rect} rect + * @return {Object} bounds + * @return {Number} bounds.top + * @return {Number} bounds.left + * @return {Number} bounds.width + * @return {Number} bounds.height + */ + var rect2bnd = function (rect) { + var $document = $(document); + return { + top: rect.top + $document.scrollTop(), + left: rect.left + $document.scrollLeft(), + width: rect.right - rect.left, + height: rect.bottom - rect.top + }; + }; + + /** + * returns a copy of the object where the keys have become the values and the values the keys. + * @param {Object} obj + * @return {Object} + */ + var invertObject = function (obj) { + var inverted = {}; + for (var key in obj) { + if (obj.hasOwnProperty(key)) { + inverted[obj[key]] = key; + } + } + return inverted; + }; + + /** + * @param {String} namespace + * @param {String} [prefix] + * @return {String} + */ + var namespaceToCamel = function (namespace, prefix) { + prefix = prefix || ''; + return prefix + namespace.split('.').map(function (name) { + return name.substring(0, 1).toUpperCase() + name.substring(1); + }).join(''); + }; + + /** + * Returns a function, that, as long as it continues to be invoked, will not + * be triggered. The function will be called after it stops being called for + * N milliseconds. If `immediate` is passed, trigger the function on the + * leading edge, instead of the trailing. + * @param {Function} func + * @param {Number} wait + * @param {Boolean} immediate + * @return {Function} + */ + var debounce = function (func, wait, immediate) { + var timeout; + return function () { + var context = this, args = arguments; + var later = function () { + timeout = null; + if (!immediate) { + func.apply(context, args); + } + }; + var callNow = immediate && !timeout; + clearTimeout(timeout); + timeout = setTimeout(later, wait); + if (callNow) { + func.apply(context, args); + } + }; + }; + + return { + eq: eq, + eq2: eq2, + peq2: peq2, + ok: ok, + fail: fail, + self: self, + not: not, + and: and, + invoke: invoke, + uniqueId: uniqueId, + rect2bnd: rect2bnd, + invertObject: invertObject, + namespaceToCamel: namespaceToCamel, + debounce: debounce + }; + })(); + + /** + * @class core.list + * + * list utils + * + * @singleton + * @alternateClassName list + */ + var list = (function () { + /** + * returns the first item of an array. + * + * @param {Array} array + */ + var head = function (array) { + return array[0]; + }; + + /** + * returns the last item of an array. + * + * @param {Array} array + */ + var last = function (array) { + return array[array.length - 1]; + }; + + /** + * returns everything but the last entry of the array. + * + * @param {Array} array + */ + var initial = function (array) { + return array.slice(0, array.length - 1); + }; + + /** + * returns the rest of the items in an array. + * + * @param {Array} array + */ + var tail = function (array) { + return array.slice(1); + }; + + /** + * returns item of array + */ + var find = function (array, pred) { + for (var idx = 0, len = array.length; idx < len; idx ++) { + var item = array[idx]; + if (pred(item)) { + return item; + } + } + }; + + /** + * returns true if all of the values in the array pass the predicate truth test. + */ + var all = function (array, pred) { + for (var idx = 0, len = array.length; idx < len; idx ++) { + if (!pred(array[idx])) { + return false; + } + } + return true; + }; + + /** + * returns index of item + */ + var indexOf = function (array, item) { + return $.inArray(item, array); + }; + + /** + * returns true if the value is present in the list. + */ + var contains = function (array, item) { + return indexOf(array, item) !== -1; + }; + + /** + * get sum from a list + * + * @param {Array} array - array + * @param {Function} fn - iterator + */ + var sum = function (array, fn) { + fn = fn || func.self; + return array.reduce(function (memo, v) { + return memo + fn(v); + }, 0); + }; + + /** + * returns a copy of the collection with array type. + * @param {Collection} collection - collection eg) node.childNodes, ... + */ + var from = function (collection) { + var result = [], idx = -1, length = collection.length; + while (++idx < length) { + result[idx] = collection[idx]; + } + return result; + }; + + /** + * returns whether list is empty or not + */ + var isEmpty = function (array) { + return !array || !array.length; + }; + + /** + * cluster elements by predicate function. + * + * @param {Array} array - array + * @param {Function} fn - predicate function for cluster rule + * @param {Array[]} + */ + var clusterBy = function (array, fn) { + if (!array.length) { return []; } + var aTail = tail(array); + return aTail.reduce(function (memo, v) { + var aLast = last(memo); + if (fn(last(aLast), v)) { + aLast[aLast.length] = v; + } else { + memo[memo.length] = [v]; + } + return memo; + }, [[head(array)]]); + }; + + /** + * returns a copy of the array with all false values removed + * + * @param {Array} array - array + * @param {Function} fn - predicate function for cluster rule + */ + var compact = function (array) { + var aResult = []; + for (var idx = 0, len = array.length; idx < len; idx ++) { + if (array[idx]) { aResult.push(array[idx]); } + } + return aResult; + }; + + /** + * produces a duplicate-free version of the array + * + * @param {Array} array + */ + var unique = function (array) { + var results = []; + + for (var idx = 0, len = array.length; idx < len; idx ++) { + if (!contains(results, array[idx])) { + results.push(array[idx]); + } + } + + return results; + }; + + /** + * returns next item. + * @param {Array} array + */ + var next = function (array, item) { + var idx = indexOf(array, item); + if (idx === -1) { return null; } + + return array[idx + 1]; + }; + + /** + * returns prev item. + * @param {Array} array + */ + var prev = function (array, item) { + var idx = indexOf(array, item); + if (idx === -1) { return null; } + + return array[idx - 1]; + }; + + return { head: head, last: last, initial: initial, tail: tail, + prev: prev, next: next, find: find, contains: contains, + all: all, sum: sum, from: from, isEmpty: isEmpty, + clusterBy: clusterBy, compact: compact, unique: unique }; + })(); + + var isSupportAmd = typeof define === 'function' && define.amd; + + /** + * returns whether font is installed or not. + * + * @param {String} fontName + * @return {Boolean} + */ + var isFontInstalled = function (fontName) { + var testFontName = fontName === 'Comic Sans MS' ? 'Courier New' : 'Comic Sans MS'; + var $tester = $('<div>').css({ + position: 'absolute', + left: '-9999px', + top: '-9999px', + fontSize: '200px' + }).text('mmmmmmmmmwwwwwww').appendTo(document.body); + + var originalWidth = $tester.css('fontFamily', testFontName).width(); + var width = $tester.css('fontFamily', fontName + ',' + testFontName).width(); + + $tester.remove(); + + return originalWidth !== width; + }; + + var userAgent = navigator.userAgent; + var isMSIE = /MSIE|Trident/i.test(userAgent); + var browserVersion; + if (isMSIE) { + var matches = /MSIE (\d+[.]\d+)/.exec(userAgent); + if (matches) { + browserVersion = parseFloat(matches[1]); + } + matches = /Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(userAgent); + if (matches) { + browserVersion = parseFloat(matches[1]); + } + } + + var isEdge = /Edge\/\d+/.test(userAgent); + + var hasCodeMirror = !!window.CodeMirror; + if (!hasCodeMirror && isSupportAmd && typeof require !== 'undefined') { + if (typeof require.resolve !== 'undefined') { + try { + // If CodeMirror can't be resolved, `require.resolve` will throw an + // exception and `hasCodeMirror` won't be set to `true`. + require.resolve('codemirror'); + hasCodeMirror = true; + } catch (e) { + // Do nothing. + } + } else if (typeof eval('require').specified !== 'undefined') { + hasCodeMirror = eval('require').specified('codemirror'); + } + } + + /** + * @class core.agent + * + * Object which check platform and agent + * + * @singleton + * @alternateClassName agent + */ + var agent = { + isMac: navigator.appVersion.indexOf('Mac') > -1, + isMSIE: isMSIE, + isEdge: isEdge, + isFF: !isEdge && /firefox/i.test(userAgent), + isPhantom: /PhantomJS/i.test(userAgent), + isWebkit: !isEdge && /webkit/i.test(userAgent), + isChrome: !isEdge && /chrome/i.test(userAgent), + isSafari: !isEdge && /safari/i.test(userAgent), + browserVersion: browserVersion, + jqueryVersion: parseFloat($.fn.jquery), + isSupportAmd: isSupportAmd, + hasCodeMirror: hasCodeMirror, + isFontInstalled: isFontInstalled, + isW3CRangeSupport: !!document.createRange + }; + + + var NBSP_CHAR = String.fromCharCode(160); + var ZERO_WIDTH_NBSP_CHAR = '\ufeff'; + + /** + * @class core.dom + * + * Dom functions + * + * @singleton + * @alternateClassName dom + */ + var dom = (function () { + /** + * @method isEditable + * + * returns whether node is `note-editable` or not. + * + * @param {Node} node + * @return {Boolean} + */ + var isEditable = function (node) { + return node && $(node).hasClass('note-editable'); + }; + + /** + * @method isControlSizing + * + * returns whether node is `note-control-sizing` or not. + * + * @param {Node} node + * @return {Boolean} + */ + var isControlSizing = function (node) { + return node && $(node).hasClass('note-control-sizing'); + }; + + /** + * @method makePredByNodeName + * + * returns predicate which judge whether nodeName is same + * + * @param {String} nodeName + * @return {Function} + */ + var makePredByNodeName = function (nodeName) { + nodeName = nodeName.toUpperCase(); + return function (node) { + return node && node.nodeName.toUpperCase() === nodeName; + }; + }; + + /** + * @method isText + * + * + * + * @param {Node} node + * @return {Boolean} true if node's type is text(3) + */ + var isText = function (node) { + return node && node.nodeType === 3; + }; + + /** + * @method isElement + * + * + * + * @param {Node} node + * @return {Boolean} true if node's type is element(1) + */ + var isElement = function (node) { + return node && node.nodeType === 1; + }; + + /** + * ex) br, col, embed, hr, img, input, ... + * @see http://www.w3.org/html/wg/drafts/html/master/syntax.html#void-elements + */ + var isVoid = function (node) { + return node && /^BR|^IMG|^HR|^IFRAME|^BUTTON/.test(node.nodeName.toUpperCase()); + }; + + var isPara = function (node) { + if (isEditable(node)) { + return false; + } + + // Chrome(v31.0), FF(v25.0.1) use DIV for paragraph + return node && /^DIV|^P|^LI|^H[1-7]/.test(node.nodeName.toUpperCase()); + }; + + var isHeading = function (node) { + return node && /^H[1-7]/.test(node.nodeName.toUpperCase()); + }; + + var isPre = makePredByNodeName('PRE'); + + var isLi = makePredByNodeName('LI'); + + var isPurePara = function (node) { + return isPara(node) && !isLi(node); + }; + + var isTable = makePredByNodeName('TABLE'); + + var isData = makePredByNodeName('DATA'); + + var isInline = function (node) { + return !isBodyContainer(node) && + !isList(node) && + !isHr(node) && + !isPara(node) && + !isTable(node) && + !isBlockquote(node) && + !isData(node); + }; + + var isList = function (node) { + return node && /^UL|^OL/.test(node.nodeName.toUpperCase()); + }; + + var isHr = makePredByNodeName('HR'); + + var isCell = function (node) { + return node && /^TD|^TH/.test(node.nodeName.toUpperCase()); + }; + + var isBlockquote = makePredByNodeName('BLOCKQUOTE'); + + var isBodyContainer = function (node) { + return isCell(node) || isBlockquote(node) || isEditable(node); + }; + + var isAnchor = makePredByNodeName('A'); + + var isParaInline = function (node) { + return isInline(node) && !!ancestor(node, isPara); + }; + + var isBodyInline = function (node) { + return isInline(node) && !ancestor(node, isPara); + }; + + var isBody = makePredByNodeName('BODY'); + + /** + * returns whether nodeB is closest sibling of nodeA + * + * @param {Node} nodeA + * @param {Node} nodeB + * @return {Boolean} + */ + var isClosestSibling = function (nodeA, nodeB) { + return nodeA.nextSibling === nodeB || + nodeA.previousSibling === nodeB; + }; + + /** + * returns array of closest siblings with node + * + * @param {Node} node + * @param {function} [pred] - predicate function + * @return {Node[]} + */ + var withClosestSiblings = function (node, pred) { + pred = pred || func.ok; + + var siblings = []; + if (node.previousSibling && pred(node.previousSibling)) { + siblings.push(node.previousSibling); + } + siblings.push(node); + if (node.nextSibling && pred(node.nextSibling)) { + siblings.push(node.nextSibling); + } + return siblings; + }; + + /** + * blank HTML for cursor position + * - [workaround] old IE only works with + * - [workaround] IE11 and other browser works with bogus br + */ + var blankHTML = agent.isMSIE && agent.browserVersion < 11 ? ' ' : '<br>'; + + /** + * @method nodeLength + * + * returns #text's text size or element's childNodes size + * + * @param {Node} node + */ + var nodeLength = function (node) { + if (isText(node)) { + return node.nodeValue.length; + } + + if (node) { + return node.childNodes.length; + } + + return 0; + + }; + + /** + * returns whether node is empty or not. + * + * @param {Node} node + * @return {Boolean} + */ + var isEmpty = function (node) { + var len = nodeLength(node); + + if (len === 0) { + return true; + } else if (!isText(node) && len === 1 && node.innerHTML === blankHTML) { + // ex) <p><br></p>, <span><br></span> + return true; + } else if (list.all(node.childNodes, isText) && node.innerHTML === '') { + // ex) <p></p>, <span></span> + return true; + } + + return false; + }; + + /** + * padding blankHTML if node is empty (for cursor position) + */ + var paddingBlankHTML = function (node) { + if (!isVoid(node) && !nodeLength(node)) { + node.innerHTML = blankHTML; + } + }; + + /** + * find nearest ancestor predicate hit + * + * @param {Node} node + * @param {Function} pred - predicate function + */ + var ancestor = function (node, pred) { + while (node) { + if (pred(node)) { return node; } + if (isEditable(node)) { break; } + + node = node.parentNode; + } + return null; + }; + + /** + * find nearest ancestor only single child blood line and predicate hit + * + * @param {Node} node + * @param {Function} pred - predicate function + */ + var singleChildAncestor = function (node, pred) { + node = node.parentNode; + + while (node) { + if (nodeLength(node) !== 1) { break; } + if (pred(node)) { return node; } + if (isEditable(node)) { break; } + + node = node.parentNode; + } + return null; + }; + + /** + * returns new array of ancestor nodes (until predicate hit). + * + * @param {Node} node + * @param {Function} [optional] pred - predicate function + */ + var listAncestor = function (node, pred) { + pred = pred || func.fail; + + var ancestors = []; + ancestor(node, function (el) { + if (!isEditable(el)) { + ancestors.push(el); + } + + return pred(el); + }); + return ancestors; + }; + + /** + * find farthest ancestor predicate hit + */ + var lastAncestor = function (node, pred) { + var ancestors = listAncestor(node); + return list.last(ancestors.filter(pred)); + }; + + /** + * returns common ancestor node between two nodes. + * + * @param {Node} nodeA + * @param {Node} nodeB + */ + var commonAncestor = function (nodeA, nodeB) { + var ancestors = listAncestor(nodeA); + for (var n = nodeB; n; n = n.parentNode) { + if ($.inArray(n, ancestors) > -1) { return n; } + } + return null; // difference document area + }; + + /** + * listing all previous siblings (until predicate hit). + * + * @param {Node} node + * @param {Function} [optional] pred - predicate function + */ + var listPrev = function (node, pred) { + pred = pred || func.fail; + + var nodes = []; + while (node) { + if (pred(node)) { break; } + nodes.push(node); + node = node.previousSibling; + } + return nodes; + }; + + /** + * listing next siblings (until predicate hit). + * + * @param {Node} node + * @param {Function} [pred] - predicate function + */ + var listNext = function (node, pred) { + pred = pred || func.fail; + + var nodes = []; + while (node) { + if (pred(node)) { break; } + nodes.push(node); + node = node.nextSibling; + } + return nodes; + }; + + /** + * listing descendant nodes + * + * @param {Node} node + * @param {Function} [pred] - predicate function + */ + var listDescendant = function (node, pred) { + var descendants = []; + pred = pred || func.ok; + + // start DFS(depth first search) with node + (function fnWalk(current) { + if (node !== current && pred(current)) { + descendants.push(current); + } + for (var idx = 0, len = current.childNodes.length; idx < len; idx++) { + fnWalk(current.childNodes[idx]); + } + })(node); + + return descendants; + }; + + /** + * wrap node with new tag. + * + * @param {Node} node + * @param {Node} tagName of wrapper + * @return {Node} - wrapper + */ + var wrap = function (node, wrapperName) { + var parent = node.parentNode; + var wrapper = $('<' + wrapperName + '>')[0]; + + parent.insertBefore(wrapper, node); + wrapper.appendChild(node); + + return wrapper; + }; + + /** + * insert node after preceding + * + * @param {Node} node + * @param {Node} preceding - predicate function + */ + var insertAfter = function (node, preceding) { + var next = preceding.nextSibling, parent = preceding.parentNode; + if (next) { + parent.insertBefore(node, next); + } else { + parent.appendChild(node); + } + return node; + }; + + /** + * append elements. + * + * @param {Node} node + * @param {Collection} aChild + */ + var appendChildNodes = function (node, aChild) { + $.each(aChild, function (idx, child) { + node.appendChild(child); + }); + return node; + }; + + /** + * returns whether boundaryPoint is left edge or not. + * + * @param {BoundaryPoint} point + * @return {Boolean} + */ + var isLeftEdgePoint = function (point) { + return point.offset === 0; + }; + + /** + * returns whether boundaryPoint is right edge or not. + * + * @param {BoundaryPoint} point + * @return {Boolean} + */ + var isRightEdgePoint = function (point) { + return point.offset === nodeLength(point.node); + }; + + /** + * returns whether boundaryPoint is edge or not. + * + * @param {BoundaryPoint} point + * @return {Boolean} + */ + var isEdgePoint = function (point) { + return isLeftEdgePoint(point) || isRightEdgePoint(point); + }; + + /** + * returns whether node is left edge of ancestor or not. + * + * @param {Node} node + * @param {Node} ancestor + * @return {Boolean} + */ + var isLeftEdgeOf = function (node, ancestor) { + while (node && node !== ancestor) { + if (position(node) !== 0) { + return false; + } + node = node.parentNode; + } + + return true; + }; + + /** + * returns whether node is right edge of ancestor or not. + * + * @param {Node} node + * @param {Node} ancestor + * @return {Boolean} + */ + var isRightEdgeOf = function (node, ancestor) { + if (!ancestor) { + return false; + } + while (node && node !== ancestor) { + if (position(node) !== nodeLength(node.parentNode) - 1) { + return false; + } + node = node.parentNode; + } + + return true; + }; + + /** + * returns whether point is left edge of ancestor or not. + * @param {BoundaryPoint} point + * @param {Node} ancestor + * @return {Boolean} + */ + var isLeftEdgePointOf = function (point, ancestor) { + return isLeftEdgePoint(point) && isLeftEdgeOf(point.node, ancestor); + }; + + /** + * returns whether point is right edge of ancestor or not. + * @param {BoundaryPoint} point + * @param {Node} ancestor + * @return {Boolean} + */ + var isRightEdgePointOf = function (point, ancestor) { + return isRightEdgePoint(point) && isRightEdgeOf(point.node, ancestor); + }; + + /** + * returns offset from parent. + * + * @param {Node} node + */ + var position = function (node) { + var offset = 0; + while ((node = node.previousSibling)) { + offset += 1; + } + return offset; + }; + + var hasChildren = function (node) { + return !!(node && node.childNodes && node.childNodes.length); + }; + + /** + * returns previous boundaryPoint + * + * @param {BoundaryPoint} point + * @param {Boolean} isSkipInnerOffset + * @return {BoundaryPoint} + */ + var prevPoint = function (point, isSkipInnerOffset) { + var node, offset; + + if (point.offset === 0) { + if (isEditable(point.node)) { + return null; + } + + node = point.node.parentNode; + offset = position(point.node); + } else if (hasChildren(point.node)) { + node = point.node.childNodes[point.offset - 1]; + offset = nodeLength(node); + } else { + node = point.node; + offset = isSkipInnerOffset ? 0 : point.offset - 1; + } + + return { + node: node, + offset: offset + }; + }; + + /** + * returns next boundaryPoint + * + * @param {BoundaryPoint} point + * @param {Boolean} isSkipInnerOffset + * @return {BoundaryPoint} + */ + var nextPoint = function (point, isSkipInnerOffset) { + var node, offset; + + if (nodeLength(point.node) === point.offset) { + if (isEditable(point.node)) { + return null; + } + + node = point.node.parentNode; + offset = position(point.node) + 1; + } else if (hasChildren(point.node)) { + node = point.node.childNodes[point.offset]; + offset = 0; + } else { + node = point.node; + offset = isSkipInnerOffset ? nodeLength(point.node) : point.offset + 1; + } + + return { + node: node, + offset: offset + }; + }; + + /** + * returns whether pointA and pointB is same or not. + * + * @param {BoundaryPoint} pointA + * @param {BoundaryPoint} pointB + * @return {Boolean} + */ + var isSamePoint = function (pointA, pointB) { + return pointA.node === pointB.node && pointA.offset === pointB.offset; + }; + + /** + * returns whether point is visible (can set cursor) or not. + * + * @param {BoundaryPoint} point + * @return {Boolean} + */ + var isVisiblePoint = function (point) { + if (isText(point.node) || !hasChildren(point.node) || isEmpty(point.node)) { + return true; + } + + var leftNode = point.node.childNodes[point.offset - 1]; + var rightNode = point.node.childNodes[point.offset]; + if ((!leftNode || isVoid(leftNode)) && (!rightNode || isVoid(rightNode))) { + return true; + } + + return false; + }; + + /** + * @method prevPointUtil + * + * @param {BoundaryPoint} point + * @param {Function} pred + * @return {BoundaryPoint} + */ + var prevPointUntil = function (point, pred) { + while (point) { + if (pred(point)) { + return point; + } + + point = prevPoint(point); + } + + return null; + }; + + /** + * @method nextPointUntil + * + * @param {BoundaryPoint} point + * @param {Function} pred + * @return {BoundaryPoint} + */ + var nextPointUntil = function (point, pred) { + while (point) { + if (pred(point)) { + return point; + } + + point = nextPoint(point); + } + + return null; + }; + + /** + * returns whether point has character or not. + * + * @param {Point} point + * @return {Boolean} + */ + var isCharPoint = function (point) { + if (!isText(point.node)) { + return false; + } + + var ch = point.node.nodeValue.charAt(point.offset - 1); + return ch && (ch !== ' ' && ch !== NBSP_CHAR); + }; + + /** + * @method walkPoint + * + * @param {BoundaryPoint} startPoint + * @param {BoundaryPoint} endPoint + * @param {Function} handler + * @param {Boolean} isSkipInnerOffset + */ + var walkPoint = function (startPoint, endPoint, handler, isSkipInnerOffset) { + var point = startPoint; + + while (point) { + handler(point); + + if (isSamePoint(point, endPoint)) { + break; + } + + var isSkipOffset = isSkipInnerOffset && + startPoint.node !== point.node && + endPoint.node !== point.node; + point = nextPoint(point, isSkipOffset); + } + }; + + /** + * @method makeOffsetPath + * + * return offsetPath(array of offset) from ancestor + * + * @param {Node} ancestor - ancestor node + * @param {Node} node + */ + var makeOffsetPath = function (ancestor, node) { + var ancestors = listAncestor(node, func.eq(ancestor)); + return ancestors.map(position).reverse(); + }; + + /** + * @method fromOffsetPath + * + * return element from offsetPath(array of offset) + * + * @param {Node} ancestor - ancestor node + * @param {array} offsets - offsetPath + */ + var fromOffsetPath = function (ancestor, offsets) { + var current = ancestor; + for (var i = 0, len = offsets.length; i < len; i++) { + if (current.childNodes.length <= offsets[i]) { + current = current.childNodes[current.childNodes.length - 1]; + } else { + current = current.childNodes[offsets[i]]; + } + } + return current; + }; + + /** + * @method splitNode + * + * split element or #text + * + * @param {BoundaryPoint} point + * @param {Object} [options] + * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false + * @param {Boolean} [options.isNotSplitEdgePoint] - default: false + * @return {Node} right node of boundaryPoint + */ + var splitNode = function (point, options) { + var isSkipPaddingBlankHTML = options && options.isSkipPaddingBlankHTML; + var isNotSplitEdgePoint = options && options.isNotSplitEdgePoint; + + // edge case + if (isEdgePoint(point) && (isText(point.node) || isNotSplitEdgePoint)) { + if (isLeftEdgePoint(point)) { + return point.node; + } else if (isRightEdgePoint(point)) { + return point.node.nextSibling; + } + } + + // split #text + if (isText(point.node)) { + return point.node.splitText(point.offset); + } else { + var childNode = point.node.childNodes[point.offset]; + var clone = insertAfter(point.node.cloneNode(false), point.node); + appendChildNodes(clone, listNext(childNode)); + + if (!isSkipPaddingBlankHTML) { + paddingBlankHTML(point.node); + paddingBlankHTML(clone); + } + + return clone; + } + }; + + /** + * @method splitTree + * + * split tree by point + * + * @param {Node} root - split root + * @param {BoundaryPoint} point + * @param {Object} [options] + * @param {Boolean} [options.isSkipPaddingBlankHTML] - default: false + * @param {Boolean} [options.isNotSplitEdgePoint] - default: false + * @return {Node} right node of boundaryPoint + */ + var splitTree = function (root, point, options) { + // ex) [#text, <span>, <p>] + var ancestors = listAncestor(point.node, func.eq(root)); + + if (!ancestors.length) { + return null; + } else if (ancestors.length === 1) { + return splitNode(point, options); + } + + return ancestors.reduce(function (node, parent) { + if (node === point.node) { + node = splitNode(point, options); + } + + return splitNode({ + node: parent, + offset: node ? dom.position(node) : nodeLength(parent) + }, options); + }); + }; + + /** + * split point + * + * @param {Point} point + * @param {Boolean} isInline + * @return {Object} + */ + var splitPoint = function (point, isInline) { + // find splitRoot, container + // - inline: splitRoot is a child of paragraph + // - block: splitRoot is a child of bodyContainer + var pred = isInline ? isPara : isBodyContainer; + var ancestors = listAncestor(point.node, pred); + var topAncestor = list.last(ancestors) || point.node; + + var splitRoot, container; + if (pred(topAncestor)) { + splitRoot = ancestors[ancestors.length - 2]; + container = topAncestor; + } else { + splitRoot = topAncestor; + container = splitRoot.parentNode; + } + + // if splitRoot is exists, split with splitTree + var pivot = splitRoot && splitTree(splitRoot, point, { + isSkipPaddingBlankHTML: isInline, + isNotSplitEdgePoint: isInline + }); + + // if container is point.node, find pivot with point.offset + if (!pivot && container === point.node) { + pivot = point.node.childNodes[point.offset]; + } + + return { + rightNode: pivot, + container: container + }; + }; + + var create = function (nodeName) { + return document.createElement(nodeName); + }; + + var createText = function (text) { + return document.createTextNode(text); + }; + + /** + * @method remove + * + * remove node, (isRemoveChild: remove child or not) + * + * @param {Node} node + * @param {Boolean} isRemoveChild + */ + var remove = function (node, isRemoveChild) { + if (!node || !node.parentNode) { return; } + if (node.removeNode) { return node.removeNode(isRemoveChild); } + + var parent = node.parentNode; + if (!isRemoveChild) { + var nodes = []; + var i, len; + for (i = 0, len = node.childNodes.length; i < len; i++) { + nodes.push(node.childNodes[i]); + } + + for (i = 0, len = nodes.length; i < len; i++) { + parent.insertBefore(nodes[i], node); + } + } + + parent.removeChild(node); + }; + + /** + * @method removeWhile + * + * @param {Node} node + * @param {Function} pred + */ + var removeWhile = function (node, pred) { + while (node) { + if (isEditable(node) || !pred(node)) { + break; + } + + var parent = node.parentNode; + remove(node); + node = parent; + } + }; + + /** + * @method replace + * + * replace node with provided nodeName + * + * @param {Node} node + * @param {String} nodeName + * @return {Node} - new node + */ + var replace = function (node, nodeName) { + if (node.nodeName.toUpperCase() === nodeName.toUpperCase()) { + return node; + } + + var newNode = create(nodeName); + + if (node.style.cssText) { + newNode.style.cssText = node.style.cssText; + } + + appendChildNodes(newNode, list.from(node.childNodes)); + insertAfter(newNode, node); + remove(node); + + return newNode; + }; + + var isTextarea = makePredByNodeName('TEXTAREA'); + + /** + * @param {jQuery} $node + * @param {Boolean} [stripLinebreaks] - default: false + */ + var value = function ($node, stripLinebreaks) { + var val = isTextarea($node[0]) ? $node.val() : $node.html(); + if (stripLinebreaks) { + return val.replace(/[\n\r]/g, ''); + } + return val; + }; + + /** + * @method html + * + * get the HTML contents of node + * + * @param {jQuery} $node + * @param {Boolean} [isNewlineOnBlock] + */ + var html = function ($node, isNewlineOnBlock) { + var markup = value($node); + + if (isNewlineOnBlock) { + var regexTag = /<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g; + markup = markup.replace(regexTag, function (match, endSlash, name) { + name = name.toUpperCase(); + var isEndOfInlineContainer = /^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(name) && + !!endSlash; + var isBlockNode = /^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(name); + + return match + ((isEndOfInlineContainer || isBlockNode) ? '\n' : ''); + }); + markup = $.trim(markup); + } + + return markup; + }; + + var posFromPlaceholder = function (placeholder) { + var $placeholder = $(placeholder); + var pos = $placeholder.offset(); + var height = $placeholder.outerHeight(true); // include margin + + return { + left: pos.left, + top: pos.top + height + }; + }; + + var attachEvents = function ($node, events) { + Object.keys(events).forEach(function (key) { + $node.on(key, events[key]); + }); + }; + + var detachEvents = function ($node, events) { + Object.keys(events).forEach(function (key) { + $node.off(key, events[key]); + }); + }; + + return { + /** @property {String} NBSP_CHAR */ + NBSP_CHAR: NBSP_CHAR, + /** @property {String} ZERO_WIDTH_NBSP_CHAR */ + ZERO_WIDTH_NBSP_CHAR: ZERO_WIDTH_NBSP_CHAR, + /** @property {String} blank */ + blank: blankHTML, + /** @property {String} emptyPara */ + emptyPara: '<p>' + blankHTML + '</p>', + makePredByNodeName: makePredByNodeName, + isEditable: isEditable, + isControlSizing: isControlSizing, + isText: isText, + isElement: isElement, + isVoid: isVoid, + isPara: isPara, + isPurePara: isPurePara, + isHeading: isHeading, + isInline: isInline, + isBlock: func.not(isInline), + isBodyInline: isBodyInline, + isBody: isBody, + isParaInline: isParaInline, + isPre: isPre, + isList: isList, + isTable: isTable, + isData: isData, + isCell: isCell, + isBlockquote: isBlockquote, + isBodyContainer: isBodyContainer, + isAnchor: isAnchor, + isDiv: makePredByNodeName('DIV'), + isLi: isLi, + isBR: makePredByNodeName('BR'), + isSpan: makePredByNodeName('SPAN'), + isB: makePredByNodeName('B'), + isU: makePredByNodeName('U'), + isS: makePredByNodeName('S'), + isI: makePredByNodeName('I'), + isImg: makePredByNodeName('IMG'), + isTextarea: isTextarea, + isEmpty: isEmpty, + isEmptyAnchor: func.and(isAnchor, isEmpty), + isClosestSibling: isClosestSibling, + withClosestSiblings: withClosestSiblings, + nodeLength: nodeLength, + isLeftEdgePoint: isLeftEdgePoint, + isRightEdgePoint: isRightEdgePoint, + isEdgePoint: isEdgePoint, + isLeftEdgeOf: isLeftEdgeOf, + isRightEdgeOf: isRightEdgeOf, + isLeftEdgePointOf: isLeftEdgePointOf, + isRightEdgePointOf: isRightEdgePointOf, + prevPoint: prevPoint, + nextPoint: nextPoint, + isSamePoint: isSamePoint, + isVisiblePoint: isVisiblePoint, + prevPointUntil: prevPointUntil, + nextPointUntil: nextPointUntil, + isCharPoint: isCharPoint, + walkPoint: walkPoint, + ancestor: ancestor, + singleChildAncestor: singleChildAncestor, + listAncestor: listAncestor, + lastAncestor: lastAncestor, + listNext: listNext, + listPrev: listPrev, + listDescendant: listDescendant, + commonAncestor: commonAncestor, + wrap: wrap, + insertAfter: insertAfter, + appendChildNodes: appendChildNodes, + position: position, + hasChildren: hasChildren, + makeOffsetPath: makeOffsetPath, + fromOffsetPath: fromOffsetPath, + splitTree: splitTree, + splitPoint: splitPoint, + create: create, + createText: createText, + remove: remove, + removeWhile: removeWhile, + replace: replace, + html: html, + value: value, + posFromPlaceholder: posFromPlaceholder, + attachEvents: attachEvents, + detachEvents: detachEvents + }; + })(); + + /** + * @param {jQuery} $note + * @param {Object} options + * @return {Context} + */ + var Context = function ($note, options) { + var self = this; + + var ui = $.summernote.ui; + this.memos = {}; + this.modules = {}; + this.layoutInfo = {}; + this.options = options; + + /** + * create layout and initialize modules and other resources + */ + this.initialize = function () { + this.layoutInfo = ui.createLayout($note, options); + this._initialize(); + $note.hide(); + return this; + }; + + /** + * destroy modules and other resources and remove layout + */ + this.destroy = function () { + this._destroy(); + $note.removeData('summernote'); + ui.removeLayout($note, this.layoutInfo); + }; + + /** + * destory modules and other resources and initialize it again + */ + this.reset = function () { + var disabled = self.isDisabled(); + this.code(dom.emptyPara); + this._destroy(); + this._initialize(); + + if (disabled) { + self.disable(); + } + }; + + this._initialize = function () { + // add optional buttons + var buttons = $.extend({}, this.options.buttons); + Object.keys(buttons).forEach(function (key) { + self.memo('button.' + key, buttons[key]); + }); + + var modules = $.extend({}, this.options.modules, $.summernote.plugins || {}); + + // add and initialize modules + Object.keys(modules).forEach(function (key) { + self.module(key, modules[key], true); + }); + + Object.keys(this.modules).forEach(function (key) { + self.initializeModule(key); + }); + }; + + this._destroy = function () { + // destroy modules with reversed order + Object.keys(this.modules).reverse().forEach(function (key) { + self.removeModule(key); + }); + + Object.keys(this.memos).forEach(function (key) { + self.removeMemo(key); + }); + }; + + this.code = function (html) { + var isActivated = this.invoke('codeview.isActivated'); + + if (html === undefined) { + this.invoke('codeview.sync'); + return isActivated ? this.layoutInfo.codable.val() : this.layoutInfo.editable.html(); + } else { + if (isActivated) { + this.layoutInfo.codable.val(html); + } else { + this.layoutInfo.editable.html(html); + } + $note.val(html); + this.triggerEvent('change', html); + } + }; + + this.isDisabled = function () { + return this.layoutInfo.editable.attr('contenteditable') === 'false'; + }; + + this.enable = function () { + this.layoutInfo.editable.attr('contenteditable', true); + this.invoke('toolbar.activate', true); + }; + + this.disable = function () { + // close codeview if codeview is opend + if (this.invoke('codeview.isActivated')) { + this.invoke('codeview.deactivate'); + } + this.layoutInfo.editable.attr('contenteditable', false); + this.invoke('toolbar.deactivate', true); + }; + + this.triggerEvent = function () { + var namespace = list.head(arguments); + var args = list.tail(list.from(arguments)); + + var callback = this.options.callbacks[func.namespaceToCamel(namespace, 'on')]; + if (callback) { + callback.apply($note[0], args); + } + $note.trigger('summernote.' + namespace, args); + }; + + this.initializeModule = function (key) { + var module = this.modules[key]; + module.shouldInitialize = module.shouldInitialize || func.ok; + if (!module.shouldInitialize()) { + return; + } + + // initialize module + if (module.initialize) { + module.initialize(); + } + + // attach events + if (module.events) { + dom.attachEvents($note, module.events); + } + }; + + this.module = function (key, ModuleClass, withoutIntialize) { + if (arguments.length === 1) { + return this.modules[key]; + } + + this.modules[key] = new ModuleClass(this); + + if (!withoutIntialize) { + this.initializeModule(key); + } + }; + + this.removeModule = function (key) { + var module = this.modules[key]; + if (module.shouldInitialize()) { + if (module.events) { + dom.detachEvents($note, module.events); + } + + if (module.destroy) { + module.destroy(); + } + } + + delete this.modules[key]; + }; + + this.memo = function (key, obj) { + if (arguments.length === 1) { + return this.memos[key]; + } + this.memos[key] = obj; + }; + + this.removeMemo = function (key) { + if (this.memos[key] && this.memos[key].destroy) { + this.memos[key].destroy(); + } + + delete this.memos[key]; + }; + + this.createInvokeHandler = function (namespace, value) { + return function (event) { + event.preventDefault(); + self.invoke(namespace, value || $(event.target).closest('[data-value]').data('value')); + }; + }; + + this.invoke = function () { + var namespace = list.head(arguments); + var args = list.tail(list.from(arguments)); + + var splits = namespace.split('.'); + var hasSeparator = splits.length > 1; + var moduleName = hasSeparator && list.head(splits); + var methodName = hasSeparator ? list.last(splits) : list.head(splits); + + var module = this.modules[moduleName || 'editor']; + if (!moduleName && this[methodName]) { + return this[methodName].apply(this, args); + } else if (module && module[methodName] && module.shouldInitialize()) { + return module[methodName].apply(module, args); + } + }; + + return this.initialize(); + }; + + $.fn.extend({ + /** + * Summernote API + * + * @param {Object|String} + * @return {this} + */ + summernote: function () { + var type = $.type(list.head(arguments)); + var isExternalAPICalled = type === 'string'; + var hasInitOptions = type === 'object'; + + var options = hasInitOptions ? list.head(arguments) : {}; + + options = $.extend({}, $.summernote.options, options); + options.langInfo = $.extend(true, {}, $.summernote.lang['en-US'], $.summernote.lang[options.lang]); + options.icons = $.extend(true, {}, $.summernote.options.icons, options.icons); + + this.each(function (idx, note) { + var $note = $(note); + if (!$note.data('summernote')) { + var context = new Context($note, options); + $note.data('summernote', context); + $note.data('summernote').triggerEvent('init', context.layoutInfo); + } + }); + + var $note = this.first(); + if ($note.length) { + var context = $note.data('summernote'); + if (isExternalAPICalled) { + return context.invoke.apply(context, list.from(arguments)); + } else if (options.focus) { + context.invoke('editor.focus'); + } + } + + return this; + } + }); + + + var Renderer = function (markup, children, options, callback) { + this.render = function ($parent) { + var $node = $(markup); + + if (options && options.contents) { + $node.html(options.contents); + } + + if (options && options.className) { + $node.addClass(options.className); + } + + if (options && options.data) { + $.each(options.data, function (k, v) { + $node.attr('data-' + k, v); + }); + } + + if (options && options.click) { + $node.on('click', options.click); + } + + if (children) { + var $container = $node.find('.note-children-container'); + children.forEach(function (child) { + child.render($container.length ? $container : $node); + }); + } + + if (callback) { + callback($node, options); + } + + if (options && options.callback) { + options.callback($node); + } + + if ($parent) { + $parent.append($node); + } + + return $node; + }; + }; + + var renderer = { + create: function (markup, callback) { + return function () { + var children = $.isArray(arguments[0]) ? arguments[0] : []; + var options = typeof arguments[1] === 'object' ? arguments[1] : arguments[0]; + if (options && options.children) { + children = options.children; + } + return new Renderer(markup, children, options, callback); + }; + } + }; + + var editor = renderer.create('<div class="note-editor note-frame panel panel-default"/>'); + var toolbar = renderer.create('<div class="note-toolbar panel-heading"/>'); + var editingArea = renderer.create('<div class="note-editing-area"/>'); + var codable = renderer.create('<textarea class="note-codable"/>'); + var editable = renderer.create('<div class="note-editable panel-body" contentEditable="true"/>'); + var statusbar = renderer.create([ + '<div class="note-statusbar">', + ' <div class="note-resizebar">', + ' <div class="note-icon-bar"/>', + ' <div class="note-icon-bar"/>', + ' <div class="note-icon-bar"/>', + ' </div>', + '</div>' + ].join('')); + + var airEditor = renderer.create('<div class="note-editor"/>'); + var airEditable = renderer.create('<div class="note-editable" contentEditable="true"/>'); + + var buttonGroup = renderer.create('<div class="note-btn-group btn-group">'); + var button = renderer.create('<button type="button" class="note-btn btn btn-default btn-sm" tabindex="-1">', function ($node, options) { + if (options && options.tooltip) { + $node.attr({ + title: options.tooltip + }).tooltip({ + container: 'body', + trigger: 'hover', + placement: 'bottom' + }); + } + }); + + var dropdown = renderer.create('<div class="dropdown-menu">', function ($node, options) { + var markup = $.isArray(options.items) ? options.items.map(function (item) { + var value = (typeof item === 'string') ? item : (item.value || ''); + var content = options.template ? options.template(item) : item; + return '<li><a href="#" data-value="' + value + '">' + content + '</a></li>'; + }).join('') : options.items; + + $node.html(markup); + }); + + var dropdownCheck = renderer.create('<div class="dropdown-menu note-check">', function ($node, options) { + var markup = $.isArray(options.items) ? options.items.map(function (item) { + var value = (typeof item === 'string') ? item : (item.value || ''); + var content = options.template ? options.template(item) : item; + return '<li><a href="#" data-value="' + value + '">' + icon(options.checkClassName) + ' ' + content + '</a></li>'; + }).join('') : options.items; + $node.html(markup); + }); + + var palette = renderer.create('<div class="note-color-palette"/>', function ($node, options) { + var contents = []; + for (var row = 0, rowSize = options.colors.length; row < rowSize; row++) { + var eventName = options.eventName; + var colors = options.colors[row]; + var buttons = []; + for (var col = 0, colSize = colors.length; col < colSize; col++) { + var color = colors[col]; + buttons.push([ + '<button type="button" class="note-color-btn"', + 'style="background-color:', color, '" ', + 'data-event="', eventName, '" ', + 'data-value="', color, '" ', + 'title="', color, '" ', + 'data-toggle="button" tabindex="-1"></button>' + ].join('')); + } + contents.push('<div class="note-color-row">' + buttons.join('') + '</div>'); + } + $node.html(contents.join('')); + + $node.find('.note-color-btn').tooltip({ + container: 'body', + trigger: 'hover', + placement: 'bottom' + }); + }); + + var dialog = renderer.create('<div class="modal" aria-hidden="false" tabindex="-1"/>', function ($node, options) { + if (options.fade) { + $node.addClass('fade'); + } + $node.html([ + '<div class="modal-dialog">', + ' <div class="modal-content">', + (options.title ? + ' <div class="modal-header">' + + ' <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>' + + ' <h4 class="modal-title">' + options.title + '</h4>' + + ' </div>' : '' + ), + ' <div class="modal-body">' + options.body + '</div>', + (options.footer ? + ' <div class="modal-footer">' + options.footer + '</div>' : '' + ), + ' </div>', + '</div>' + ].join('')); + }); + + var popover = renderer.create([ + '<div class="note-popover popover in">', + ' <div class="arrow"/>', + ' <div class="popover-content note-children-container"/>', + '</div>' + ].join(''), function ($node, options) { + var direction = typeof options.direction !== 'undefined' ? options.direction : 'bottom'; + + $node.addClass(direction); + + if (options.hideArrow) { + $node.find('.arrow').hide(); + } + }); + + var icon = function (iconClassName, tagName) { + tagName = tagName || 'i'; + return '<' + tagName + ' class="' + iconClassName + '"/>'; + }; + + var ui = { + editor: editor, + toolbar: toolbar, + editingArea: editingArea, + codable: codable, + editable: editable, + statusbar: statusbar, + airEditor: airEditor, + airEditable: airEditable, + buttonGroup: buttonGroup, + button: button, + dropdown: dropdown, + dropdownCheck: dropdownCheck, + palette: palette, + dialog: dialog, + popover: popover, + icon: icon, + + toggleBtn: function ($btn, isEnable) { + $btn.toggleClass('disabled', !isEnable); + $btn.attr('disabled', !isEnable); + }, + + toggleBtnActive: function ($btn, isActive) { + $btn.toggleClass('active', isActive); + }, + + onDialogShown: function ($dialog, handler) { + $dialog.one('shown.bs.modal', handler); + }, + + onDialogHidden: function ($dialog, handler) { + $dialog.one('hidden.bs.modal', handler); + }, + + showDialog: function ($dialog) { + $dialog.modal('show'); + }, + + hideDialog: function ($dialog) { + $dialog.modal('hide'); + }, + + createLayout: function ($note, options) { + var $editor = (options.airMode ? ui.airEditor([ + ui.editingArea([ + ui.airEditable() + ]) + ]) : ui.editor([ + ui.toolbar(), + ui.editingArea([ + ui.codable(), + ui.editable() + ]), + ui.statusbar() + ])).render(); + + $editor.insertAfter($note); + + return { + note: $note, + editor: $editor, + toolbar: $editor.find('.note-toolbar'), + editingArea: $editor.find('.note-editing-area'), + editable: $editor.find('.note-editable'), + codable: $editor.find('.note-codable'), + statusbar: $editor.find('.note-statusbar') + }; + }, + + removeLayout: function ($note, layoutInfo) { + $note.html(layoutInfo.editable.html()); + layoutInfo.editor.remove(); + $note.show(); + } + }; + + $.summernote = $.summernote || { + lang: {} + }; + + $.extend($.summernote.lang, { + 'en-US': { + font: { + bold: 'Bold', + italic: 'Italic', + underline: 'Underline', + clear: 'Remove Font Style', + height: 'Line Height', + name: 'Font Family', + strikethrough: 'Strikethrough', + subscript: 'Subscript', + superscript: 'Superscript', + size: 'Font Size' + }, + image: { + image: 'Picture', + insert: 'Insert Image', + resizeFull: 'Resize Full', + resizeHalf: 'Resize Half', + resizeQuarter: 'Resize Quarter', + floatLeft: 'Float Left', + floatRight: 'Float Right', + floatNone: 'Float None', + shapeRounded: 'Shape: Rounded', + shapeCircle: 'Shape: Circle', + shapeThumbnail: 'Shape: Thumbnail', + shapeNone: 'Shape: None', + dragImageHere: 'Drag image or text here', + dropImage: 'Drop image or Text', + selectFromFiles: 'Select from files', + maximumFileSize: 'Maximum file size', + maximumFileSizeError: 'Maximum file size exceeded.', + url: 'Image URL', + remove: 'Remove Image' + }, + video: { + video: 'Video', + videoLink: 'Video Link', + insert: 'Insert Video', + url: 'Video URL?', + providers: '(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)' + }, + link: { + link: 'Link', + insert: 'Insert Link', + unlink: 'Unlink', + edit: 'Edit', + textToDisplay: 'Text to display', + url: 'To what URL should this link go?', + openInNewWindow: 'Open in new window' + }, + table: { + table: 'Table' + }, + hr: { + insert: 'Insert Horizontal Rule' + }, + style: { + style: 'Style', + normal: 'Normal', + blockquote: 'Quote', + pre: 'Code', + h1: 'Header 1', + h2: 'Header 2', + h3: 'Header 3', + h4: 'Header 4', + h5: 'Header 5', + h6: 'Header 6' + }, + lists: { + unordered: 'Unordered list', + ordered: 'Ordered list' + }, + options: { + help: 'Help', + fullscreen: 'Full Screen', + codeview: 'Code View' + }, + paragraph: { + paragraph: 'Paragraph', + outdent: 'Outdent', + indent: 'Indent', + left: 'Align left', + center: 'Align center', + right: 'Align right', + justify: 'Justify full' + }, + color: { + recent: 'Recent Color', + more: 'More Color', + background: 'Background Color', + foreground: 'Foreground Color', + transparent: 'Transparent', + setTransparent: 'Set transparent', + reset: 'Reset', + resetToDefault: 'Reset to default' + }, + shortcut: { + shortcuts: 'Keyboard shortcuts', + close: 'Close', + textFormatting: 'Text formatting', + action: 'Action', + paragraphFormatting: 'Paragraph formatting', + documentStyle: 'Document Style', + extraKeys: 'Extra keys' + }, + help: { + 'insertParagraph': 'Insert Paragraph', + 'undo': 'Undoes the last command', + 'redo': 'Redoes the last command', + 'tab': 'Tab', + 'untab': 'Untab', + 'bold': 'Set a bold style', + 'italic': 'Set a italic style', + 'underline': 'Set a underline style', + 'strikethrough': 'Set a strikethrough style', + 'removeFormat': 'Clean a style', + 'justifyLeft': 'Set left align', + 'justifyCenter': 'Set center align', + 'justifyRight': 'Set right align', + 'justifyFull': 'Set full align', + 'insertUnorderedList': 'Toggle unordered list', + 'insertOrderedList': 'Toggle ordered list', + 'outdent': 'Outdent on current paragraph', + 'indent': 'Indent on current paragraph', + 'formatPara': 'Change current block\'s format as a paragraph(P tag)', + 'formatH1': 'Change current block\'s format as H1', + 'formatH2': 'Change current block\'s format as H2', + 'formatH3': 'Change current block\'s format as H3', + 'formatH4': 'Change current block\'s format as H4', + 'formatH5': 'Change current block\'s format as H5', + 'formatH6': 'Change current block\'s format as H6', + 'insertHorizontalRule': 'Insert horizontal rule', + 'linkDialog.show': 'Show Link Dialog' + }, + history: { + undo: 'Undo', + redo: 'Redo' + }, + specialChar: { + specialChar: 'SPECIAL CHARACTERS', + select: 'Select Special characters' + } + } + }); + + + /** + * @class core.key + * + * Object for keycodes. + * + * @singleton + * @alternateClassName key + */ + var key = (function () { + var keyMap = { + 'BACKSPACE': 8, + 'TAB': 9, + 'ENTER': 13, + 'SPACE': 32, + + // Arrow + 'LEFT': 37, + 'UP': 38, + 'RIGHT': 39, + 'DOWN': 40, + + // Number: 0-9 + 'NUM0': 48, + 'NUM1': 49, + 'NUM2': 50, + 'NUM3': 51, + 'NUM4': 52, + 'NUM5': 53, + 'NUM6': 54, + 'NUM7': 55, + 'NUM8': 56, + + // Alphabet: a-z + 'B': 66, + 'E': 69, + 'I': 73, + 'J': 74, + 'K': 75, + 'L': 76, + 'R': 82, + 'S': 83, + 'U': 85, + 'V': 86, + 'Y': 89, + 'Z': 90, + + 'SLASH': 191, + 'LEFTBRACKET': 219, + 'BACKSLASH': 220, + 'RIGHTBRACKET': 221 + }; + + return { + /** + * @method isEdit + * + * @param {Number} keyCode + * @return {Boolean} + */ + isEdit: function (keyCode) { + return list.contains([ + keyMap.BACKSPACE, + keyMap.TAB, + keyMap.ENTER, + keyMap.SPACE + ], keyCode); + }, + /** + * @method isMove + * + * @param {Number} keyCode + * @return {Boolean} + */ + isMove: function (keyCode) { + return list.contains([ + keyMap.LEFT, + keyMap.UP, + keyMap.RIGHT, + keyMap.DOWN + ], keyCode); + }, + /** + * @property {Object} nameFromCode + * @property {String} nameFromCode.8 "BACKSPACE" + */ + nameFromCode: func.invertObject(keyMap), + code: keyMap + }; + })(); + + var range = (function () { + + /** + * return boundaryPoint from TextRange, inspired by Andy Na's HuskyRange.js + * + * @param {TextRange} textRange + * @param {Boolean} isStart + * @return {BoundaryPoint} + * + * @see http://msdn.microsoft.com/en-us/library/ie/ms535872(v=vs.85).aspx + */ + var textRangeToPoint = function (textRange, isStart) { + var container = textRange.parentElement(), offset; + + var tester = document.body.createTextRange(), prevContainer; + var childNodes = list.from(container.childNodes); + for (offset = 0; offset < childNodes.length; offset++) { + if (dom.isText(childNodes[offset])) { + continue; + } + tester.moveToElementText(childNodes[offset]); + if (tester.compareEndPoints('StartToStart', textRange) >= 0) { + break; + } + prevContainer = childNodes[offset]; + } + + if (offset !== 0 && dom.isText(childNodes[offset - 1])) { + var textRangeStart = document.body.createTextRange(), curTextNode = null; + textRangeStart.moveToElementText(prevContainer || container); + textRangeStart.collapse(!prevContainer); + curTextNode = prevContainer ? prevContainer.nextSibling : container.firstChild; + + var pointTester = textRange.duplicate(); + pointTester.setEndPoint('StartToStart', textRangeStart); + var textCount = pointTester.text.replace(/[\r\n]/g, '').length; + + while (textCount > curTextNode.nodeValue.length && curTextNode.nextSibling) { + textCount -= curTextNode.nodeValue.length; + curTextNode = curTextNode.nextSibling; + } + + /* jshint ignore:start */ + var dummy = curTextNode.nodeValue; // enforce IE to re-reference curTextNode, hack + /* jshint ignore:end */ + + if (isStart && curTextNode.nextSibling && dom.isText(curTextNode.nextSibling) && + textCount === curTextNode.nodeValue.length) { + textCount -= curTextNode.nodeValue.length; + curTextNode = curTextNode.nextSibling; + } + + container = curTextNode; + offset = textCount; + } + + return { + cont: container, + offset: offset + }; + }; + + /** + * return TextRange from boundary point (inspired by google closure-library) + * @param {BoundaryPoint} point + * @return {TextRange} + */ + var pointToTextRange = function (point) { + var textRangeInfo = function (container, offset) { + var node, isCollapseToStart; + + if (dom.isText(container)) { + var prevTextNodes = dom.listPrev(container, func.not(dom.isText)); + var prevContainer = list.last(prevTextNodes).previousSibling; + node = prevContainer || container.parentNode; + offset += list.sum(list.tail(prevTextNodes), dom.nodeLength); + isCollapseToStart = !prevContainer; + } else { + node = container.childNodes[offset] || container; + if (dom.isText(node)) { + return textRangeInfo(node, 0); + } + + offset = 0; + isCollapseToStart = false; + } + + return { + node: node, + collapseToStart: isCollapseToStart, + offset: offset + }; + }; + + var textRange = document.body.createTextRange(); + var info = textRangeInfo(point.node, point.offset); + + textRange.moveToElementText(info.node); + textRange.collapse(info.collapseToStart); + textRange.moveStart('character', info.offset); + return textRange; + }; + + /** + * Wrapped Range + * + * @constructor + * @param {Node} sc - start container + * @param {Number} so - start offset + * @param {Node} ec - end container + * @param {Number} eo - end offset + */ + var WrappedRange = function (sc, so, ec, eo) { + this.sc = sc; + this.so = so; + this.ec = ec; + this.eo = eo; + + // nativeRange: get nativeRange from sc, so, ec, eo + var nativeRange = function () { + if (agent.isW3CRangeSupport) { + var w3cRange = document.createRange(); + w3cRange.setStart(sc, so); + w3cRange.setEnd(ec, eo); + + return w3cRange; + } else { + var textRange = pointToTextRange({ + node: sc, + offset: so + }); + + textRange.setEndPoint('EndToEnd', pointToTextRange({ + node: ec, + offset: eo + })); + + return textRange; + } + }; + + this.getPoints = function () { + return { + sc: sc, + so: so, + ec: ec, + eo: eo + }; + }; + + this.getStartPoint = function () { + return { + node: sc, + offset: so + }; + }; + + this.getEndPoint = function () { + return { + node: ec, + offset: eo + }; + }; + + /** + * select update visible range + */ + this.select = function () { + var nativeRng = nativeRange(); + if (agent.isW3CRangeSupport) { + var selection = document.getSelection(); + if (selection.rangeCount > 0) { + selection.removeAllRanges(); + } + selection.addRange(nativeRng); + } else { + nativeRng.select(); + } + + return this; + }; + + /** + * Moves the scrollbar to start container(sc) of current range + * + * @return {WrappedRange} + */ + this.scrollIntoView = function (container) { + var height = $(container).height(); + if (container.scrollTop + height < this.sc.offsetTop) { + container.scrollTop += Math.abs(container.scrollTop + height - this.sc.offsetTop); + } + + return this; + }; + + /** + * @return {WrappedRange} + */ + this.normalize = function () { + + /** + * @param {BoundaryPoint} point + * @param {Boolean} isLeftToRight + * @return {BoundaryPoint} + */ + var getVisiblePoint = function (point, isLeftToRight) { + if ((dom.isVisiblePoint(point) && !dom.isEdgePoint(point)) || + (dom.isVisiblePoint(point) && dom.isRightEdgePoint(point) && !isLeftToRight) || + (dom.isVisiblePoint(point) && dom.isLeftEdgePoint(point) && isLeftToRight) || + (dom.isVisiblePoint(point) && dom.isBlock(point.node) && dom.isEmpty(point.node))) { + return point; + } + + // point on block's edge + var block = dom.ancestor(point.node, dom.isBlock); + if (((dom.isLeftEdgePointOf(point, block) || dom.isVoid(dom.prevPoint(point).node)) && !isLeftToRight) || + ((dom.isRightEdgePointOf(point, block) || dom.isVoid(dom.nextPoint(point).node)) && isLeftToRight)) { + + // returns point already on visible point + if (dom.isVisiblePoint(point)) { + return point; + } + // reverse direction + isLeftToRight = !isLeftToRight; + } + + var nextPoint = isLeftToRight ? dom.nextPointUntil(dom.nextPoint(point), dom.isVisiblePoint) : + dom.prevPointUntil(dom.prevPoint(point), dom.isVisiblePoint); + return nextPoint || point; + }; + + var endPoint = getVisiblePoint(this.getEndPoint(), false); + var startPoint = this.isCollapsed() ? endPoint : getVisiblePoint(this.getStartPoint(), true); + + return new WrappedRange( + startPoint.node, + startPoint.offset, + endPoint.node, + endPoint.offset + ); + }; + + /** + * returns matched nodes on range + * + * @param {Function} [pred] - predicate function + * @param {Object} [options] + * @param {Boolean} [options.includeAncestor] + * @param {Boolean} [options.fullyContains] + * @return {Node[]} + */ + this.nodes = function (pred, options) { + pred = pred || func.ok; + + var includeAncestor = options && options.includeAncestor; + var fullyContains = options && options.fullyContains; + + // TODO compare points and sort + var startPoint = this.getStartPoint(); + var endPoint = this.getEndPoint(); + + var nodes = []; + var leftEdgeNodes = []; + + dom.walkPoint(startPoint, endPoint, function (point) { + if (dom.isEditable(point.node)) { + return; + } + + var node; + if (fullyContains) { + if (dom.isLeftEdgePoint(point)) { + leftEdgeNodes.push(point.node); + } + if (dom.isRightEdgePoint(point) && list.contains(leftEdgeNodes, point.node)) { + node = point.node; + } + } else if (includeAncestor) { + node = dom.ancestor(point.node, pred); + } else { + node = point.node; + } + + if (node && pred(node)) { + nodes.push(node); + } + }, true); + + return list.unique(nodes); + }; + + /** + * returns commonAncestor of range + * @return {Element} - commonAncestor + */ + this.commonAncestor = function () { + return dom.commonAncestor(sc, ec); + }; + + /** + * returns expanded range by pred + * + * @param {Function} pred - predicate function + * @return {WrappedRange} + */ + this.expand = function (pred) { + var startAncestor = dom.ancestor(sc, pred); + var endAncestor = dom.ancestor(ec, pred); + + if (!startAncestor && !endAncestor) { + return new WrappedRange(sc, so, ec, eo); + } + + var boundaryPoints = this.getPoints(); + + if (startAncestor) { + boundaryPoints.sc = startAncestor; + boundaryPoints.so = 0; + } + + if (endAncestor) { + boundaryPoints.ec = endAncestor; + boundaryPoints.eo = dom.nodeLength(endAncestor); + } + + return new WrappedRange( + boundaryPoints.sc, + boundaryPoints.so, + boundaryPoints.ec, + boundaryPoints.eo + ); + }; + + /** + * @param {Boolean} isCollapseToStart + * @return {WrappedRange} + */ + this.collapse = function (isCollapseToStart) { + if (isCollapseToStart) { + return new WrappedRange(sc, so, sc, so); + } else { + return new WrappedRange(ec, eo, ec, eo); + } + }; + + /** + * splitText on range + */ + this.splitText = function () { + var isSameContainer = sc === ec; + var boundaryPoints = this.getPoints(); + + if (dom.isText(ec) && !dom.isEdgePoint(this.getEndPoint())) { + ec.splitText(eo); + } + + if (dom.isText(sc) && !dom.isEdgePoint(this.getStartPoint())) { + boundaryPoints.sc = sc.splitText(so); + boundaryPoints.so = 0; + + if (isSameContainer) { + boundaryPoints.ec = boundaryPoints.sc; + boundaryPoints.eo = eo - so; + } + } + + return new WrappedRange( + boundaryPoints.sc, + boundaryPoints.so, + boundaryPoints.ec, + boundaryPoints.eo + ); + }; + + /** + * delete contents on range + * @return {WrappedRange} + */ + this.deleteContents = function () { + if (this.isCollapsed()) { + return this; + } + + var rng = this.splitText(); + var nodes = rng.nodes(null, { + fullyContains: true + }); + + // find new cursor point + var point = dom.prevPointUntil(rng.getStartPoint(), function (point) { + return !list.contains(nodes, point.node); + }); + + var emptyParents = []; + $.each(nodes, function (idx, node) { + // find empty parents + var parent = node.parentNode; + if (point.node !== parent && dom.nodeLength(parent) === 1) { + emptyParents.push(parent); + } + dom.remove(node, false); + }); + + // remove empty parents + $.each(emptyParents, function (idx, node) { + dom.remove(node, false); + }); + + return new WrappedRange( + point.node, + point.offset, + point.node, + point.offset + ).normalize(); + }; + + /** + * makeIsOn: return isOn(pred) function + */ + var makeIsOn = function (pred) { + return function () { + var ancestor = dom.ancestor(sc, pred); + return !!ancestor && (ancestor === dom.ancestor(ec, pred)); + }; + }; + + // isOnEditable: judge whether range is on editable or not + this.isOnEditable = makeIsOn(dom.isEditable); + // isOnList: judge whether range is on list node or not + this.isOnList = makeIsOn(dom.isList); + // isOnAnchor: judge whether range is on anchor node or not + this.isOnAnchor = makeIsOn(dom.isAnchor); + // isOnCell: judge whether range is on cell node or not + this.isOnCell = makeIsOn(dom.isCell); + // isOnData: judge whether range is on data node or not + this.isOnData = makeIsOn(dom.isData); + + /** + * @param {Function} pred + * @return {Boolean} + */ + this.isLeftEdgeOf = function (pred) { + if (!dom.isLeftEdgePoint(this.getStartPoint())) { + return false; + } + + var node = dom.ancestor(this.sc, pred); + return node && dom.isLeftEdgeOf(this.sc, node); + }; + + /** + * returns whether range was collapsed or not + */ + this.isCollapsed = function () { + return sc === ec && so === eo; + }; + + /** + * wrap inline nodes which children of body with paragraph + * + * @return {WrappedRange} + */ + this.wrapBodyInlineWithPara = function () { + if (dom.isBodyContainer(sc) && dom.isEmpty(sc)) { + sc.innerHTML = dom.emptyPara; + return new WrappedRange(sc.firstChild, 0, sc.firstChild, 0); + } + + /** + * [workaround] firefox often create range on not visible point. so normalize here. + * - firefox: |<p>text</p>| + * - chrome: <p>|text|</p> + */ + var rng = this.normalize(); + if (dom.isParaInline(sc) || dom.isPara(sc)) { + return rng; + } + + // find inline top ancestor + var topAncestor; + if (dom.isInline(rng.sc)) { + var ancestors = dom.listAncestor(rng.sc, func.not(dom.isInline)); + topAncestor = list.last(ancestors); + if (!dom.isInline(topAncestor)) { + topAncestor = ancestors[ancestors.length - 2] || rng.sc.childNodes[rng.so]; + } + } else { + topAncestor = rng.sc.childNodes[rng.so > 0 ? rng.so - 1 : 0]; + } + + // siblings not in paragraph + var inlineSiblings = dom.listPrev(topAncestor, dom.isParaInline).reverse(); + inlineSiblings = inlineSiblings.concat(dom.listNext(topAncestor.nextSibling, dom.isParaInline)); + + // wrap with paragraph + if (inlineSiblings.length) { + var para = dom.wrap(list.head(inlineSiblings), 'p'); + dom.appendChildNodes(para, list.tail(inlineSiblings)); + } + + return this.normalize(); + }; + + /** + * insert node at current cursor + * + * @param {Node} node + * @return {Node} + */ + this.insertNode = function (node) { + var rng = this.wrapBodyInlineWithPara().deleteContents(); + var info = dom.splitPoint(rng.getStartPoint(), dom.isInline(node)); + + if (info.rightNode) { + info.rightNode.parentNode.insertBefore(node, info.rightNode); + } else { + info.container.appendChild(node); + } + + return node; + }; + + /** + * insert html at current cursor + */ + this.pasteHTML = function (markup) { + var contentsContainer = $('<div></div>').html(markup)[0]; + var childNodes = list.from(contentsContainer.childNodes); + + var rng = this.wrapBodyInlineWithPara().deleteContents(); + + return childNodes.reverse().map(function (childNode) { + return rng.insertNode(childNode); + }).reverse(); + }; + + /** + * returns text in range + * + * @return {String} + */ + this.toString = function () { + var nativeRng = nativeRange(); + return agent.isW3CRangeSupport ? nativeRng.toString() : nativeRng.text; + }; + + /** + * returns range for word before cursor + * + * @param {Boolean} [findAfter] - find after cursor, default: false + * @return {WrappedRange} + */ + this.getWordRange = function (findAfter) { + var endPoint = this.getEndPoint(); + + if (!dom.isCharPoint(endPoint)) { + return this; + } + + var startPoint = dom.prevPointUntil(endPoint, function (point) { + return !dom.isCharPoint(point); + }); + + if (findAfter) { + endPoint = dom.nextPointUntil(endPoint, function (point) { + return !dom.isCharPoint(point); + }); + } + + return new WrappedRange( + startPoint.node, + startPoint.offset, + endPoint.node, + endPoint.offset + ); + }; + + /** + * create offsetPath bookmark + * + * @param {Node} editable + */ + this.bookmark = function (editable) { + return { + s: { + path: dom.makeOffsetPath(editable, sc), + offset: so + }, + e: { + path: dom.makeOffsetPath(editable, ec), + offset: eo + } + }; + }; + + /** + * create offsetPath bookmark base on paragraph + * + * @param {Node[]} paras + */ + this.paraBookmark = function (paras) { + return { + s: { + path: list.tail(dom.makeOffsetPath(list.head(paras), sc)), + offset: so + }, + e: { + path: list.tail(dom.makeOffsetPath(list.last(paras), ec)), + offset: eo + } + }; + }; + + /** + * getClientRects + * @return {Rect[]} + */ + this.getClientRects = function () { + var nativeRng = nativeRange(); + return nativeRng.getClientRects(); + }; + }; + + /** + * @class core.range + * + * Data structure + * * BoundaryPoint: a point of dom tree + * * BoundaryPoints: two boundaryPoints corresponding to the start and the end of the Range + * + * See to http://www.w3.org/TR/DOM-Level-2-Traversal-Range/ranges.html#Level-2-Range-Position + * + * @singleton + * @alternateClassName range + */ + return { + /** + * create Range Object From arguments or Browser Selection + * + * @param {Node} sc - start container + * @param {Number} so - start offset + * @param {Node} ec - end container + * @param {Number} eo - end offset + * @return {WrappedRange} + */ + create: function (sc, so, ec, eo) { + if (arguments.length === 4) { + return new WrappedRange(sc, so, ec, eo); + } else if (arguments.length === 2) { //collapsed + ec = sc; + eo = so; + return new WrappedRange(sc, so, ec, eo); + } else { + var wrappedRange = this.createFromSelection(); + if (!wrappedRange && arguments.length === 1) { + wrappedRange = this.createFromNode(arguments[0]); + return wrappedRange.collapse(dom.emptyPara === arguments[0].innerHTML); + } + return wrappedRange; + } + }, + + createFromSelection: function () { + var sc, so, ec, eo; + if (agent.isW3CRangeSupport) { + var selection = document.getSelection(); + if (!selection || selection.rangeCount === 0) { + return null; + } else if (dom.isBody(selection.anchorNode)) { + // Firefox: returns entire body as range on initialization. + // We won't never need it. + return null; + } + + var nativeRng = selection.getRangeAt(0); + sc = nativeRng.startContainer; + so = nativeRng.startOffset; + ec = nativeRng.endContainer; + eo = nativeRng.endOffset; + } else { // IE8: TextRange + var textRange = document.selection.createRange(); + var textRangeEnd = textRange.duplicate(); + textRangeEnd.collapse(false); + var textRangeStart = textRange; + textRangeStart.collapse(true); + + var startPoint = textRangeToPoint(textRangeStart, true), + endPoint = textRangeToPoint(textRangeEnd, false); + + // same visible point case: range was collapsed. + if (dom.isText(startPoint.node) && dom.isLeftEdgePoint(startPoint) && + dom.isTextNode(endPoint.node) && dom.isRightEdgePoint(endPoint) && + endPoint.node.nextSibling === startPoint.node) { + startPoint = endPoint; + } + + sc = startPoint.cont; + so = startPoint.offset; + ec = endPoint.cont; + eo = endPoint.offset; + } + + return new WrappedRange(sc, so, ec, eo); + }, + + /** + * @method + * + * create WrappedRange from node + * + * @param {Node} node + * @return {WrappedRange} + */ + createFromNode: function (node) { + var sc = node; + var so = 0; + var ec = node; + var eo = dom.nodeLength(ec); + + // browsers can't target a picture or void node + if (dom.isVoid(sc)) { + so = dom.listPrev(sc).length - 1; + sc = sc.parentNode; + } + if (dom.isBR(ec)) { + eo = dom.listPrev(ec).length - 1; + ec = ec.parentNode; + } else if (dom.isVoid(ec)) { + eo = dom.listPrev(ec).length; + ec = ec.parentNode; + } + + return this.create(sc, so, ec, eo); + }, + + /** + * create WrappedRange from node after position + * + * @param {Node} node + * @return {WrappedRange} + */ + createFromNodeBefore: function (node) { + return this.createFromNode(node).collapse(true); + }, + + /** + * create WrappedRange from node after position + * + * @param {Node} node + * @return {WrappedRange} + */ + createFromNodeAfter: function (node) { + return this.createFromNode(node).collapse(); + }, + + /** + * @method + * + * create WrappedRange from bookmark + * + * @param {Node} editable + * @param {Object} bookmark + * @return {WrappedRange} + */ + createFromBookmark: function (editable, bookmark) { + var sc = dom.fromOffsetPath(editable, bookmark.s.path); + var so = bookmark.s.offset; + var ec = dom.fromOffsetPath(editable, bookmark.e.path); + var eo = bookmark.e.offset; + return new WrappedRange(sc, so, ec, eo); + }, + + /** + * @method + * + * create WrappedRange from paraBookmark + * + * @param {Object} bookmark + * @param {Node[]} paras + * @return {WrappedRange} + */ + createFromParaBookmark: function (bookmark, paras) { + var so = bookmark.s.offset; + var eo = bookmark.e.offset; + var sc = dom.fromOffsetPath(list.head(paras), bookmark.s.path); + var ec = dom.fromOffsetPath(list.last(paras), bookmark.e.path); + + return new WrappedRange(sc, so, ec, eo); + } + }; + })(); + + /** + * @class core.async + * + * Async functions which returns `Promise` + * + * @singleton + * @alternateClassName async + */ + var async = (function () { + /** + * @method readFileAsDataURL + * + * read contents of file as representing URL + * + * @param {File} file + * @return {Promise} - then: dataUrl + */ + var readFileAsDataURL = function (file) { + return $.Deferred(function (deferred) { + $.extend(new FileReader(), { + onload: function (e) { + var dataURL = e.target.result; + deferred.resolve(dataURL); + }, + onerror: function () { + deferred.reject(this); + } + }).readAsDataURL(file); + }).promise(); + }; + + /** + * @method createImage + * + * create `<image>` from url string + * + * @param {String} url + * @return {Promise} - then: $image + */ + var createImage = function (url) { + return $.Deferred(function (deferred) { + var $img = $('<img>'); + + $img.one('load', function () { + $img.off('error abort'); + deferred.resolve($img); + }).one('error abort', function () { + $img.off('load').detach(); + deferred.reject($img); + }).css({ + display: 'none' + }).appendTo(document.body).attr('src', url); + }).promise(); + }; + + return { + readFileAsDataURL: readFileAsDataURL, + createImage: createImage + }; + })(); + + /** + * @class editing.History + * + * Editor History + * + */ + var History = function ($editable) { + var stack = [], stackOffset = -1; + var editable = $editable[0]; + + var makeSnapshot = function () { + var rng = range.create(editable); + var emptyBookmark = {s: {path: [], offset: 0}, e: {path: [], offset: 0}}; + + return { + contents: $editable.html(), + bookmark: (rng ? rng.bookmark(editable) : emptyBookmark) + }; + }; + + var applySnapshot = function (snapshot) { + if (snapshot.contents !== null) { + $editable.html(snapshot.contents); + } + if (snapshot.bookmark !== null) { + range.createFromBookmark(editable, snapshot.bookmark).select(); + } + }; + + /** + * @method rewind + * Rewinds the history stack back to the first snapshot taken. + * Leaves the stack intact, so that "Redo" can still be used. + */ + this.rewind = function () { + // Create snap shot if not yet recorded + if ($editable.html() !== stack[stackOffset].contents) { + this.recordUndo(); + } + + // Return to the first available snapshot. + stackOffset = 0; + + // Apply that snapshot. + applySnapshot(stack[stackOffset]); + }; + + /** + * @method reset + * Resets the history stack completely; reverting to an empty editor. + */ + this.reset = function () { + // Clear the stack. + stack = []; + + // Restore stackOffset to its original value. + stackOffset = -1; + + // Clear the editable area. + $editable.html(''); + + // Record our first snapshot (of nothing). + this.recordUndo(); + }; + + /** + * undo + */ + this.undo = function () { + // Create snap shot if not yet recorded + if ($editable.html() !== stack[stackOffset].contents) { + this.recordUndo(); + } + + if (0 < stackOffset) { + stackOffset--; + applySnapshot(stack[stackOffset]); + } + }; + + /** + * redo + */ + this.redo = function () { + if (stack.length - 1 > stackOffset) { + stackOffset++; + applySnapshot(stack[stackOffset]); + } + }; + + /** + * recorded undo + */ + this.recordUndo = function () { + stackOffset++; + + // Wash out stack after stackOffset + if (stack.length > stackOffset) { + stack = stack.slice(0, stackOffset); + } + + // Create new snapshot and push it to the end + stack.push(makeSnapshot()); + }; + }; + + /** + * @class editing.Style + * + * Style + * + */ + var Style = function () { + /** + * @method jQueryCSS + * + * [workaround] for old jQuery + * passing an array of style properties to .css() + * will result in an object of property-value pairs. + * (compability with version < 1.9) + * + * @private + * @param {jQuery} $obj + * @param {Array} propertyNames - An array of one or more CSS properties. + * @return {Object} + */ + var jQueryCSS = function ($obj, propertyNames) { + if (agent.jqueryVersion < 1.9) { + var result = {}; + $.each(propertyNames, function (idx, propertyName) { + result[propertyName] = $obj.css(propertyName); + }); + return result; + } + return $obj.css.call($obj, propertyNames); + }; + + /** + * returns style object from node + * + * @param {jQuery} $node + * @return {Object} + */ + this.fromNode = function ($node) { + var properties = ['font-family', 'font-size', 'text-align', 'list-style-type', 'line-height']; + var styleInfo = jQueryCSS($node, properties) || {}; + styleInfo['font-size'] = parseInt(styleInfo['font-size'], 10); + return styleInfo; + }; + + /** + * paragraph level style + * + * @param {WrappedRange} rng + * @param {Object} styleInfo + */ + this.stylePara = function (rng, styleInfo) { + $.each(rng.nodes(dom.isPara, { + includeAncestor: true + }), function (idx, para) { + $(para).css(styleInfo); + }); + }; + + /** + * insert and returns styleNodes on range. + * + * @param {WrappedRange} rng + * @param {Object} [options] - options for styleNodes + * @param {String} [options.nodeName] - default: `SPAN` + * @param {Boolean} [options.expandClosestSibling] - default: `false` + * @param {Boolean} [options.onlyPartialContains] - default: `false` + * @return {Node[]} + */ + this.styleNodes = function (rng, options) { + rng = rng.splitText(); + + var nodeName = options && options.nodeName || 'SPAN'; + var expandClosestSibling = !!(options && options.expandClosestSibling); + var onlyPartialContains = !!(options && options.onlyPartialContains); + + if (rng.isCollapsed()) { + return [rng.insertNode(dom.create(nodeName))]; + } + + var pred = dom.makePredByNodeName(nodeName); + var nodes = rng.nodes(dom.isText, { + fullyContains: true + }).map(function (text) { + return dom.singleChildAncestor(text, pred) || dom.wrap(text, nodeName); + }); + + if (expandClosestSibling) { + if (onlyPartialContains) { + var nodesInRange = rng.nodes(); + // compose with partial contains predication + pred = func.and(pred, function (node) { + return list.contains(nodesInRange, node); + }); + } + + return nodes.map(function (node) { + var siblings = dom.withClosestSiblings(node, pred); + var head = list.head(siblings); + var tails = list.tail(siblings); + $.each(tails, function (idx, elem) { + dom.appendChildNodes(head, elem.childNodes); + dom.remove(elem); + }); + return list.head(siblings); + }); + } else { + return nodes; + } + }; + + /** + * get current style on cursor + * + * @param {WrappedRange} rng + * @return {Object} - object contains style properties. + */ + this.current = function (rng) { + var $cont = $(!dom.isElement(rng.sc) ? rng.sc.parentNode : rng.sc); + var styleInfo = this.fromNode($cont); + + // document.queryCommandState for toggle state + // [workaround] prevent Firefox nsresult: "0x80004005 (NS_ERROR_FAILURE)" + try { + styleInfo = $.extend(styleInfo, { + 'font-bold': document.queryCommandState('bold') ? 'bold' : 'normal', + 'font-italic': document.queryCommandState('italic') ? 'italic' : 'normal', + 'font-underline': document.queryCommandState('underline') ? 'underline' : 'normal', + 'font-subscript': document.queryCommandState('subscript') ? 'subscript' : 'normal', + 'font-superscript': document.queryCommandState('superscript') ? 'superscript' : 'normal', + 'font-strikethrough': document.queryCommandState('strikethrough') ? 'strikethrough' : 'normal' + }); + } catch (e) {} + + // list-style-type to list-style(unordered, ordered) + if (!rng.isOnList()) { + styleInfo['list-style'] = 'none'; + } else { + var orderedTypes = ['circle', 'disc', 'disc-leading-zero', 'square']; + var isUnordered = $.inArray(styleInfo['list-style-type'], orderedTypes) > -1; + styleInfo['list-style'] = isUnordered ? 'unordered' : 'ordered'; + } + + var para = dom.ancestor(rng.sc, dom.isPara); + if (para && para.style['line-height']) { + styleInfo['line-height'] = para.style.lineHeight; + } else { + var lineHeight = parseInt(styleInfo['line-height'], 10) / parseInt(styleInfo['font-size'], 10); + styleInfo['line-height'] = lineHeight.toFixed(1); + } + + styleInfo.anchor = rng.isOnAnchor() && dom.ancestor(rng.sc, dom.isAnchor); + styleInfo.ancestors = dom.listAncestor(rng.sc, dom.isEditable); + styleInfo.range = rng; + + return styleInfo; + }; + }; + + + /** + * @class editing.Bullet + * + * @alternateClassName Bullet + */ + var Bullet = function () { + var self = this; + + /** + * toggle ordered list + */ + this.insertOrderedList = function (editable) { + this.toggleList('OL', editable); + }; + + /** + * toggle unordered list + */ + this.insertUnorderedList = function (editable) { + this.toggleList('UL', editable); + }; + + /** + * indent + */ + this.indent = function (editable) { + var self = this; + var rng = range.create(editable).wrapBodyInlineWithPara(); + + var paras = rng.nodes(dom.isPara, { includeAncestor: true }); + var clustereds = list.clusterBy(paras, func.peq2('parentNode')); + + $.each(clustereds, function (idx, paras) { + var head = list.head(paras); + if (dom.isLi(head)) { + self.wrapList(paras, head.parentNode.nodeName); + } else { + $.each(paras, function (idx, para) { + $(para).css('marginLeft', function (idx, val) { + return (parseInt(val, 10) || 0) + 25; + }); + }); + } + }); + + rng.select(); + }; + + /** + * outdent + */ + this.outdent = function (editable) { + var self = this; + var rng = range.create(editable).wrapBodyInlineWithPara(); + + var paras = rng.nodes(dom.isPara, { includeAncestor: true }); + var clustereds = list.clusterBy(paras, func.peq2('parentNode')); + + $.each(clustereds, function (idx, paras) { + var head = list.head(paras); + if (dom.isLi(head)) { + self.releaseList([paras]); + } else { + $.each(paras, function (idx, para) { + $(para).css('marginLeft', function (idx, val) { + val = (parseInt(val, 10) || 0); + return val > 25 ? val - 25 : ''; + }); + }); + } + }); + + rng.select(); + }; + + /** + * toggle list + * + * @param {String} listName - OL or UL + */ + this.toggleList = function (listName, editable) { + var rng = range.create(editable).wrapBodyInlineWithPara(); + + var paras = rng.nodes(dom.isPara, { includeAncestor: true }); + var bookmark = rng.paraBookmark(paras); + var clustereds = list.clusterBy(paras, func.peq2('parentNode')); + + // paragraph to list + if (list.find(paras, dom.isPurePara)) { + var wrappedParas = []; + $.each(clustereds, function (idx, paras) { + wrappedParas = wrappedParas.concat(self.wrapList(paras, listName)); + }); + paras = wrappedParas; + // list to paragraph or change list style + } else { + var diffLists = rng.nodes(dom.isList, { + includeAncestor: true + }).filter(function (listNode) { + return !$.nodeName(listNode, listName); + }); + + if (diffLists.length) { + $.each(diffLists, function (idx, listNode) { + dom.replace(listNode, listName); + }); + } else { + paras = this.releaseList(clustereds, true); + } + } + + range.createFromParaBookmark(bookmark, paras).select(); + }; + + /** + * @param {Node[]} paras + * @param {String} listName + * @return {Node[]} + */ + this.wrapList = function (paras, listName) { + var head = list.head(paras); + var last = list.last(paras); + + var prevList = dom.isList(head.previousSibling) && head.previousSibling; + var nextList = dom.isList(last.nextSibling) && last.nextSibling; + + var listNode = prevList || dom.insertAfter(dom.create(listName || 'UL'), last); + + // P to LI + paras = paras.map(function (para) { + return dom.isPurePara(para) ? dom.replace(para, 'LI') : para; + }); + + // append to list(<ul>, <ol>) + dom.appendChildNodes(listNode, paras); + + if (nextList) { + dom.appendChildNodes(listNode, list.from(nextList.childNodes)); + dom.remove(nextList); + } + + return paras; + }; + + /** + * @method releaseList + * + * @param {Array[]} clustereds + * @param {Boolean} isEscapseToBody + * @return {Node[]} + */ + this.releaseList = function (clustereds, isEscapseToBody) { + var releasedParas = []; + + $.each(clustereds, function (idx, paras) { + var head = list.head(paras); + var last = list.last(paras); + + var headList = isEscapseToBody ? dom.lastAncestor(head, dom.isList) : + head.parentNode; + var lastList = headList.childNodes.length > 1 ? dom.splitTree(headList, { + node: last.parentNode, + offset: dom.position(last) + 1 + }, { + isSkipPaddingBlankHTML: true + }) : null; + + var middleList = dom.splitTree(headList, { + node: head.parentNode, + offset: dom.position(head) + }, { + isSkipPaddingBlankHTML: true + }); + + paras = isEscapseToBody ? dom.listDescendant(middleList, dom.isLi) : + list.from(middleList.childNodes).filter(dom.isLi); + + // LI to P + if (isEscapseToBody || !dom.isList(headList.parentNode)) { + paras = paras.map(function (para) { + return dom.replace(para, 'P'); + }); + } + + $.each(list.from(paras).reverse(), function (idx, para) { + dom.insertAfter(para, headList); + }); + + // remove empty lists + var rootLists = list.compact([headList, middleList, lastList]); + $.each(rootLists, function (idx, rootList) { + var listNodes = [rootList].concat(dom.listDescendant(rootList, dom.isList)); + $.each(listNodes.reverse(), function (idx, listNode) { + if (!dom.nodeLength(listNode)) { + dom.remove(listNode, true); + } + }); + }); + + releasedParas = releasedParas.concat(paras); + }); + + return releasedParas; + }; + }; + + + /** + * @class editing.Typing + * + * Typing + * + */ + var Typing = function () { + + // a Bullet instance to toggle lists off + var bullet = new Bullet(); + + /** + * insert tab + * + * @param {WrappedRange} rng + * @param {Number} tabsize + */ + this.insertTab = function (rng, tabsize) { + var tab = dom.createText(new Array(tabsize + 1).join(dom.NBSP_CHAR)); + rng = rng.deleteContents(); + rng.insertNode(tab, true); + + rng = range.create(tab, tabsize); + rng.select(); + }; + + /** + * insert paragraph + */ + this.insertParagraph = function (editable) { + var rng = range.create(editable); + + // deleteContents on range. + rng = rng.deleteContents(); + + // Wrap range if it needs to be wrapped by paragraph + rng = rng.wrapBodyInlineWithPara(); + + // finding paragraph + var splitRoot = dom.ancestor(rng.sc, dom.isPara); + + var nextPara; + // on paragraph: split paragraph + if (splitRoot) { + // if it is an empty line with li + if (dom.isEmpty(splitRoot) && dom.isLi(splitRoot)) { + // toogle UL/OL and escape + bullet.toggleList(splitRoot.parentNode.nodeName); + return; + // if it is an empty line with para on blockquote + } else if (dom.isEmpty(splitRoot) && dom.isPara(splitRoot) && dom.isBlockquote(splitRoot.parentNode)) { + // escape blockquote + dom.insertAfter(splitRoot, splitRoot.parentNode); + nextPara = splitRoot; + // if new line has content (not a line break) + } else { + nextPara = dom.splitTree(splitRoot, rng.getStartPoint()); + + var emptyAnchors = dom.listDescendant(splitRoot, dom.isEmptyAnchor); + emptyAnchors = emptyAnchors.concat(dom.listDescendant(nextPara, dom.isEmptyAnchor)); + + $.each(emptyAnchors, function (idx, anchor) { + dom.remove(anchor); + }); + + // replace empty heading or pre with P tag + if ((dom.isHeading(nextPara) || dom.isPre(nextPara)) && dom.isEmpty(nextPara)) { + nextPara = dom.replace(nextPara, 'p'); + } + } + // no paragraph: insert empty paragraph + } else { + var next = rng.sc.childNodes[rng.so]; + nextPara = $(dom.emptyPara)[0]; + if (next) { + rng.sc.insertBefore(nextPara, next); + } else { + rng.sc.appendChild(nextPara); + } + } + + range.create(nextPara, 0).normalize().select().scrollIntoView(editable); + }; + }; + + /** + * @class editing.Table + * + * Table + * + */ + var Table = function () { + /** + * handle tab key + * + * @param {WrappedRange} rng + * @param {Boolean} isShift + */ + this.tab = function (rng, isShift) { + var cell = dom.ancestor(rng.commonAncestor(), dom.isCell); + var table = dom.ancestor(cell, dom.isTable); + var cells = dom.listDescendant(table, dom.isCell); + + var nextCell = list[isShift ? 'prev' : 'next'](cells, cell); + if (nextCell) { + range.create(nextCell, 0).select(); + } + }; + + /** + * create empty table element + * + * @param {Number} rowCount + * @param {Number} colCount + * @return {Node} + */ + this.createTable = function (colCount, rowCount, options) { + var tds = [], tdHTML; + for (var idxCol = 0; idxCol < colCount; idxCol++) { + tds.push('<td>' + dom.blank + '</td>'); + } + tdHTML = tds.join(''); + + var trs = [], trHTML; + for (var idxRow = 0; idxRow < rowCount; idxRow++) { + trs.push('<tr>' + tdHTML + '</tr>'); + } + trHTML = trs.join(''); + var $table = $('<table>' + trHTML + '</table>'); + if (options && options.tableClassName) { + $table.addClass(options.tableClassName); + } + + return $table[0]; + }; + }; + + + var KEY_BOGUS = 'bogus'; + + /** + * @class Editor + */ + var Editor = function (context) { + var self = this; + + var $note = context.layoutInfo.note; + var $editor = context.layoutInfo.editor; + var $editable = context.layoutInfo.editable; + var options = context.options; + var lang = options.langInfo; + + var editable = $editable[0]; + var lastRange = null; + + var style = new Style(); + var table = new Table(); + var typing = new Typing(); + var bullet = new Bullet(); + var history = new History($editable); + + this.initialize = function () { + // bind custom events + $editable.on('keydown', function (event) { + if (event.keyCode === key.code.ENTER) { + context.triggerEvent('enter', event); + } + context.triggerEvent('keydown', event); + + if (!event.isDefaultPrevented()) { + if (options.shortcuts) { + self.handleKeyMap(event); + } else { + self.preventDefaultEditableShortCuts(event); + } + } + }).on('keyup', function (event) { + context.triggerEvent('keyup', event); + }).on('focus', function (event) { + context.triggerEvent('focus', event); + }).on('blur', function (event) { + context.triggerEvent('blur', event); + }).on('mousedown', function (event) { + context.triggerEvent('mousedown', event); + }).on('mouseup', function (event) { + context.triggerEvent('mouseup', event); + }).on('scroll', function (event) { + context.triggerEvent('scroll', event); + }).on('paste', function (event) { + context.triggerEvent('paste', event); + }); + + // init content before set event + $editable.html(dom.html($note) || dom.emptyPara); + + // [workaround] IE doesn't have input events for contentEditable + // - see: https://goo.gl/4bfIvA + var changeEventName = agent.isMSIE ? 'DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted' : 'input'; + $editable.on(changeEventName, func.debounce(function () { + context.triggerEvent('change', $editable.html()); + }, 250)); + + $editor.on('focusin', function (event) { + context.triggerEvent('focusin', event); + }).on('focusout', function (event) { + context.triggerEvent('focusout', event); + }); + + if (!options.airMode) { + if (options.width) { + $editor.outerWidth(options.width); + } + if (options.height) { + $editable.outerHeight(options.height); + } + if (options.maxHeight) { + $editable.css('max-height', options.maxHeight); + } + if (options.minHeight) { + $editable.css('min-height', options.minHeight); + } + } + + history.recordUndo(); + }; + + this.destroy = function () { + $editable.off(); + }; + + this.handleKeyMap = function (event) { + var keyMap = options.keyMap[agent.isMac ? 'mac' : 'pc']; + var keys = []; + + if (event.metaKey) { keys.push('CMD'); } + if (event.ctrlKey && !event.altKey) { keys.push('CTRL'); } + if (event.shiftKey) { keys.push('SHIFT'); } + + var keyName = key.nameFromCode[event.keyCode]; + if (keyName) { + keys.push(keyName); + } + + var eventName = keyMap[keys.join('+')]; + if (eventName) { + event.preventDefault(); + context.invoke(eventName); + } else if (key.isEdit(event.keyCode)) { + this.afterCommand(); + } + }; + + this.preventDefaultEditableShortCuts = function (event) { + // B(Bold, 66) / I(Italic, 73) / U(Underline, 85) + if ((event.ctrlKey || event.metaKey) && + list.contains([66, 73, 85], event.keyCode)) { + event.preventDefault(); + } + }; + + /** + * create range + * @return {WrappedRange} + */ + this.createRange = function () { + this.focus(); + return range.create(editable); + }; + + /** + * saveRange + * + * save current range + * + * @param {Boolean} [thenCollapse=false] + */ + this.saveRange = function (thenCollapse) { + lastRange = this.createRange(); + if (thenCollapse) { + lastRange.collapse().select(); + } + }; + + /** + * restoreRange + * + * restore lately range + */ + this.restoreRange = function () { + if (lastRange) { + lastRange.select(); + this.focus(); + } + }; + + this.saveTarget = function (node) { + $editable.data('target', node); + }; + + this.clearTarget = function () { + $editable.removeData('target'); + }; + + this.restoreTarget = function () { + return $editable.data('target'); + }; + + /** + * currentStyle + * + * current style + * @return {Object|Boolean} unfocus + */ + this.currentStyle = function () { + var rng = range.create(); + if (rng) { + rng = rng.normalize(); + } + return rng ? style.current(rng) : style.fromNode($editable); + }; + + /** + * style from node + * + * @param {jQuery} $node + * @return {Object} + */ + this.styleFromNode = function ($node) { + return style.fromNode($node); + }; + + /** + * undo + */ + this.undo = function () { + context.triggerEvent('before.command', $editable.html()); + history.undo(); + context.triggerEvent('change', $editable.html()); + }; + context.memo('help.undo', lang.help.undo); + + /** + * redo + */ + this.redo = function () { + context.triggerEvent('before.command', $editable.html()); + history.redo(); + context.triggerEvent('change', $editable.html()); + }; + context.memo('help.redo', lang.help.redo); + + /** + * before command + */ + var beforeCommand = this.beforeCommand = function () { + context.triggerEvent('before.command', $editable.html()); + // keep focus on editable before command execution + self.focus(); + }; + + /** + * after command + * @param {Boolean} isPreventTrigger + */ + var afterCommand = this.afterCommand = function (isPreventTrigger) { + history.recordUndo(); + if (!isPreventTrigger) { + context.triggerEvent('change', $editable.html()); + } + }; + + /* jshint ignore:start */ + // native commands(with execCommand), generate function for execCommand + var commands = ['bold', 'italic', 'underline', 'strikethrough', 'superscript', 'subscript', + 'justifyLeft', 'justifyCenter', 'justifyRight', 'justifyFull', + 'formatBlock', 'removeFormat', + 'backColor', 'foreColor', 'fontName']; + + for (var idx = 0, len = commands.length; idx < len; idx ++) { + this[commands[idx]] = (function (sCmd) { + return function (value) { + beforeCommand(); + document.execCommand(sCmd, false, value); + afterCommand(true); + }; + })(commands[idx]); + context.memo('help.' + commands[idx], lang.help[commands[idx]]); + } + /* jshint ignore:end */ + + /** + * handle tab key + */ + this.tab = function () { + var rng = this.createRange(); + if (rng.isCollapsed() && rng.isOnCell()) { + table.tab(rng); + } else { + beforeCommand(); + typing.insertTab(rng, options.tabSize); + afterCommand(); + } + }; + context.memo('help.tab', lang.help.tab); + + /** + * handle shift+tab key + */ + this.untab = function () { + var rng = this.createRange(); + if (rng.isCollapsed() && rng.isOnCell()) { + table.tab(rng, true); + } + }; + context.memo('help.untab', lang.help.untab); + + /** + * run given function between beforeCommand and afterCommand + */ + this.wrapCommand = function (fn) { + return function () { + beforeCommand(); + fn.apply(self, arguments); + afterCommand(); + }; + }; + + /** + * insert paragraph + */ + this.insertParagraph = this.wrapCommand(function () { + typing.insertParagraph(editable); + }); + context.memo('help.insertParagraph', lang.help.insertParagraph); + + this.insertOrderedList = this.wrapCommand(function () { + bullet.insertOrderedList(editable); + }); + context.memo('help.insertOrderedList', lang.help.insertOrderedList); + + this.insertUnorderedList = this.wrapCommand(function () { + bullet.insertUnorderedList(editable); + }); + context.memo('help.insertUnorderedList', lang.help.insertUnorderedList); + + this.indent = this.wrapCommand(function () { + bullet.indent(editable); + }); + context.memo('help.indent', lang.help.indent); + + this.outdent = this.wrapCommand(function () { + bullet.outdent(editable); + }); + context.memo('help.outdent', lang.help.outdent); + + /** + * insert image + * + * @param {String} src + * @param {String|Function} param + * @return {Promise} + */ + this.insertImage = function (src, param) { + return async.createImage(src, param).then(function ($image) { + beforeCommand(); + + if (typeof param === 'function') { + param($image); + } else { + if (typeof param === 'string') { + $image.attr('data-filename', param); + } + $image.css('width', Math.min($editable.width(), $image.width())); + } + + $image.show(); + range.create(editable).insertNode($image[0]); + range.createFromNodeAfter($image[0]).select(); + afterCommand(); + }).fail(function (e) { + context.triggerEvent('image.upload.error', e); + }); + }; + + /** + * insertImages + * @param {File[]} files + */ + this.insertImages = function (files) { + $.each(files, function (idx, file) { + var filename = file.name; + if (options.maximumImageFileSize && options.maximumImageFileSize < file.size) { + context.triggerEvent('image.upload.error', lang.image.maximumFileSizeError); + } else { + async.readFileAsDataURL(file).then(function (dataURL) { + return self.insertImage(dataURL, filename); + }).fail(function () { + context.triggerEvent('image.upload.error'); + }); + } + }); + }; + + /** + * insertImagesOrCallback + * @param {File[]} files + */ + this.insertImagesOrCallback = function (files) { + var callbacks = options.callbacks; + + // If onImageUpload options setted + if (callbacks.onImageUpload) { + context.triggerEvent('image.upload', files); + // else insert Image as dataURL + } else { + this.insertImages(files); + } + }; + + /** + * insertNode + * insert node + * @param {Node} node + */ + this.insertNode = this.wrapCommand(function (node) { + var rng = this.createRange(); + rng.insertNode(node); + range.createFromNodeAfter(node).select(); + }); + + /** + * insert text + * @param {String} text + */ + this.insertText = this.wrapCommand(function (text) { + var rng = this.createRange(); + var textNode = rng.insertNode(dom.createText(text)); + range.create(textNode, dom.nodeLength(textNode)).select(); + }); + + /** + * return selected plain text + * @return {String} text + */ + this.getSelectedText = function () { + var rng = this.createRange(); + + // if range on anchor, expand range with anchor + if (rng.isOnAnchor()) { + rng = range.createFromNode(dom.ancestor(rng.sc, dom.isAnchor)); + } + + return rng.toString(); + }; + + /** + * paste HTML + * @param {String} markup + */ + this.pasteHTML = this.wrapCommand(function (markup) { + var contents = this.createRange().pasteHTML(markup); + range.createFromNodeAfter(list.last(contents)).select(); + }); + + /** + * formatBlock + * + * @param {String} tagName + */ + this.formatBlock = this.wrapCommand(function (tagName) { + // [workaround] for MSIE, IE need `<` + tagName = agent.isMSIE ? '<' + tagName + '>' : tagName; + document.execCommand('FormatBlock', false, tagName); + }); + + this.formatPara = function () { + this.formatBlock('P'); + }; + context.memo('help.formatPara', lang.help.formatPara); + + /* jshint ignore:start */ + for (var idx = 1; idx <= 6; idx ++) { + this['formatH' + idx] = function (idx) { + return function () { + this.formatBlock('H' + idx); + }; + }(idx); + context.memo('help.formatH'+idx, lang.help['formatH' + idx]); + }; + /* jshint ignore:end */ + + /** + * fontSize + * + * @param {String} value - px + */ + this.fontSize = function (value) { + var rng = this.createRange(); + + if (rng && rng.isCollapsed()) { + var spans = style.styleNodes(rng); + var firstSpan = list.head(spans); + + $(spans).css({ + 'font-size': value + 'px' + }); + + // [workaround] added styled bogus span for style + // - also bogus character needed for cursor position + if (firstSpan && !dom.nodeLength(firstSpan)) { + firstSpan.innerHTML = dom.ZERO_WIDTH_NBSP_CHAR; + range.createFromNodeAfter(firstSpan.firstChild).select(); + $editable.data(KEY_BOGUS, firstSpan); + } + } else { + beforeCommand(); + $(style.styleNodes(rng)).css({ + 'font-size': value + 'px' + }); + afterCommand(); + } + }; + + /** + * insert horizontal rule + */ + this.insertHorizontalRule = this.wrapCommand(function () { + var hrNode = this.createRange().insertNode(dom.create('HR')); + if (hrNode.nextSibling) { + range.create(hrNode.nextSibling, 0).normalize().select(); + } + }); + context.memo('help.insertHorizontalRule', lang.help.insertHorizontalRule); + + /** + * remove bogus node and character + */ + this.removeBogus = function () { + var bogusNode = $editable.data(KEY_BOGUS); + if (!bogusNode) { + return; + } + + var textNode = list.find(list.from(bogusNode.childNodes), dom.isText); + + var bogusCharIdx = textNode.nodeValue.indexOf(dom.ZERO_WIDTH_NBSP_CHAR); + if (bogusCharIdx !== -1) { + textNode.deleteData(bogusCharIdx, 1); + } + + if (dom.isEmpty(bogusNode)) { + dom.remove(bogusNode); + } + + $editable.removeData(KEY_BOGUS); + }; + + /** + * lineHeight + * @param {String} value + */ + this.lineHeight = this.wrapCommand(function (value) { + style.stylePara(this.createRange(), { + lineHeight: value + }); + }); + + /** + * unlink + * + * @type command + */ + this.unlink = function () { + var rng = this.createRange(); + if (rng.isOnAnchor()) { + var anchor = dom.ancestor(rng.sc, dom.isAnchor); + rng = range.createFromNode(anchor); + rng.select(); + + beforeCommand(); + document.execCommand('unlink'); + afterCommand(); + } + }; + + /** + * create link (command) + * + * @param {Object} linkInfo + */ + this.createLink = this.wrapCommand(function (linkInfo) { + var linkUrl = linkInfo.url; + var linkText = linkInfo.text; + var isNewWindow = linkInfo.isNewWindow; + var rng = linkInfo.range || this.createRange(); + var isTextChanged = rng.toString() !== linkText; + + // handle spaced urls from input + if (typeof linkUrl === 'string') { + linkUrl = linkUrl.trim(); + } + + if (options.onCreateLink) { + linkUrl = options.onCreateLink(linkUrl); + } + + var anchors = []; + if (isTextChanged) { + rng = rng.deleteContents(); + var anchor = rng.insertNode($('<A>' + linkText + '</A>')[0]); + anchors.push(anchor); + } else { + anchors = style.styleNodes(rng, { + nodeName: 'A', + expandClosestSibling: true, + onlyPartialContains: true + }); + } + + $.each(anchors, function (idx, anchor) { + // if url doesn't match an URL schema, set http:// as default + linkUrl = /^[A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?/.test(linkUrl) ? + linkUrl : 'http://' + linkUrl; + + $(anchor).attr('href', linkUrl); + if (isNewWindow) { + $(anchor).attr('target', '_blank'); + } else { + $(anchor).removeAttr('target'); + } + }); + + var startRange = range.createFromNodeBefore(list.head(anchors)); + var startPoint = startRange.getStartPoint(); + var endRange = range.createFromNodeAfter(list.last(anchors)); + var endPoint = endRange.getEndPoint(); + + range.create( + startPoint.node, + startPoint.offset, + endPoint.node, + endPoint.offset + ).select(); + }); + + /** + * returns link info + * + * @return {Object} + * @return {WrappedRange} return.range + * @return {String} return.text + * @return {Boolean} [return.isNewWindow=true] + * @return {String} [return.url=""] + */ + this.getLinkInfo = function () { + var rng = this.createRange().expand(dom.isAnchor); + + // Get the first anchor on range(for edit). + var $anchor = $(list.head(rng.nodes(dom.isAnchor))); + + return { + range: rng, + text: rng.toString(), + isNewWindow: $anchor.length ? $anchor.attr('target') === '_blank' : false, + url: $anchor.length ? $anchor.attr('href') : '' + }; + }; + + /** + * setting color + * + * @param {Object} sObjColor color code + * @param {String} sObjColor.foreColor foreground color + * @param {String} sObjColor.backColor background color + */ + this.color = this.wrapCommand(function (colorInfo) { + var foreColor = colorInfo.foreColor; + var backColor = colorInfo.backColor; + + if (foreColor) { document.execCommand('foreColor', false, foreColor); } + if (backColor) { document.execCommand('backColor', false, backColor); } + }); + + /** + * insert Table + * + * @param {String} dimension of table (ex : "5x5") + */ + this.insertTable = this.wrapCommand(function (dim) { + var dimension = dim.split('x'); + + var rng = this.createRange().deleteContents(); + rng.insertNode(table.createTable(dimension[0], dimension[1], options)); + }); + + /** + * float me + * + * @param {String} value + */ + this.floatMe = this.wrapCommand(function (value) { + var $target = $(this.restoreTarget()); + $target.css('float', value); + }); + + /** + * resize overlay element + * @param {String} value + */ + this.resize = this.wrapCommand(function (value) { + var $target = $(this.restoreTarget()); + $target.css({ + width: value * 100 + '%', + height: '' + }); + }); + + /** + * @param {Position} pos + * @param {jQuery} $target - target element + * @param {Boolean} [bKeepRatio] - keep ratio + */ + this.resizeTo = function (pos, $target, bKeepRatio) { + var imageSize; + if (bKeepRatio) { + var newRatio = pos.y / pos.x; + var ratio = $target.data('ratio'); + imageSize = { + width: ratio > newRatio ? pos.x : pos.y / ratio, + height: ratio > newRatio ? pos.x * ratio : pos.y + }; + } else { + imageSize = { + width: pos.x, + height: pos.y + }; + } + + $target.css(imageSize); + }; + + /** + * remove media object + */ + this.removeMedia = this.wrapCommand(function () { + var $target = $(this.restoreTarget()).detach(); + context.triggerEvent('media.delete', $target, $editable); + }); + + /** + * returns whether editable area has focus or not. + */ + this.hasFocus = function () { + return $editable.is(':focus'); + }; + + /** + * set focus + */ + this.focus = function () { + // [workaround] Screen will move when page is scolled in IE. + // - do focus when not focused + if (!this.hasFocus()) { + $editable.focus(); + } + }; + + /** + * returns whether contents is empty or not. + * @return {Boolean} + */ + this.isEmpty = function () { + return dom.isEmpty($editable[0]) || dom.emptyPara === $editable.html(); + }; + + /** + * Removes all contents and restores the editable instance to an _emptyPara_. + */ + this.empty = function () { + context.invoke('code', dom.emptyPara); + }; + }; + + var Clipboard = function (context) { + var self = this; + + var $editable = context.layoutInfo.editable; + + this.events = { + 'summernote.keydown': function (we, e) { + if (self.needKeydownHook()) { + if ((e.ctrlKey || e.metaKey) && e.keyCode === key.code.V) { + context.invoke('editor.saveRange'); + self.$paste.focus(); + + setTimeout(function () { + self.pasteByHook(); + }, 0); + } + } + } + }; + + this.needKeydownHook = function () { + return (agent.isMSIE && agent.browserVersion > 10) || agent.isFF; + }; + + this.initialize = function () { + // [workaround] getting image from clipboard + // - IE11 and Firefox: CTRL+v hook + // - Webkit: event.clipboardData + if (this.needKeydownHook()) { + this.$paste = $('<div tabindex="-1" />').attr('contenteditable', true).css({ + position: 'absolute', + left: -100000, + opacity: 0 + }); + $editable.before(this.$paste); + + this.$paste.on('paste', function (event) { + context.triggerEvent('paste', event); + }); + } else { + $editable.on('paste', this.pasteByEvent); + } + }; + + this.destroy = function () { + if (this.needKeydownHook()) { + this.$paste.remove(); + this.$paste = null; + } + }; + + this.pasteByHook = function () { + var node = this.$paste[0].firstChild; + + if (dom.isImg(node)) { + var dataURI = node.src; + var decodedData = atob(dataURI.split(',')[1]); + var array = new Uint8Array(decodedData.length); + for (var i = 0; i < decodedData.length; i++) { + array[i] = decodedData.charCodeAt(i); + } + + var blob = new Blob([array], { type: 'image/png' }); + blob.name = 'clipboard.png'; + + context.invoke('editor.restoreRange'); + context.invoke('editor.focus'); + context.invoke('editor.insertImagesOrCallback', [blob]); + } else { + var pasteContent = $('<div />').html(this.$paste.html()).html(); + context.invoke('editor.restoreRange'); + context.invoke('editor.focus'); + + if (pasteContent) { + context.invoke('editor.pasteHTML', pasteContent); + } + } + + this.$paste.empty(); + }; + + /** + * paste by clipboard event + * + * @param {Event} event + */ + this.pasteByEvent = function (event) { + var clipboardData = event.originalEvent.clipboardData; + if (clipboardData && clipboardData.items && clipboardData.items.length) { + var item = list.head(clipboardData.items); + if (item.kind === 'file' && item.type.indexOf('image/') !== -1) { + context.invoke('editor.insertImagesOrCallback', [item.getAsFile()]); + } + context.invoke('editor.afterCommand'); + } + }; + }; + + var Dropzone = function (context) { + var $document = $(document); + var $editor = context.layoutInfo.editor; + var $editable = context.layoutInfo.editable; + var options = context.options; + var lang = options.langInfo; + var documentEventHandlers = {}; + + var $dropzone = $([ + '<div class="note-dropzone">', + ' <div class="note-dropzone-message"/>', + '</div>' + ].join('')).prependTo($editor); + + var detachDocumentEvent = function () { + Object.keys(documentEventHandlers).forEach(function (key) { + $document.off(key.substr(2).toLowerCase(), documentEventHandlers[key]); + }); + documentEventHandlers = {}; + }; + + /** + * attach Drag and Drop Events + */ + this.initialize = function () { + if (options.disableDragAndDrop) { + // prevent default drop event + documentEventHandlers.onDrop = function (e) { + e.preventDefault(); + }; + $document.on('drop', documentEventHandlers.onDrop); + } else { + this.attachDragAndDropEvent(); + } + }; + + /** + * attach Drag and Drop Events + */ + this.attachDragAndDropEvent = function () { + var collection = $(), + $dropzoneMessage = $dropzone.find('.note-dropzone-message'); + + documentEventHandlers.onDragenter = function (e) { + var isCodeview = context.invoke('codeview.isActivated'); + var hasEditorSize = $editor.width() > 0 && $editor.height() > 0; + if (!isCodeview && !collection.length && hasEditorSize) { + $editor.addClass('dragover'); + $dropzone.width($editor.width()); + $dropzone.height($editor.height()); + $dropzoneMessage.text(lang.image.dragImageHere); + } + collection = collection.add(e.target); + }; + + documentEventHandlers.onDragleave = function (e) { + collection = collection.not(e.target); + if (!collection.length) { + $editor.removeClass('dragover'); + } + }; + + documentEventHandlers.onDrop = function () { + collection = $(); + $editor.removeClass('dragover'); + }; + + // show dropzone on dragenter when dragging a object to document + // -but only if the editor is visible, i.e. has a positive width and height + $document.on('dragenter', documentEventHandlers.onDragenter) + .on('dragleave', documentEventHandlers.onDragleave) + .on('drop', documentEventHandlers.onDrop); + + // change dropzone's message on hover. + $dropzone.on('dragenter', function () { + $dropzone.addClass('hover'); + $dropzoneMessage.text(lang.image.dropImage); + }).on('dragleave', function () { + $dropzone.removeClass('hover'); + $dropzoneMessage.text(lang.image.dragImageHere); + }); + + // attach dropImage + $dropzone.on('drop', function (event) { + var dataTransfer = event.originalEvent.dataTransfer; + + if (dataTransfer && dataTransfer.files && dataTransfer.files.length) { + event.preventDefault(); + $editable.focus(); + context.invoke('editor.insertImagesOrCallback', dataTransfer.files); + } else { + $.each(dataTransfer.types, function (idx, type) { + var content = dataTransfer.getData(type); + + if (type.toLowerCase().indexOf('text') > -1) { + context.invoke('editor.pasteHTML', content); + } else { + $(content).each(function () { + context.invoke('editor.insertNode', this); + }); + } + }); + } + }).on('dragover', false); // prevent default dragover event + }; + + this.destroy = function () { + detachDocumentEvent(); + }; + }; + + + var CodeMirror; + if (agent.hasCodeMirror) { + if (agent.isSupportAmd) { + require(['codemirror'], function (cm) { + CodeMirror = cm; + }); + } else { + CodeMirror = window.CodeMirror; + } + } + + /** + * @class Codeview + */ + var Codeview = function (context) { + var $editor = context.layoutInfo.editor; + var $editable = context.layoutInfo.editable; + var $codable = context.layoutInfo.codable; + var options = context.options; + + this.sync = function () { + var isCodeview = this.isActivated(); + if (isCodeview && agent.hasCodeMirror) { + $codable.data('cmEditor').save(); + } + }; + + /** + * @return {Boolean} + */ + this.isActivated = function () { + return $editor.hasClass('codeview'); + }; + + /** + * toggle codeview + */ + this.toggle = function () { + if (this.isActivated()) { + this.deactivate(); + } else { + this.activate(); + } + context.triggerEvent('codeview.toggled'); + }; + + /** + * activate code view + */ + this.activate = function () { + $codable.val(dom.html($editable, options.prettifyHtml)); + $codable.height($editable.height()); + + context.invoke('toolbar.updateCodeview', true); + $editor.addClass('codeview'); + $codable.focus(); + + // activate CodeMirror as codable + if (agent.hasCodeMirror) { + var cmEditor = CodeMirror.fromTextArea($codable[0], options.codemirror); + + // CodeMirror TernServer + if (options.codemirror.tern) { + var server = new CodeMirror.TernServer(options.codemirror.tern); + cmEditor.ternServer = server; + cmEditor.on('cursorActivity', function (cm) { + server.updateArgHints(cm); + }); + } + + // CodeMirror hasn't Padding. + cmEditor.setSize(null, $editable.outerHeight()); + $codable.data('cmEditor', cmEditor); + } + }; + + /** + * deactivate code view + */ + this.deactivate = function () { + // deactivate CodeMirror as codable + if (agent.hasCodeMirror) { + var cmEditor = $codable.data('cmEditor'); + $codable.val(cmEditor.getValue()); + cmEditor.toTextArea(); + } + + var value = dom.value($codable, options.prettifyHtml) || dom.emptyPara; + var isChange = $editable.html() !== value; + + $editable.html(value); + $editable.height(options.height ? $codable.height() : 'auto'); + $editor.removeClass('codeview'); + + if (isChange) { + context.triggerEvent('change', $editable.html(), $editable); + } + + $editable.focus(); + + context.invoke('toolbar.updateCodeview', false); + }; + + this.destroy = function () { + if (this.isActivated()) { + this.deactivate(); + } + }; + }; + + var EDITABLE_PADDING = 24; + + var Statusbar = function (context) { + var $document = $(document); + var $statusbar = context.layoutInfo.statusbar; + var $editable = context.layoutInfo.editable; + var options = context.options; + + this.initialize = function () { + if (options.airMode || options.disableResizeEditor) { + return; + } + + $statusbar.on('mousedown', function (event) { + event.preventDefault(); + event.stopPropagation(); + + var editableTop = $editable.offset().top - $document.scrollTop(); + + $document.on('mousemove', function (event) { + var height = event.clientY - (editableTop + EDITABLE_PADDING); + + height = (options.minheight > 0) ? Math.max(height, options.minheight) : height; + height = (options.maxHeight > 0) ? Math.min(height, options.maxHeight) : height; + + $editable.height(height); + }).one('mouseup', function () { + $document.off('mousemove'); + }); + }); + }; + + this.destroy = function () { + $statusbar.off(); + $statusbar.remove(); + }; + }; + + var Fullscreen = function (context) { + var $editor = context.layoutInfo.editor; + var $toolbar = context.layoutInfo.toolbar; + var $editable = context.layoutInfo.editable; + var $codable = context.layoutInfo.codable; + + var $window = $(window); + var $scrollbar = $('html, body'); + + /** + * toggle fullscreen + */ + this.toggle = function () { + var resize = function (size) { + $editable.css('height', size.h); + $codable.css('height', size.h); + if ($codable.data('cmeditor')) { + $codable.data('cmeditor').setsize(null, size.h); + } + }; + + $editor.toggleClass('fullscreen'); + if (this.isFullscreen()) { + $editable.data('orgHeight', $editable.css('height')); + + $window.on('resize', function () { + resize({ + h: $window.height() - $toolbar.outerHeight() + }); + }).trigger('resize'); + + $scrollbar.css('overflow', 'hidden'); + } else { + $window.off('resize'); + resize({ + h: $editable.data('orgHeight') + }); + $scrollbar.css('overflow', 'visible'); + } + + context.invoke('toolbar.updateFullscreen', this.isFullscreen()); + }; + + this.isFullscreen = function () { + return $editor.hasClass('fullscreen'); + }; + }; + + var Handle = function (context) { + var self = this; + + var $document = $(document); + var $editingArea = context.layoutInfo.editingArea; + var options = context.options; + + this.events = { + 'summernote.mousedown': function (we, e) { + if (self.update(e.target)) { + e.preventDefault(); + } + }, + 'summernote.keyup summernote.scroll summernote.change summernote.dialog.shown': function () { + self.update(); + } + }; + + this.initialize = function () { + this.$handle = $([ + '<div class="note-handle">', + '<div class="note-control-selection">', + '<div class="note-control-selection-bg"></div>', + '<div class="note-control-holder note-control-nw"></div>', + '<div class="note-control-holder note-control-ne"></div>', + '<div class="note-control-holder note-control-sw"></div>', + '<div class="', + (options.disableResizeImage ? 'note-control-holder' : 'note-control-sizing'), + ' note-control-se"></div>', + (options.disableResizeImage ? '' : '<div class="note-control-selection-info"></div>'), + '</div>', + '</div>' + ].join('')).prependTo($editingArea); + + this.$handle.on('mousedown', function (event) { + if (dom.isControlSizing(event.target)) { + event.preventDefault(); + event.stopPropagation(); + + var $target = self.$handle.find('.note-control-selection').data('target'), + posStart = $target.offset(), + scrollTop = $document.scrollTop(); + + $document.on('mousemove', function (event) { + context.invoke('editor.resizeTo', { + x: event.clientX - posStart.left, + y: event.clientY - (posStart.top - scrollTop) + }, $target, !event.shiftKey); + + self.update($target[0]); + }).one('mouseup', function (e) { + e.preventDefault(); + $document.off('mousemove'); + context.invoke('editor.afterCommand'); + }); + + if (!$target.data('ratio')) { // original ratio. + $target.data('ratio', $target.height() / $target.width()); + } + } + }); + }; + + this.destroy = function () { + this.$handle.remove(); + }; + + this.update = function (target) { + var isImage = dom.isImg(target); + var $selection = this.$handle.find('.note-control-selection'); + + context.invoke('imagePopover.update', target); + + if (isImage) { + var $image = $(target); + var pos = $image.position(); + + // include margin + var imageSize = { + w: $image.outerWidth(true), + h: $image.outerHeight(true) + }; + + $selection.css({ + display: 'block', + left: pos.left, + top: pos.top, + width: imageSize.w, + height: imageSize.h + }).data('target', $image); // save current image element. + + var sizingText = imageSize.w + 'x' + imageSize.h; + $selection.find('.note-control-selection-info').text(sizingText); + context.invoke('editor.saveTarget', target); + } else { + this.hide(); + } + + return isImage; + }; + + /** + * hide + * + * @param {jQuery} $handle + */ + this.hide = function () { + context.invoke('editor.clearTarget'); + this.$handle.children().hide(); + }; + }; + + var AutoLink = function (context) { + var self = this; + var defaultScheme = 'http://'; + var linkPattern = /^([A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?|mailto:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i; + + this.events = { + 'summernote.keyup': function (we, e) { + if (!e.isDefaultPrevented()) { + self.handleKeyup(e); + } + }, + 'summernote.keydown': function (we, e) { + self.handleKeydown(e); + } + }; + + this.initialize = function () { + this.lastWordRange = null; + }; + + this.destroy = function () { + this.lastWordRange = null; + }; + + this.replace = function () { + if (!this.lastWordRange) { + return; + } + + var keyword = this.lastWordRange.toString(); + var match = keyword.match(linkPattern); + + if (match && (match[1] || match[2])) { + var link = match[1] ? keyword : defaultScheme + keyword; + var node = $('<a />').html(keyword).attr('href', link)[0]; + + this.lastWordRange.insertNode(node); + this.lastWordRange = null; + context.invoke('editor.focus'); + } + + }; + + this.handleKeydown = function (e) { + if (list.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) { + var wordRange = context.invoke('editor.createRange').getWordRange(); + this.lastWordRange = wordRange; + } + }; + + this.handleKeyup = function (e) { + if (list.contains([key.code.ENTER, key.code.SPACE], e.keyCode)) { + this.replace(); + } + }; + }; + + /** + * textarea auto sync. + */ + var AutoSync = function (context) { + var $note = context.layoutInfo.note; + + this.events = { + 'summernote.change': function () { + $note.val(context.invoke('code')); + } + }; + + this.shouldInitialize = function () { + return dom.isTextarea($note[0]); + }; + }; + + var Placeholder = function (context) { + var self = this; + var $editingArea = context.layoutInfo.editingArea; + var options = context.options; + + this.events = { + 'summernote.init summernote.change': function () { + self.update(); + }, + 'summernote.codeview.toggled': function () { + self.update(); + } + }; + + this.shouldInitialize = function () { + return !!options.placeholder; + }; + + this.initialize = function () { + this.$placeholder = $('<div class="note-placeholder">'); + this.$placeholder.on('click', function () { + context.invoke('focus'); + }).text(options.placeholder).prependTo($editingArea); + }; + + this.destroy = function () { + this.$placeholder.remove(); + }; + + this.update = function () { + var isShow = !context.invoke('codeview.isActivated') && context.invoke('editor.isEmpty'); + this.$placeholder.toggle(isShow); + }; + }; + + var Buttons = function (context) { + var self = this; + var ui = $.summernote.ui; + + var $toolbar = context.layoutInfo.toolbar; + var options = context.options; + var lang = options.langInfo; + + var invertedKeyMap = func.invertObject(options.keyMap[agent.isMac ? 'mac' : 'pc']); + + var representShortcut = this.representShortcut = function (editorMethod) { + var shortcut = invertedKeyMap[editorMethod]; + if (!options.shortcuts || !shortcut) { + return ''; + } + + if (agent.isMac) { + shortcut = shortcut.replace('CMD', '⌘').replace('SHIFT', '⇧'); + } + + shortcut = shortcut.replace('BACKSLASH', '\\') + .replace('SLASH', '/') + .replace('LEFTBRACKET', '[') + .replace('RIGHTBRACKET', ']'); + + return ' (' + shortcut + ')'; + }; + + this.initialize = function () { + this.addToolbarButtons(); + this.addImagePopoverButtons(); + this.addLinkPopoverButtons(); + this.fontInstalledMap = {}; + }; + + this.destroy = function () { + delete this.fontInstalledMap; + }; + + this.isFontInstalled = function (name) { + if (!self.fontInstalledMap.hasOwnProperty(name)) { + self.fontInstalledMap[name] = agent.isFontInstalled(name) || + list.contains(options.fontNamesIgnoreCheck, name); + } + + return self.fontInstalledMap[name]; + }; + + this.addToolbarButtons = function () { + context.memo('button.style', function () { + return ui.buttonGroup([ + ui.button({ + className: 'dropdown-toggle', + contents: ui.icon(options.icons.magic) + ' ' + ui.icon(options.icons.caret, 'span'), + tooltip: lang.style.style, + data: { + toggle: 'dropdown' + } + }), + ui.dropdown({ + className: 'dropdown-style', + items: context.options.styleTags, + template: function (item) { + + if (typeof item === 'string') { + item = { tag: item, title: (lang.style.hasOwnProperty(item) ? lang.style[item] : item) }; + } + + var tag = item.tag; + var title = item.title; + var style = item.style ? ' style="' + item.style + '" ' : ''; + var className = item.className ? ' class="' + item.className + '"' : ''; + + return '<' + tag + style + className + '>' + title + '</' + tag + '>'; + }, + click: context.createInvokeHandler('editor.formatBlock') + }) + ]).render(); + }); + + context.memo('button.bold', function () { + return ui.button({ + className: 'note-btn-bold', + contents: ui.icon(options.icons.bold), + tooltip: lang.font.bold + representShortcut('bold'), + click: context.createInvokeHandler('editor.bold') + }).render(); + }); + + context.memo('button.italic', function () { + return ui.button({ + className: 'note-btn-italic', + contents: ui.icon(options.icons.italic), + tooltip: lang.font.italic + representShortcut('italic'), + click: context.createInvokeHandler('editor.italic') + }).render(); + }); + + context.memo('button.underline', function () { + return ui.button({ + className: 'note-btn-underline', + contents: ui.icon(options.icons.underline), + tooltip: lang.font.underline + representShortcut('underline'), + click: context.createInvokeHandler('editor.underline') + }).render(); + }); + + context.memo('button.clear', function () { + return ui.button({ + contents: ui.icon(options.icons.eraser), + tooltip: lang.font.clear + representShortcut('removeFormat'), + click: context.createInvokeHandler('editor.removeFormat') + }).render(); + }); + + context.memo('button.strikethrough', function () { + return ui.button({ + className: 'note-btn-strikethrough', + contents: ui.icon(options.icons.strikethrough), + tooltip: lang.font.strikethrough + representShortcut('strikethrough'), + click: context.createInvokeHandler('editor.strikethrough') + }).render(); + }); + + context.memo('button.superscript', function () { + return ui.button({ + className: 'note-btn-superscript', + contents: ui.icon(options.icons.superscript), + tooltip: lang.font.superscript, + click: context.createInvokeHandler('editor.superscript') + }).render(); + }); + + context.memo('button.subscript', function () { + return ui.button({ + className: 'note-btn-subscript', + contents: ui.icon(options.icons.subscript), + tooltip: lang.font.subscript, + click: context.createInvokeHandler('editor.subscript') + }).render(); + }); + + context.memo('button.fontname', function () { + return ui.buttonGroup([ + ui.button({ + className: 'dropdown-toggle', + contents: '<span class="note-current-fontname"/> ' + ui.icon(options.icons.caret, 'span'), + tooltip: lang.font.name, + data: { + toggle: 'dropdown' + } + }), + ui.dropdownCheck({ + className: 'dropdown-fontname', + checkClassName: options.icons.menuCheck, + items: options.fontNames.filter(self.isFontInstalled), + template: function (item) { + return '<span style="font-family:' + item + '">' + item + '</span>'; + }, + click: context.createInvokeHandler('editor.fontName') + }) + ]).render(); + }); + + context.memo('button.fontsize', function () { + return ui.buttonGroup([ + ui.button({ + className: 'dropdown-toggle', + contents: '<span class="note-current-fontsize"/>' + ui.icon(options.icons.caret, 'span'), + tooltip: lang.font.size, + data: { + toggle: 'dropdown' + } + }), + ui.dropdownCheck({ + className: 'dropdown-fontsize', + checkClassName: options.icons.menuCheck, + items: options.fontSizes, + click: context.createInvokeHandler('editor.fontSize') + }) + ]).render(); + }); + + context.memo('button.color', function () { + return ui.buttonGroup({ + className: 'note-color', + children: [ + ui.button({ + className: 'note-current-color-button', + contents: ui.icon(options.icons.font + ' note-recent-color'), + tooltip: lang.color.recent, + click: function (e) { + var $button = $(e.currentTarget); + context.invoke('editor.color', { + backColor: $button.attr('data-backColor'), + foreColor: $button.attr('data-foreColor') + }); + }, + callback: function ($button) { + var $recentColor = $button.find('.note-recent-color'); + $recentColor.css('background-color', '#FFFF00'); + $button.attr('data-backColor', '#FFFF00'); + } + }), + ui.button({ + className: 'dropdown-toggle', + contents: ui.icon(options.icons.caret, 'span'), + tooltip: lang.color.more, + data: { + toggle: 'dropdown' + } + }), + ui.dropdown({ + items: [ + '<li>', + '<div class="btn-group">', + ' <div class="note-palette-title">' + lang.color.background + '</div>', + ' <div>', + ' <button type="button" class="note-color-reset btn btn-default" data-event="backColor" data-value="inherit">', + lang.color.transparent, + ' </button>', + ' </div>', + ' <div class="note-holder" data-event="backColor"/>', + '</div>', + '<div class="btn-group">', + ' <div class="note-palette-title">' + lang.color.foreground + '</div>', + ' <div>', + ' <button type="button" class="note-color-reset btn btn-default" data-event="removeFormat" data-value="foreColor">', + lang.color.resetToDefault, + ' </button>', + ' </div>', + ' <div class="note-holder" data-event="foreColor"/>', + '</div>', + '</li>' + ].join(''), + callback: function ($dropdown) { + $dropdown.find('.note-holder').each(function () { + var $holder = $(this); + $holder.append(ui.palette({ + colors: options.colors, + eventName: $holder.data('event') + }).render()); + }); + }, + click: function (event) { + var $button = $(event.target); + var eventName = $button.data('event'); + var value = $button.data('value'); + + if (eventName && value) { + var key = eventName === 'backColor' ? 'background-color' : 'color'; + var $color = $button.closest('.note-color').find('.note-recent-color'); + var $currentButton = $button.closest('.note-color').find('.note-current-color-button'); + + $color.css(key, value); + $currentButton.attr('data-' + eventName, value); + context.invoke('editor.' + eventName, value); + } + } + }) + ] + }).render(); + }); + + context.memo('button.ul', function () { + return ui.button({ + contents: ui.icon(options.icons.unorderedlist), + tooltip: lang.lists.unordered + representShortcut('insertUnorderedList'), + click: context.createInvokeHandler('editor.insertUnorderedList') + }).render(); + }); + + context.memo('button.ol', function () { + return ui.button({ + contents: ui.icon(options.icons.orderedlist), + tooltip: lang.lists.ordered + representShortcut('insertOrderedList'), + click: context.createInvokeHandler('editor.insertOrderedList') + }).render(); + }); + + var justifyLeft = ui.button({ + contents: ui.icon(options.icons.alignLeft), + tooltip: lang.paragraph.left + representShortcut('justifyLeft'), + click: context.createInvokeHandler('editor.justifyLeft') + }); + + var justifyCenter = ui.button({ + contents: ui.icon(options.icons.alignCenter), + tooltip: lang.paragraph.center + representShortcut('justifyCenter'), + click: context.createInvokeHandler('editor.justifyCenter') + }); + + var justifyRight = ui.button({ + contents: ui.icon(options.icons.alignRight), + tooltip: lang.paragraph.right + representShortcut('justifyRight'), + click: context.createInvokeHandler('editor.justifyRight') + }); + + var justifyFull = ui.button({ + contents: ui.icon(options.icons.alignJustify), + tooltip: lang.paragraph.justify + representShortcut('justifyFull'), + click: context.createInvokeHandler('editor.justifyFull') + }); + + var outdent = ui.button({ + contents: ui.icon(options.icons.outdent), + tooltip: lang.paragraph.outdent + representShortcut('outdent'), + click: context.createInvokeHandler('editor.outdent') + }); + + var indent = ui.button({ + contents: ui.icon(options.icons.indent), + tooltip: lang.paragraph.indent + representShortcut('indent'), + click: context.createInvokeHandler('editor.indent') + }); + + context.memo('button.justifyLeft', func.invoke(justifyLeft, 'render')); + context.memo('button.justifyCenter', func.invoke(justifyCenter, 'render')); + context.memo('button.justifyRight', func.invoke(justifyRight, 'render')); + context.memo('button.justifyFull', func.invoke(justifyFull, 'render')); + context.memo('button.outdent', func.invoke(outdent, 'render')); + context.memo('button.indent', func.invoke(indent, 'render')); + + context.memo('button.paragraph', function () { + return ui.buttonGroup([ + ui.button({ + className: 'dropdown-toggle', + contents: ui.icon(options.icons.alignLeft) + ' ' + ui.icon(options.icons.caret, 'span'), + tooltip: lang.paragraph.paragraph, + data: { + toggle: 'dropdown' + } + }), + ui.dropdown([ + ui.buttonGroup({ + className: 'note-align', + children: [justifyLeft, justifyCenter, justifyRight, justifyFull] + }), + ui.buttonGroup({ + className: 'note-list', + children: [outdent, indent] + }) + ]) + ]).render(); + }); + + context.memo('button.height', function () { + return ui.buttonGroup([ + ui.button({ + className: 'dropdown-toggle', + contents: ui.icon(options.icons.textHeight) + ' ' + ui.icon(options.icons.caret, 'span'), + tooltip: lang.font.height, + data: { + toggle: 'dropdown' + } + }), + ui.dropdownCheck({ + items: options.lineHeights, + checkClassName: options.icons.menuCheck, + className: 'dropdown-line-height', + click: context.createInvokeHandler('editor.lineHeight') + }) + ]).render(); + }); + + context.memo('button.table', function () { + return ui.buttonGroup([ + ui.button({ + className: 'dropdown-toggle', + contents: ui.icon(options.icons.table) + ' ' + ui.icon(options.icons.caret, 'span'), + tooltip: lang.table.table, + data: { + toggle: 'dropdown' + } + }), + ui.dropdown({ + className: 'note-table', + items: [ + '<div class="note-dimension-picker">', + ' <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>', + ' <div class="note-dimension-picker-highlighted"/>', + ' <div class="note-dimension-picker-unhighlighted"/>', + '</div>', + '<div class="note-dimension-display">1 x 1</div>' + ].join('') + }) + ], { + callback: function ($node) { + var $catcher = $node.find('.note-dimension-picker-mousecatcher'); + $catcher.css({ + width: options.insertTableMaxSize.col + 'em', + height: options.insertTableMaxSize.row + 'em' + }).mousedown(context.createInvokeHandler('editor.insertTable')) + .on('mousemove', self.tableMoveHandler); + } + }).render(); + }); + + context.memo('button.link', function () { + return ui.button({ + contents: ui.icon(options.icons.link), + tooltip: lang.link.link + representShortcut('linkDialog.show'), + click: context.createInvokeHandler('linkDialog.show') + }).render(); + }); + + context.memo('button.picture', function () { + return ui.button({ + contents: ui.icon(options.icons.picture), + tooltip: lang.image.image, + click: context.createInvokeHandler('imageDialog.show') + }).render(); + }); + + context.memo('button.video', function () { + return ui.button({ + contents: ui.icon(options.icons.video), + tooltip: lang.video.video, + click: context.createInvokeHandler('videoDialog.show') + }).render(); + }); + + context.memo('button.hr', function () { + return ui.button({ + contents: ui.icon(options.icons.minus), + tooltip: lang.hr.insert + representShortcut('insertHorizontalRule'), + click: context.createInvokeHandler('editor.insertHorizontalRule') + }).render(); + }); + + context.memo('button.fullscreen', function () { + return ui.button({ + className: 'btn-fullscreen', + contents: ui.icon(options.icons.arrowsAlt), + tooltip: lang.options.fullscreen, + click: context.createInvokeHandler('fullscreen.toggle') + }).render(); + }); + + context.memo('button.codeview', function () { + return ui.button({ + className: 'btn-codeview', + contents: ui.icon(options.icons.code), + tooltip: lang.options.codeview, + click: context.createInvokeHandler('codeview.toggle') + }).render(); + }); + + context.memo('button.redo', function () { + return ui.button({ + contents: ui.icon(options.icons.redo), + tooltip: lang.history.redo + representShortcut('redo'), + click: context.createInvokeHandler('editor.redo') + }).render(); + }); + + context.memo('button.undo', function () { + return ui.button({ + contents: ui.icon(options.icons.undo), + tooltip: lang.history.undo + representShortcut('undo'), + click: context.createInvokeHandler('editor.undo') + }).render(); + }); + + context.memo('button.help', function () { + return ui.button({ + contents: ui.icon(options.icons.question), + tooltip: lang.options.help, + click: context.createInvokeHandler('helpDialog.show') + }).render(); + }); + }; + + /** + * image : [ + * ['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']], + * ['float', ['floatLeft', 'floatRight', 'floatNone' ]], + * ['remove', ['removeMedia']] + * ], + */ + this.addImagePopoverButtons = function () { + // Image Size Buttons + context.memo('button.imageSize100', function () { + return ui.button({ + contents: '<span class="note-fontsize-10">100%</span>', + tooltip: lang.image.resizeFull, + click: context.createInvokeHandler('editor.resize', '1') + }).render(); + }); + context.memo('button.imageSize50', function () { + return ui.button({ + contents: '<span class="note-fontsize-10">50%</span>', + tooltip: lang.image.resizeHalf, + click: context.createInvokeHandler('editor.resize', '0.5') + }).render(); + }); + context.memo('button.imageSize25', function () { + return ui.button({ + contents: '<span class="note-fontsize-10">25%</span>', + tooltip: lang.image.resizeQuarter, + click: context.createInvokeHandler('editor.resize', '0.25') + }).render(); + }); + + // Float Buttons + context.memo('button.floatLeft', function () { + return ui.button({ + contents: ui.icon(options.icons.alignLeft), + tooltip: lang.image.floatLeft, + click: context.createInvokeHandler('editor.floatMe', 'left') + }).render(); + }); + + context.memo('button.floatRight', function () { + return ui.button({ + contents: ui.icon(options.icons.alignRight), + tooltip: lang.image.floatRight, + click: context.createInvokeHandler('editor.floatMe', 'right') + }).render(); + }); + + context.memo('button.floatNone', function () { + return ui.button({ + contents: ui.icon(options.icons.alignJustify), + tooltip: lang.image.floatNone, + click: context.createInvokeHandler('editor.floatMe', 'none') + }).render(); + }); + + // Remove Buttons + context.memo('button.removeMedia', function () { + return ui.button({ + contents: ui.icon(options.icons.trash), + tooltip: lang.image.remove, + click: context.createInvokeHandler('editor.removeMedia') + }).render(); + }); + }; + + this.addLinkPopoverButtons = function () { + context.memo('button.linkDialogShow', function () { + return ui.button({ + contents: ui.icon(options.icons.link), + tooltip: lang.link.edit, + click: context.createInvokeHandler('linkDialog.show') + }).render(); + }); + + context.memo('button.unlink', function () { + return ui.button({ + contents: ui.icon(options.icons.unlink), + tooltip: lang.link.unlink, + click: context.createInvokeHandler('editor.unlink') + }).render(); + }); + }; + + this.build = function ($container, groups) { + for (var groupIdx = 0, groupLen = groups.length; groupIdx < groupLen; groupIdx++) { + var group = groups[groupIdx]; + var groupName = group[0]; + var buttons = group[1]; + + var $group = ui.buttonGroup({ + className: 'note-' + groupName + }).render(); + + for (var idx = 0, len = buttons.length; idx < len; idx++) { + var button = context.memo('button.' + buttons[idx]); + if (button) { + $group.append(typeof button === 'function' ? button(context) : button); + } + } + $group.appendTo($container); + } + }; + + this.updateCurrentStyle = function () { + var styleInfo = context.invoke('editor.currentStyle'); + this.updateBtnStates({ + '.note-btn-bold': function () { + return styleInfo['font-bold'] === 'bold'; + }, + '.note-btn-italic': function () { + return styleInfo['font-italic'] === 'italic'; + }, + '.note-btn-underline': function () { + return styleInfo['font-underline'] === 'underline'; + }, + '.note-btn-subscript': function () { + return styleInfo['font-subscript'] === 'subscript'; + }, + '.note-btn-superscript': function () { + return styleInfo['font-superscript'] === 'superscript'; + }, + '.note-btn-strikethrough': function () { + return styleInfo['font-strikethrough'] === 'strikethrough'; + } + }); + + if (styleInfo['font-family']) { + var fontNames = styleInfo['font-family'].split(',').map(function (name) { + return name.replace(/[\'\"]/g, '') + .replace(/\s+$/, '') + .replace(/^\s+/, ''); + }); + var fontName = list.find(fontNames, self.isFontInstalled); + + $toolbar.find('.dropdown-fontname li a').each(function () { + // always compare string to avoid creating another func. + var isChecked = ($(this).data('value') + '') === (fontName + ''); + this.className = isChecked ? 'checked' : ''; + }); + $toolbar.find('.note-current-fontname').text(fontName); + } + + if (styleInfo['font-size']) { + var fontSize = styleInfo['font-size']; + $toolbar.find('.dropdown-fontsize li a').each(function () { + // always compare with string to avoid creating another func. + var isChecked = ($(this).data('value') + '') === (fontSize + ''); + this.className = isChecked ? 'checked' : ''; + }); + $toolbar.find('.note-current-fontsize').text(fontSize); + } + + if (styleInfo['line-height']) { + var lineHeight = styleInfo['line-height']; + $toolbar.find('.dropdown-line-height li a').each(function () { + // always compare with string to avoid creating another func. + var isChecked = ($(this).data('value') + '') === (lineHeight + ''); + this.className = isChecked ? 'checked' : ''; + }); + } + }; + + this.updateBtnStates = function (infos) { + $.each(infos, function (selector, pred) { + ui.toggleBtnActive($toolbar.find(selector), pred()); + }); + }; + + this.tableMoveHandler = function (event) { + var PX_PER_EM = 18; + var $picker = $(event.target.parentNode); // target is mousecatcher + var $dimensionDisplay = $picker.next(); + var $catcher = $picker.find('.note-dimension-picker-mousecatcher'); + var $highlighted = $picker.find('.note-dimension-picker-highlighted'); + var $unhighlighted = $picker.find('.note-dimension-picker-unhighlighted'); + + var posOffset; + // HTML5 with jQuery - e.offsetX is undefined in Firefox + if (event.offsetX === undefined) { + var posCatcher = $(event.target).offset(); + posOffset = { + x: event.pageX - posCatcher.left, + y: event.pageY - posCatcher.top + }; + } else { + posOffset = { + x: event.offsetX, + y: event.offsetY + }; + } + + var dim = { + c: Math.ceil(posOffset.x / PX_PER_EM) || 1, + r: Math.ceil(posOffset.y / PX_PER_EM) || 1 + }; + + $highlighted.css({ width: dim.c + 'em', height: dim.r + 'em' }); + $catcher.data('value', dim.c + 'x' + dim.r); + + if (3 < dim.c && dim.c < options.insertTableMaxSize.col) { + $unhighlighted.css({ width: dim.c + 1 + 'em'}); + } + + if (3 < dim.r && dim.r < options.insertTableMaxSize.row) { + $unhighlighted.css({ height: dim.r + 1 + 'em'}); + } + + $dimensionDisplay.html(dim.c + ' x ' + dim.r); + }; + }; + + var Toolbar = function (context) { + var ui = $.summernote.ui; + + var $note = context.layoutInfo.note; + var $toolbar = context.layoutInfo.toolbar; + var options = context.options; + + this.shouldInitialize = function () { + return !options.airMode; + }; + + this.initialize = function () { + options.toolbar = options.toolbar || []; + + if (!options.toolbar.length) { + $toolbar.hide(); + } else { + context.invoke('buttons.build', $toolbar, options.toolbar); + } + + if (options.toolbarContainer) { + $toolbar.appendTo(options.toolbarContainer); + } + + $note.on('summernote.keyup summernote.mouseup summernote.change', function () { + context.invoke('buttons.updateCurrentStyle'); + }); + + context.invoke('buttons.updateCurrentStyle'); + }; + + this.destroy = function () { + $toolbar.children().remove(); + }; + + this.updateFullscreen = function (isFullscreen) { + ui.toggleBtnActive($toolbar.find('.btn-fullscreen'), isFullscreen); + }; + + this.updateCodeview = function (isCodeview) { + ui.toggleBtnActive($toolbar.find('.btn-codeview'), isCodeview); + if (isCodeview) { + this.deactivate(); + } else { + this.activate(); + } + }; + + this.activate = function (isIncludeCodeview) { + var $btn = $toolbar.find('button'); + if (!isIncludeCodeview) { + $btn = $btn.not('.btn-codeview'); + } + ui.toggleBtn($btn, true); + }; + + this.deactivate = function (isIncludeCodeview) { + var $btn = $toolbar.find('button'); + if (!isIncludeCodeview) { + $btn = $btn.not('.btn-codeview'); + } + ui.toggleBtn($btn, false); + }; + }; + + var LinkDialog = function (context) { + var self = this; + var ui = $.summernote.ui; + + var $editor = context.layoutInfo.editor; + var options = context.options; + var lang = options.langInfo; + + this.initialize = function () { + var $container = options.dialogsInBody ? $(document.body) : $editor; + + var body = '<div class="form-group">' + + '<label>' + lang.link.textToDisplay + '</label>' + + '<input class="note-link-text form-control" type="text" />' + + '</div>' + + '<div class="form-group">' + + '<label>' + lang.link.url + '</label>' + + '<input class="note-link-url form-control" type="text" value="http://" />' + + '</div>' + + (!options.disableLinkTarget ? + '<div class="checkbox">' + + '<label>' + '<input type="checkbox" checked> ' + lang.link.openInNewWindow + '</label>' + + '</div>' : '' + ); + var footer = '<button href="#" class="btn btn-primary note-link-btn disabled" disabled>' + lang.link.insert + '</button>'; + + this.$dialog = ui.dialog({ + className: 'link-dialog', + title: lang.link.insert, + fade: options.dialogsFade, + body: body, + footer: footer + }).render().appendTo($container); + }; + + this.destroy = function () { + ui.hideDialog(this.$dialog); + this.$dialog.remove(); + }; + + this.bindEnterKey = function ($input, $btn) { + $input.on('keypress', function (event) { + if (event.keyCode === key.code.ENTER) { + $btn.trigger('click'); + } + }); + }; + + /** + * toggle update button + */ + this.toggleLinkBtn = function ($linkBtn, $linkText, $linkUrl) { + ui.toggleBtn($linkBtn, $linkText.val() && $linkUrl.val()); + }; + + /** + * Show link dialog and set event handlers on dialog controls. + * + * @param {Object} linkInfo + * @return {Promise} + */ + this.showLinkDialog = function (linkInfo) { + return $.Deferred(function (deferred) { + var $linkText = self.$dialog.find('.note-link-text'), + $linkUrl = self.$dialog.find('.note-link-url'), + $linkBtn = self.$dialog.find('.note-link-btn'), + $openInNewWindow = self.$dialog.find('input[type=checkbox]'); + + ui.onDialogShown(self.$dialog, function () { + context.triggerEvent('dialog.shown'); + + // if no url was given, copy text to url + if (!linkInfo.url) { + linkInfo.url = linkInfo.text; + } + + $linkText.val(linkInfo.text); + + var handleLinkTextUpdate = function () { + self.toggleLinkBtn($linkBtn, $linkText, $linkUrl); + // if linktext was modified by keyup, + // stop cloning text from linkUrl + linkInfo.text = $linkText.val(); + }; + + $linkText.on('input', handleLinkTextUpdate).on('paste', function () { + setTimeout(handleLinkTextUpdate, 0); + }); + + var handleLinkUrlUpdate = function () { + self.toggleLinkBtn($linkBtn, $linkText, $linkUrl); + // display same link on `Text to display` input + // when create a new link + if (!linkInfo.text) { + $linkText.val($linkUrl.val()); + } + }; + + $linkUrl.on('input', handleLinkUrlUpdate).on('paste', function () { + setTimeout(handleLinkUrlUpdate, 0); + }).val(linkInfo.url).trigger('focus'); + + self.toggleLinkBtn($linkBtn, $linkText, $linkUrl); + self.bindEnterKey($linkUrl, $linkBtn); + self.bindEnterKey($linkText, $linkBtn); + + $openInNewWindow.prop('checked', linkInfo.isNewWindow); + + $linkBtn.one('click', function (event) { + event.preventDefault(); + + deferred.resolve({ + range: linkInfo.range, + url: $linkUrl.val(), + text: $linkText.val(), + isNewWindow: $openInNewWindow.is(':checked') + }); + self.$dialog.modal('hide'); + }); + }); + + ui.onDialogHidden(self.$dialog, function () { + // detach events + $linkText.off('input paste keypress'); + $linkUrl.off('input paste keypress'); + $linkBtn.off('click'); + + if (deferred.state() === 'pending') { + deferred.reject(); + } + }); + + ui.showDialog(self.$dialog); + }).promise(); + }; + + /** + * @param {Object} layoutInfo + */ + this.show = function () { + var linkInfo = context.invoke('editor.getLinkInfo'); + + context.invoke('editor.saveRange'); + this.showLinkDialog(linkInfo).then(function (linkInfo) { + context.invoke('editor.restoreRange'); + context.invoke('editor.createLink', linkInfo); + }).fail(function () { + context.invoke('editor.restoreRange'); + }); + }; + context.memo('help.linkDialog.show', options.langInfo.help['linkDialog.show']); + }; + + var LinkPopover = function (context) { + var self = this; + var ui = $.summernote.ui; + + var options = context.options; + + this.events = { + 'summernote.keyup summernote.mouseup summernote.change summernote.scroll': function () { + self.update(); + }, + 'summernote.dialog.shown': function () { + self.hide(); + } + }; + + this.shouldInitialize = function () { + return !list.isEmpty(options.popover.link); + }; + + this.initialize = function () { + this.$popover = ui.popover({ + className: 'note-link-popover', + callback: function ($node) { + var $content = $node.find('.popover-content'); + $content.prepend('<span><a target="_blank"></a> </span>'); + } + }).render().appendTo('body'); + var $content = this.$popover.find('.popover-content'); + + context.invoke('buttons.build', $content, options.popover.link); + }; + + this.destroy = function () { + this.$popover.remove(); + }; + + this.update = function () { + // Prevent focusing on editable when invoke('code') is executed + if (!context.invoke('editor.hasFocus')) { + this.hide(); + return; + } + + var rng = context.invoke('editor.createRange'); + if (rng.isCollapsed() && rng.isOnAnchor()) { + var anchor = dom.ancestor(rng.sc, dom.isAnchor); + var href = $(anchor).attr('href'); + this.$popover.find('a').attr('href', href).html(href); + + var pos = dom.posFromPlaceholder(anchor); + this.$popover.css({ + display: 'block', + left: pos.left, + top: pos.top + }); + } else { + this.hide(); + } + }; + + this.hide = function () { + this.$popover.hide(); + }; + }; + + var ImageDialog = function (context) { + var self = this; + var ui = $.summernote.ui; + + var $editor = context.layoutInfo.editor; + var options = context.options; + var lang = options.langInfo; + + this.initialize = function () { + var $container = options.dialogsInBody ? $(document.body) : $editor; + + var imageLimitation = ''; + if (options.maximumImageFileSize) { + var unit = Math.floor(Math.log(options.maximumImageFileSize) / Math.log(1024)); + var readableSize = (options.maximumImageFileSize / Math.pow(1024, unit)).toFixed(2) * 1 + + ' ' + ' KMGTP'[unit] + 'B'; + imageLimitation = '<small>' + lang.image.maximumFileSize + ' : ' + readableSize + '</small>'; + } + + var body = '<div class="form-group note-group-select-from-files">' + + '<label>' + lang.image.selectFromFiles + '</label>' + + '<input class="note-image-input form-control" type="file" name="files" accept="image/*" multiple="multiple" />' + + imageLimitation + + '</div>' + + '<div class="form-group note-group-image-url" style="overflow:auto;">' + + '<label>' + lang.image.url + '</label>' + + '<input class="note-image-url form-control col-md-12" type="text" />' + + '</div>'; + var footer = '<button href="#" class="btn btn-primary note-image-btn disabled" disabled>' + lang.image.insert + '</button>'; + + this.$dialog = ui.dialog({ + title: lang.image.insert, + fade: options.dialogsFade, + body: body, + footer: footer + }).render().appendTo($container); + }; + + this.destroy = function () { + ui.hideDialog(this.$dialog); + this.$dialog.remove(); + }; + + this.bindEnterKey = function ($input, $btn) { + $input.on('keypress', function (event) { + if (event.keyCode === key.code.ENTER) { + $btn.trigger('click'); + } + }); + }; + + this.show = function () { + context.invoke('editor.saveRange'); + this.showImageDialog().then(function (data) { + // [workaround] hide dialog before restore range for IE range focus + ui.hideDialog(self.$dialog); + context.invoke('editor.restoreRange'); + + if (typeof data === 'string') { // image url + context.invoke('editor.insertImage', data); + } else { // array of files + context.invoke('editor.insertImagesOrCallback', data); + } + }).fail(function () { + context.invoke('editor.restoreRange'); + }); + }; + + /** + * show image dialog + * + * @param {jQuery} $dialog + * @return {Promise} + */ + this.showImageDialog = function () { + return $.Deferred(function (deferred) { + var $imageInput = self.$dialog.find('.note-image-input'), + $imageUrl = self.$dialog.find('.note-image-url'), + $imageBtn = self.$dialog.find('.note-image-btn'); + + ui.onDialogShown(self.$dialog, function () { + context.triggerEvent('dialog.shown'); + + // Cloning imageInput to clear element. + $imageInput.replaceWith($imageInput.clone() + .on('change', function () { + deferred.resolve(this.files || this.value); + }) + .val('') + ); + + $imageBtn.click(function (event) { + event.preventDefault(); + + deferred.resolve($imageUrl.val()); + }); + + $imageUrl.on('keyup paste', function () { + var url = $imageUrl.val(); + ui.toggleBtn($imageBtn, url); + }).val('').trigger('focus'); + self.bindEnterKey($imageUrl, $imageBtn); + }); + + ui.onDialogHidden(self.$dialog, function () { + $imageInput.off('change'); + $imageUrl.off('keyup paste keypress'); + $imageBtn.off('click'); + + if (deferred.state() === 'pending') { + deferred.reject(); + } + }); + + ui.showDialog(self.$dialog); + }); + }; + }; + + var ImagePopover = function (context) { + var ui = $.summernote.ui; + + var options = context.options; + + this.shouldInitialize = function () { + return !list.isEmpty(options.popover.image); + }; + + this.initialize = function () { + this.$popover = ui.popover({ + className: 'note-image-popover' + }).render().appendTo('body'); + var $content = this.$popover.find('.popover-content'); + + context.invoke('buttons.build', $content, options.popover.image); + }; + + this.destroy = function () { + this.$popover.remove(); + }; + + this.update = function (target) { + if (dom.isImg(target)) { + var pos = dom.posFromPlaceholder(target); + this.$popover.css({ + display: 'block', + left: pos.left, + top: pos.top + }); + } else { + this.hide(); + } + }; + + this.hide = function () { + this.$popover.hide(); + }; + }; + + var VideoDialog = function (context) { + var self = this; + var ui = $.summernote.ui; + + var $editor = context.layoutInfo.editor; + var options = context.options; + var lang = options.langInfo; + + this.initialize = function () { + var $container = options.dialogsInBody ? $(document.body) : $editor; + + var body = '<div class="form-group row-fluid">' + + '<label>' + lang.video.url + ' <small class="text-muted">' + lang.video.providers + '</small></label>' + + '<input class="note-video-url form-control span12" type="text" />' + + '</div>'; + var footer = '<button href="#" class="btn btn-primary note-video-btn disabled" disabled>' + lang.video.insert + '</button>'; + + this.$dialog = ui.dialog({ + title: lang.video.insert, + fade: options.dialogsFade, + body: body, + footer: footer + }).render().appendTo($container); + }; + + this.destroy = function () { + ui.hideDialog(this.$dialog); + this.$dialog.remove(); + }; + + this.bindEnterKey = function ($input, $btn) { + $input.on('keypress', function (event) { + if (event.keyCode === key.code.ENTER) { + $btn.trigger('click'); + } + }); + }; + + this.createVideoNode = function (url) { + // video url patterns(youtube, instagram, vimeo, dailymotion, youku, mp4, ogg, webm) + var ytRegExp = /^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/; + var ytMatch = url.match(ytRegExp); + + var igRegExp = /(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/; + var igMatch = url.match(igRegExp); + + var vRegExp = /\/\/vine\.co\/v\/([a-zA-Z0-9]+)/; + var vMatch = url.match(vRegExp); + + var vimRegExp = /\/\/(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/; + var vimMatch = url.match(vimRegExp); + + var dmRegExp = /.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/; + var dmMatch = url.match(dmRegExp); + + var youkuRegExp = /\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/; + var youkuMatch = url.match(youkuRegExp); + + var mp4RegExp = /^.+.(mp4|m4v)$/; + var mp4Match = url.match(mp4RegExp); + + var oggRegExp = /^.+.(ogg|ogv)$/; + var oggMatch = url.match(oggRegExp); + + var webmRegExp = /^.+.(webm)$/; + var webmMatch = url.match(webmRegExp); + + var $video; + if (ytMatch && ytMatch[1].length === 11) { + var youtubeId = ytMatch[1]; + $video = $('<iframe>') + .attr('frameborder', 0) + .attr('src', '//www.youtube.com/embed/' + youtubeId) + .attr('width', '640').attr('height', '360'); + } else if (igMatch && igMatch[0].length) { + $video = $('<iframe>') + .attr('frameborder', 0) + .attr('src', 'https://instagram.com/p/' + igMatch[1] + '/embed/') + .attr('width', '612').attr('height', '710') + .attr('scrolling', 'no') + .attr('allowtransparency', 'true'); + } else if (vMatch && vMatch[0].length) { + $video = $('<iframe>') + .attr('frameborder', 0) + .attr('src', vMatch[0] + '/embed/simple') + .attr('width', '600').attr('height', '600') + .attr('class', 'vine-embed'); + } else if (vimMatch && vimMatch[3].length) { + $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>') + .attr('frameborder', 0) + .attr('src', '//player.vimeo.com/video/' + vimMatch[3]) + .attr('width', '640').attr('height', '360'); + } else if (dmMatch && dmMatch[2].length) { + $video = $('<iframe>') + .attr('frameborder', 0) + .attr('src', '//www.dailymotion.com/embed/video/' + dmMatch[2]) + .attr('width', '640').attr('height', '360'); + } else if (youkuMatch && youkuMatch[1].length) { + $video = $('<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>') + .attr('frameborder', 0) + .attr('height', '498') + .attr('width', '510') + .attr('src', '//player.youku.com/embed/' + youkuMatch[1]); + } else if (mp4Match || oggMatch || webmMatch) { + $video = $('<video controls>') + .attr('src', url) + .attr('width', '640').attr('height', '360'); + } else { + // this is not a known video link. Now what, Cat? Now what? + return false; + } + + $video.addClass('note-video-clip'); + + return $video[0]; + }; + + this.show = function () { + var text = context.invoke('editor.getSelectedText'); + context.invoke('editor.saveRange'); + this.showVideoDialog(text).then(function (url) { + // [workaround] hide dialog before restore range for IE range focus + ui.hideDialog(self.$dialog); + context.invoke('editor.restoreRange'); + + // build node + var $node = self.createVideoNode(url); + + if ($node) { + // insert video node + context.invoke('editor.insertNode', $node); + } + }).fail(function () { + context.invoke('editor.restoreRange'); + }); + }; + + /** + * show image dialog + * + * @param {jQuery} $dialog + * @return {Promise} + */ + this.showVideoDialog = function (text) { + return $.Deferred(function (deferred) { + var $videoUrl = self.$dialog.find('.note-video-url'), + $videoBtn = self.$dialog.find('.note-video-btn'); + + ui.onDialogShown(self.$dialog, function () { + context.triggerEvent('dialog.shown'); + + $videoUrl.val(text).on('input', function () { + ui.toggleBtn($videoBtn, $videoUrl.val()); + }).trigger('focus'); + + $videoBtn.click(function (event) { + event.preventDefault(); + + deferred.resolve($videoUrl.val()); + }); + + self.bindEnterKey($videoUrl, $videoBtn); + }); + + ui.onDialogHidden(self.$dialog, function () { + $videoUrl.off('input'); + $videoBtn.off('click'); + + if (deferred.state() === 'pending') { + deferred.reject(); + } + }); + + ui.showDialog(self.$dialog); + }); + }; + }; + + var HelpDialog = function (context) { + var self = this; + var ui = $.summernote.ui; + + var $editor = context.layoutInfo.editor; + var options = context.options; + var lang = options.langInfo; + + this.createShortCutList = function () { + var keyMap = options.keyMap[agent.isMac ? 'mac' : 'pc']; + return Object.keys(keyMap).map(function (key) { + var command = keyMap[key]; + var $row = $('<div><div class="help-list-item"/></div>'); + $row.append($('<label><kbd>' + key + '</kdb></label>').css({ + 'width': 180, + 'margin-right': 10 + })).append($('<span/>').html(context.memo('help.' + command) || command)); + return $row.html(); + }).join(''); + }; + + this.initialize = function () { + var $container = options.dialogsInBody ? $(document.body) : $editor; + + var body = [ + '<p class="text-center">', + '<a href="http://summernote.org/" target="_blank">Summernote 0.8.2</a> · ', + '<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ', + '<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>', + '</p>' + ].join(''); + + this.$dialog = ui.dialog({ + title: lang.options.help, + fade: options.dialogsFade, + body: this.createShortCutList(), + footer: body, + callback: function ($node) { + $node.find('.modal-body').css({ + 'max-height': 300, + 'overflow': 'scroll' + }); + } + }).render().appendTo($container); + }; + + this.destroy = function () { + ui.hideDialog(this.$dialog); + this.$dialog.remove(); + }; + + /** + * show help dialog + * + * @return {Promise} + */ + this.showHelpDialog = function () { + return $.Deferred(function (deferred) { + ui.onDialogShown(self.$dialog, function () { + context.triggerEvent('dialog.shown'); + deferred.resolve(); + }); + ui.showDialog(self.$dialog); + }).promise(); + }; + + this.show = function () { + context.invoke('editor.saveRange'); + this.showHelpDialog().then(function () { + context.invoke('editor.restoreRange'); + }); + }; + }; + + var AirPopover = function (context) { + var self = this; + var ui = $.summernote.ui; + + var options = context.options; + + var AIR_MODE_POPOVER_X_OFFSET = 20; + + this.events = { + 'summernote.keyup summernote.mouseup summernote.scroll': function () { + self.update(); + }, + 'summernote.change summernote.dialog.shown': function () { + self.hide(); + }, + 'summernote.focusout': function (we, e) { + // [workaround] Firefox doesn't support relatedTarget on focusout + // - Ignore hide action on focus out in FF. + if (agent.isFF) { + return; + } + + if (!e.relatedTarget || !dom.ancestor(e.relatedTarget, func.eq(self.$popover[0]))) { + self.hide(); + } + } + }; + + this.shouldInitialize = function () { + return options.airMode && !list.isEmpty(options.popover.air); + }; + + this.initialize = function () { + this.$popover = ui.popover({ + className: 'note-air-popover' + }).render().appendTo('body'); + var $content = this.$popover.find('.popover-content'); + + context.invoke('buttons.build', $content, options.popover.air); + }; + + this.destroy = function () { + this.$popover.remove(); + }; + + this.update = function () { + var styleInfo = context.invoke('editor.currentStyle'); + if (styleInfo.range && !styleInfo.range.isCollapsed()) { + var rect = list.last(styleInfo.range.getClientRects()); + if (rect) { + var bnd = func.rect2bnd(rect); + this.$popover.css({ + display: 'block', + left: Math.max(bnd.left + bnd.width / 2, 0) - AIR_MODE_POPOVER_X_OFFSET, + top: bnd.top + bnd.height + }); + } + } else { + this.hide(); + } + }; + + this.hide = function () { + this.$popover.hide(); + }; + }; + + var HintPopover = function (context) { + var self = this; + var ui = $.summernote.ui; + + var POPOVER_DIST = 5; + var hint = context.options.hint || []; + var direction = context.options.hintDirection || 'bottom'; + var hints = $.isArray(hint) ? hint : [hint]; + + this.events = { + 'summernote.keyup': function (we, e) { + if (!e.isDefaultPrevented()) { + self.handleKeyup(e); + } + }, + 'summernote.keydown': function (we, e) { + self.handleKeydown(e); + }, + 'summernote.dialog.shown': function () { + self.hide(); + } + }; + + this.shouldInitialize = function () { + return hints.length > 0; + }; + + this.initialize = function () { + this.lastWordRange = null; + this.$popover = ui.popover({ + className: 'note-hint-popover', + hideArrow: true, + direction: '' + }).render().appendTo('body'); + + this.$popover.hide(); + + this.$content = this.$popover.find('.popover-content'); + + this.$content.on('click', '.note-hint-item', function () { + self.$content.find('.active').removeClass('active'); + $(this).addClass('active'); + self.replace(); + }); + }; + + this.destroy = function () { + this.$popover.remove(); + }; + + this.selectItem = function ($item) { + this.$content.find('.active').removeClass('active'); + $item.addClass('active'); + + this.$content[0].scrollTop = $item[0].offsetTop - (this.$content.innerHeight() / 2); + }; + + this.moveDown = function () { + var $current = this.$content.find('.note-hint-item.active'); + var $next = $current.next(); + + if ($next.length) { + this.selectItem($next); + } else { + var $nextGroup = $current.parent().next(); + + if (!$nextGroup.length) { + $nextGroup = this.$content.find('.note-hint-group').first(); + } + + this.selectItem($nextGroup.find('.note-hint-item').first()); + } + }; + + this.moveUp = function () { + var $current = this.$content.find('.note-hint-item.active'); + var $prev = $current.prev(); + + if ($prev.length) { + this.selectItem($prev); + } else { + var $prevGroup = $current.parent().prev(); + + if (!$prevGroup.length) { + $prevGroup = this.$content.find('.note-hint-group').last(); + } + + this.selectItem($prevGroup.find('.note-hint-item').last()); + } + }; + + this.replace = function () { + var $item = this.$content.find('.note-hint-item.active'); + + if ($item.length) { + var node = this.nodeFromItem($item); + this.lastWordRange.insertNode(node); + range.createFromNode(node).collapse().select(); + + this.lastWordRange = null; + this.hide(); + context.invoke('editor.focus'); + } + + }; + + this.nodeFromItem = function ($item) { + var hint = hints[$item.data('index')]; + var item = $item.data('item'); + var node = hint.content ? hint.content(item) : item; + if (typeof node === 'string') { + node = dom.createText(node); + } + return node; + }; + + this.createItemTemplates = function (hintIdx, items) { + var hint = hints[hintIdx]; + return items.map(function (item, idx) { + var $item = $('<div class="note-hint-item"/>'); + $item.append(hint.template ? hint.template(item) : item + ''); + $item.data({ + 'index': hintIdx, + 'item': item + }); + + if (hintIdx === 0 && idx === 0) { + $item.addClass('active'); + } + return $item; + }); + }; + + this.handleKeydown = function (e) { + if (!this.$popover.is(':visible')) { + return; + } + + if (e.keyCode === key.code.ENTER) { + e.preventDefault(); + this.replace(); + } else if (e.keyCode === key.code.UP) { + e.preventDefault(); + this.moveUp(); + } else if (e.keyCode === key.code.DOWN) { + e.preventDefault(); + this.moveDown(); + } + }; + + this.searchKeyword = function (index, keyword, callback) { + var hint = hints[index]; + if (hint && hint.match.test(keyword) && hint.search) { + var matches = hint.match.exec(keyword); + hint.search(matches[1], callback); + } else { + callback(); + } + }; + + this.createGroup = function (idx, keyword) { + var $group = $('<div class="note-hint-group note-hint-group-' + idx + '"/>'); + this.searchKeyword(idx, keyword, function (items) { + items = items || []; + if (items.length) { + $group.html(self.createItemTemplates(idx, items)); + self.show(); + } + }); + + return $group; + }; + + this.handleKeyup = function (e) { + if (list.contains([key.code.ENTER, key.code.UP, key.code.DOWN], e.keyCode)) { + if (e.keyCode === key.code.ENTER) { + if (this.$popover.is(':visible')) { + return; + } + } + } else { + var wordRange = context.invoke('editor.createRange').getWordRange(); + var keyword = wordRange.toString(); + if (hints.length && keyword) { + this.$content.empty(); + + var bnd = func.rect2bnd(list.last(wordRange.getClientRects())); + if (bnd) { + + this.$popover.hide(); + + this.lastWordRange = wordRange; + + hints.forEach(function (hint, idx) { + if (hint.match.test(keyword)) { + self.createGroup(idx, keyword).appendTo(self.$content); + } + }); + + // set position for popover after group is created + if (direction === 'top') { + this.$popover.css({ + left: bnd.left, + top: bnd.top - this.$popover.outerHeight() - POPOVER_DIST + }); + } else { + this.$popover.css({ + left: bnd.left, + top: bnd.top + bnd.height + POPOVER_DIST + }); + } + + } + } else { + this.hide(); + } + } + }; + + this.show = function () { + this.$popover.show(); + }; + + this.hide = function () { + this.$popover.hide(); + }; + }; + + + $.summernote = $.extend($.summernote, { + version: '0.8.2', + ui: ui, + dom: dom, + + plugins: {}, + + options: { + modules: { + 'editor': Editor, + 'clipboard': Clipboard, + 'dropzone': Dropzone, + 'codeview': Codeview, + 'statusbar': Statusbar, + 'fullscreen': Fullscreen, + 'handle': Handle, + // FIXME: HintPopover must be front of autolink + // - Script error about range when Enter key is pressed on hint popover + 'hintPopover': HintPopover, + 'autoLink': AutoLink, + 'autoSync': AutoSync, + 'placeholder': Placeholder, + 'buttons': Buttons, + 'toolbar': Toolbar, + 'linkDialog': LinkDialog, + 'linkPopover': LinkPopover, + 'imageDialog': ImageDialog, + 'imagePopover': ImagePopover, + 'videoDialog': VideoDialog, + 'helpDialog': HelpDialog, + 'airPopover': AirPopover + }, + + buttons: {}, + + lang: 'en-US', + + // toolbar + toolbar: [ + ['style', ['style']], + ['font', ['bold', 'underline', 'clear']], + ['fontname', ['fontname']], + ['color', ['color']], + ['para', ['ul', 'ol', 'paragraph']], + ['table', ['table']], + ['insert', ['link', 'picture', 'video']], + ['view', ['fullscreen', 'codeview', 'help']] + ], + + // popover + popover: { + image: [ + ['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']], + ['float', ['floatLeft', 'floatRight', 'floatNone']], + ['remove', ['removeMedia']] + ], + link: [ + ['link', ['linkDialogShow', 'unlink']] + ], + air: [ + ['color', ['color']], + ['font', ['bold', 'underline', 'clear']], + ['para', ['ul', 'paragraph']], + ['table', ['table']], + ['insert', ['link', 'picture']] + ] + }, + + // air mode: inline editor + airMode: false, + + width: null, + height: null, + + focus: false, + tabSize: 4, + styleWithSpan: true, + shortcuts: true, + textareaAutoSync: true, + direction: null, + + styleTags: ['p', 'blockquote', 'pre', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'], + + fontNames: [ + 'Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', + 'Helvetica Neue', 'Helvetica', 'Impact', 'Lucida Grande', + 'Tahoma', 'Times New Roman', 'Verdana' + ], + + fontSizes: ['8', '9', '10', '11', '12', '14', '18', '24', '36'], + + // pallete colors(n x n) + colors: [ + ['#000000', '#424242', '#636363', '#9C9C94', '#CEC6CE', '#EFEFEF', '#F7F7F7', '#FFFFFF'], + ['#FF0000', '#FF9C00', '#FFFF00', '#00FF00', '#00FFFF', '#0000FF', '#9C00FF', '#FF00FF'], + ['#F7C6CE', '#FFE7CE', '#FFEFC6', '#D6EFD6', '#CEDEE7', '#CEE7F7', '#D6D6E7', '#E7D6DE'], + ['#E79C9C', '#FFC69C', '#FFE79C', '#B5D6A5', '#A5C6CE', '#9CC6EF', '#B5A5D6', '#D6A5BD'], + ['#E76363', '#F7AD6B', '#FFD663', '#94BD7B', '#73A5AD', '#6BADDE', '#8C7BC6', '#C67BA5'], + ['#CE0000', '#E79439', '#EFC631', '#6BA54A', '#4A7B8C', '#3984C6', '#634AA5', '#A54A7B'], + ['#9C0000', '#B56308', '#BD9400', '#397B21', '#104A5A', '#085294', '#311873', '#731842'], + ['#630000', '#7B3900', '#846300', '#295218', '#083139', '#003163', '#21104A', '#4A1031'] + ], + + lineHeights: ['1.0', '1.2', '1.4', '1.5', '1.6', '1.8', '2.0', '3.0'], + + tableClassName: 'table table-bordered', + + insertTableMaxSize: { + col: 10, + row: 10 + }, + + dialogsInBody: false, + dialogsFade: false, + + maximumImageFileSize: null, + + callbacks: { + onInit: null, + onFocus: null, + onBlur: null, + onEnter: null, + onKeyup: null, + onKeydown: null, + onImageUpload: null, + onImageUploadError: null + }, + + codemirror: { + mode: 'text/html', + htmlMode: true, + lineNumbers: true + }, + + keyMap: { + pc: { + 'ENTER': 'insertParagraph', + 'CTRL+Z': 'undo', + 'CTRL+Y': 'redo', + 'TAB': 'tab', + 'SHIFT+TAB': 'untab', + 'CTRL+B': 'bold', + 'CTRL+I': 'italic', + 'CTRL+U': 'underline', + 'CTRL+SHIFT+S': 'strikethrough', + 'CTRL+BACKSLASH': 'removeFormat', + 'CTRL+SHIFT+L': 'justifyLeft', + 'CTRL+SHIFT+E': 'justifyCenter', + 'CTRL+SHIFT+R': 'justifyRight', + 'CTRL+SHIFT+J': 'justifyFull', + 'CTRL+SHIFT+NUM7': 'insertUnorderedList', + 'CTRL+SHIFT+NUM8': 'insertOrderedList', + 'CTRL+LEFTBRACKET': 'outdent', + 'CTRL+RIGHTBRACKET': 'indent', + 'CTRL+NUM0': 'formatPara', + 'CTRL+NUM1': 'formatH1', + 'CTRL+NUM2': 'formatH2', + 'CTRL+NUM3': 'formatH3', + 'CTRL+NUM4': 'formatH4', + 'CTRL+NUM5': 'formatH5', + 'CTRL+NUM6': 'formatH6', + 'CTRL+ENTER': 'insertHorizontalRule', + 'CTRL+K': 'linkDialog.show' + }, + + mac: { + 'ENTER': 'insertParagraph', + 'CMD+Z': 'undo', + 'CMD+SHIFT+Z': 'redo', + 'TAB': 'tab', + 'SHIFT+TAB': 'untab', + 'CMD+B': 'bold', + 'CMD+I': 'italic', + 'CMD+U': 'underline', + 'CMD+SHIFT+S': 'strikethrough', + 'CMD+BACKSLASH': 'removeFormat', + 'CMD+SHIFT+L': 'justifyLeft', + 'CMD+SHIFT+E': 'justifyCenter', + 'CMD+SHIFT+R': 'justifyRight', + 'CMD+SHIFT+J': 'justifyFull', + 'CMD+SHIFT+NUM7': 'insertUnorderedList', + 'CMD+SHIFT+NUM8': 'insertOrderedList', + 'CMD+LEFTBRACKET': 'outdent', + 'CMD+RIGHTBRACKET': 'indent', + 'CMD+NUM0': 'formatPara', + 'CMD+NUM1': 'formatH1', + 'CMD+NUM2': 'formatH2', + 'CMD+NUM3': 'formatH3', + 'CMD+NUM4': 'formatH4', + 'CMD+NUM5': 'formatH5', + 'CMD+NUM6': 'formatH6', + 'CMD+ENTER': 'insertHorizontalRule', + 'CMD+K': 'linkDialog.show' + } + }, + icons: { + 'align': 'note-icon-align', + 'alignCenter': 'note-icon-align-center', + 'alignJustify': 'note-icon-align-justify', + 'alignLeft': 'note-icon-align-left', + 'alignRight': 'note-icon-align-right', + 'indent': 'note-icon-align-indent', + 'outdent': 'note-icon-align-outdent', + 'arrowsAlt': 'note-icon-arrows-alt', + 'bold': 'note-icon-bold', + 'caret': 'note-icon-caret', + 'circle': 'note-icon-circle', + 'close': 'note-icon-close', + 'code': 'note-icon-code', + 'eraser': 'note-icon-eraser', + 'font': 'note-icon-font', + 'frame': 'note-icon-frame', + 'italic': 'note-icon-italic', + 'link': 'note-icon-link', + 'unlink': 'note-icon-chain-broken', + 'magic': 'note-icon-magic', + 'menuCheck': 'note-icon-check', + 'minus': 'note-icon-minus', + 'orderedlist': 'note-icon-orderedlist', + 'pencil': 'note-icon-pencil', + 'picture': 'note-icon-picture', + 'question': 'note-icon-question', + 'redo': 'note-icon-redo', + 'square': 'note-icon-square', + 'strikethrough': 'note-icon-strikethrough', + 'subscript': 'note-icon-subscript', + 'superscript': 'note-icon-superscript', + 'table': 'note-icon-table', + 'textHeight': 'note-icon-text-height', + 'trash': 'note-icon-trash', + 'underline': 'note-icon-underline', + 'undo': 'note-icon-undo', + 'unorderedlist': 'note-icon-unorderedlist', + 'video': 'note-icon-video' + } + } + }); + +})); diff --git a/public/admin/view/javascript/summernote/summernote.min.js b/public/admin/view/javascript/summernote/summernote.min.js new file mode 100644 index 0000000..9210055 --- /dev/null +++ b/public/admin/view/javascript/summernote/summernote.min.js @@ -0,0 +1,4 @@ +/*! Summernote v0.8.2 | (c) 2013-2015 Alan Hong and other contributors | MIT license */ +!function(a){"function"==typeof define&&define.amd?define(["jquery"],a):"object"==typeof module&&module.exports?module.exports=a(require("jquery")):a(window.jQuery)}(function($){"use strict";var func=function(){var a=function(a){return function(b){return a===b}},b=function(a,b){return a===b},c=function(a){return function(b,c){return b[a]===c[a]}},d=function(){return!0},e=function(){return!1},f=function(a){return function(){return!a.apply(a,arguments)}},g=function(a,b){return function(c){return a(c)&&b(c)}},h=function(a){return a},i=function(a,b){return function(){return a[b].apply(a,arguments)}},j=0,k=function(a){var b=++j+"";return a?a+b:b},l=function(a){var b=$(document);return{top:a.top+b.scrollTop(),left:a.left+b.scrollLeft(),width:a.right-a.left,height:a.bottom-a.top}},m=function(a){var b={};for(var c in a)a.hasOwnProperty(c)&&(b[a[c]]=c);return b},n=function(a,b){return b=b||"",b+a.split(".").map(function(a){return a.substring(0,1).toUpperCase()+a.substring(1)}).join("")},o=function(a,b,c){var d;return function(){var e=this,f=arguments,g=function(){d=null,c||a.apply(e,f)},h=c&&!d;clearTimeout(d),d=setTimeout(g,b),h&&a.apply(e,f)}};return{eq:a,eq2:b,peq2:c,ok:d,fail:e,self:h,not:f,and:g,invoke:i,uniqueId:k,rect2bnd:l,invertObject:m,namespaceToCamel:n,debounce:o}}(),list=function(){var a=function(a){return a[0]},b=function(a){return a[a.length-1]},c=function(a){return a.slice(0,a.length-1)},d=function(a){return a.slice(1)},e=function(a,b){for(var c=0,d=a.length;d>c;c++){var e=a[c];if(b(e))return e}},f=function(a,b){for(var c=0,d=a.length;d>c;c++)if(!b(a[c]))return!1;return!0},g=function(a,b){return $.inArray(b,a)},h=function(a,b){return-1!==g(a,b)},i=function(a,b){return b=b||func.self,a.reduce(function(a,c){return a+b(c)},0)},j=function(a){for(var b=[],c=-1,d=a.length;++c<d;)b[c]=a[c];return b},k=function(a){return!a||!a.length},l=function(c,e){if(!c.length)return[];var f=d(c);return f.reduce(function(a,c){var d=b(a);return e(b(d),c)?d[d.length]=c:a[a.length]=[c],a},[[a(c)]])},m=function(a){for(var b=[],c=0,d=a.length;d>c;c++)a[c]&&b.push(a[c]);return b},n=function(a){for(var b=[],c=0,d=a.length;d>c;c++)h(b,a[c])||b.push(a[c]);return b},o=function(a,b){var c=g(a,b);return-1===c?null:a[c+1]},p=function(a,b){var c=g(a,b);return-1===c?null:a[c-1]};return{head:a,last:b,initial:c,tail:d,prev:p,next:o,find:e,contains:h,all:f,sum:i,from:j,isEmpty:k,clusterBy:l,compact:m,unique:n}}(),isSupportAmd="function"==typeof define&&define.amd,isFontInstalled=function(a){var b="Comic Sans MS"===a?"Courier New":"Comic Sans MS",c=$("<div>").css({position:"absolute",left:"-9999px",top:"-9999px",fontSize:"200px"}).text("mmmmmmmmmwwwwwww").appendTo(document.body),d=c.css("fontFamily",b).width(),e=c.css("fontFamily",a+","+b).width();return c.remove(),d!==e},userAgent=navigator.userAgent,isMSIE=/MSIE|Trident/i.test(userAgent),browserVersion;if(isMSIE){var matches=/MSIE (\d+[.]\d+)/.exec(userAgent);matches&&(browserVersion=parseFloat(matches[1])),matches=/Trident\/.*rv:([0-9]{1,}[\.0-9]{0,})/.exec(userAgent),matches&&(browserVersion=parseFloat(matches[1]))}var isEdge=/Edge\/\d+/.test(userAgent),hasCodeMirror=!!window.CodeMirror;if(!hasCodeMirror&&isSupportAmd&&"undefined"!=typeof require)if("undefined"!=typeof require.resolve)try{require.resolve("codemirror"),hasCodeMirror=!0}catch(e){}else"undefined"!=typeof eval("require").specified&&(hasCodeMirror=eval("require").specified("codemirror"));var agent={isMac:navigator.appVersion.indexOf("Mac")>-1,isMSIE:isMSIE,isEdge:isEdge,isFF:!isEdge&&/firefox/i.test(userAgent),isPhantom:/PhantomJS/i.test(userAgent),isWebkit:!isEdge&&/webkit/i.test(userAgent),isChrome:!isEdge&&/chrome/i.test(userAgent),isSafari:!isEdge&&/safari/i.test(userAgent),browserVersion:browserVersion,jqueryVersion:parseFloat($.fn.jquery),isSupportAmd:isSupportAmd,hasCodeMirror:hasCodeMirror,isFontInstalled:isFontInstalled,isW3CRangeSupport:!!document.createRange},NBSP_CHAR=String.fromCharCode(160),ZERO_WIDTH_NBSP_CHAR="\ufeff",dom=function(){var a=function(a){return a&&$(a).hasClass("note-editable")},b=function(a){return a&&$(a).hasClass("note-control-sizing")},c=function(a){return a=a.toUpperCase(),function(b){return b&&b.nodeName.toUpperCase()===a}},d=function(a){return a&&3===a.nodeType},e=function(a){return a&&1===a.nodeType},f=function(a){return a&&/^BR|^IMG|^HR|^IFRAME|^BUTTON/.test(a.nodeName.toUpperCase())},g=function(b){return a(b)?!1:b&&/^DIV|^P|^LI|^H[1-7]/.test(b.nodeName.toUpperCase())},h=function(a){return a&&/^H[1-7]/.test(a.nodeName.toUpperCase())},i=c("PRE"),j=c("LI"),k=function(a){return g(a)&&!j(a)},l=c("TABLE"),m=c("DATA"),n=function(a){return!(s(a)||o(a)||p(a)||g(a)||l(a)||r(a)||m(a))},o=function(a){return a&&/^UL|^OL/.test(a.nodeName.toUpperCase())},p=c("HR"),q=function(a){return a&&/^TD|^TH/.test(a.nodeName.toUpperCase())},r=c("BLOCKQUOTE"),s=function(b){return q(b)||r(b)||a(b)},t=c("A"),u=function(a){return n(a)&&!!D(a,g)},v=function(a){return n(a)&&!D(a,g)},w=c("BODY"),x=function(a,b){return a.nextSibling===b||a.previousSibling===b},y=function(a,b){b=b||func.ok;var c=[];return a.previousSibling&&b(a.previousSibling)&&c.push(a.previousSibling),c.push(a),a.nextSibling&&b(a.nextSibling)&&c.push(a.nextSibling),c},z=agent.isMSIE&&agent.browserVersion<11?" ":"<br>",A=function(a){return d(a)?a.nodeValue.length:a?a.childNodes.length:0},B=function(a){var b=A(a);return 0===b?!0:d(a)||1!==b||a.innerHTML!==z?list.all(a.childNodes,d)&&""===a.innerHTML?!0:!1:!0},C=function(a){f(a)||A(a)||(a.innerHTML=z)},D=function(b,c){for(;b;){if(c(b))return b;if(a(b))break;b=b.parentNode}return null},E=function(b,c){for(b=b.parentNode;b&&1===A(b);){if(c(b))return b;if(a(b))break;b=b.parentNode}return null},F=function(b,c){c=c||func.fail;var d=[];return D(b,function(b){return a(b)||d.push(b),c(b)}),d},G=function(a,b){var c=F(a);return list.last(c.filter(b))},H=function(a,b){for(var c=F(a),d=b;d;d=d.parentNode)if($.inArray(d,c)>-1)return d;return null},I=function(a,b){b=b||func.fail;for(var c=[];a&&!b(a);)c.push(a),a=a.previousSibling;return c},J=function(a,b){b=b||func.fail;for(var c=[];a&&!b(a);)c.push(a),a=a.nextSibling;return c},K=function(a,b){var c=[];return b=b||func.ok,function d(e){a!==e&&b(e)&&c.push(e);for(var f=0,g=e.childNodes.length;g>f;f++)d(e.childNodes[f])}(a),c},L=function(a,b){var c=a.parentNode,d=$("<"+b+">")[0];return c.insertBefore(d,a),d.appendChild(a),d},M=function(a,b){var c=b.nextSibling,d=b.parentNode;return c?d.insertBefore(a,c):d.appendChild(a),a},N=function(a,b){return $.each(b,function(b,c){a.appendChild(c)}),a},O=function(a){return 0===a.offset},P=function(a){return a.offset===A(a.node)},Q=function(a){return O(a)||P(a)},R=function(a,b){for(;a&&a!==b;){if(0!==V(a))return!1;a=a.parentNode}return!0},S=function(a,b){if(!b)return!1;for(;a&&a!==b;){if(V(a)!==A(a.parentNode)-1)return!1;a=a.parentNode}return!0},T=function(a,b){return O(a)&&R(a.node,b)},U=function(a,b){return P(a)&&S(a.node,b)},V=function(a){for(var b=0;a=a.previousSibling;)b+=1;return b},W=function(a){return!!(a&&a.childNodes&&a.childNodes.length)},X=function(b,c){var d,e;if(0===b.offset){if(a(b.node))return null;d=b.node.parentNode,e=V(b.node)}else W(b.node)?(d=b.node.childNodes[b.offset-1],e=A(d)):(d=b.node,e=c?0:b.offset-1);return{node:d,offset:e}},Y=function(b,c){var d,e;if(A(b.node)===b.offset){if(a(b.node))return null;d=b.node.parentNode,e=V(b.node)+1}else W(b.node)?(d=b.node.childNodes[b.offset],e=0):(d=b.node,e=c?A(b.node):b.offset+1);return{node:d,offset:e}},Z=function(a,b){return a.node===b.node&&a.offset===b.offset},_=function(a){if(d(a.node)||!W(a.node)||B(a.node))return!0;var b=a.node.childNodes[a.offset-1],c=a.node.childNodes[a.offset];return b&&!f(b)||c&&!f(c)?!1:!0},aa=function(a,b){for(;a;){if(b(a))return a;a=X(a)}return null},ba=function(a,b){for(;a;){if(b(a))return a;a=Y(a)}return null},ca=function(a){if(!d(a.node))return!1;var b=a.node.nodeValue.charAt(a.offset-1);return b&&" "!==b&&b!==NBSP_CHAR},da=function(a,b,c,d){for(var e=a;e&&(c(e),!Z(e,b));){var f=d&&a.node!==e.node&&b.node!==e.node;e=Y(e,f)}},ea=function(a,b){var c=F(b,func.eq(a));return c.map(V).reverse()},fa=function(a,b){for(var c=a,d=0,e=b.length;e>d;d++)c=c.childNodes.length<=b[d]?c.childNodes[c.childNodes.length-1]:c.childNodes[b[d]];return c},ga=function(a,b){var c=b&&b.isSkipPaddingBlankHTML,e=b&&b.isNotSplitEdgePoint;if(Q(a)&&(d(a.node)||e)){if(O(a))return a.node;if(P(a))return a.node.nextSibling}if(d(a.node))return a.node.splitText(a.offset);var f=a.node.childNodes[a.offset],g=M(a.node.cloneNode(!1),a.node);return N(g,J(f)),c||(C(a.node),C(g)),g},ha=function(a,b,c){var d=F(b.node,func.eq(a));return d.length?1===d.length?ga(b,c):d.reduce(function(a,d){return a===b.node&&(a=ga(b,c)),ga({node:d,offset:a?dom.position(a):A(d)},c)}):null},ia=function(a,b){var c,d,e=b?g:s,f=F(a.node,e),h=list.last(f)||a.node;e(h)?(c=f[f.length-2],d=h):(c=h,d=c.parentNode);var i=c&&ha(c,a,{isSkipPaddingBlankHTML:b,isNotSplitEdgePoint:b});return i||d!==a.node||(i=a.node.childNodes[a.offset]),{rightNode:i,container:d}},ja=function(a){return document.createElement(a)},ka=function(a){return document.createTextNode(a)},la=function(a,b){if(a&&a.parentNode){if(a.removeNode)return a.removeNode(b);var c=a.parentNode;if(!b){var d,e,f=[];for(d=0,e=a.childNodes.length;e>d;d++)f.push(a.childNodes[d]);for(d=0,e=f.length;e>d;d++)c.insertBefore(f[d],a)}c.removeChild(a)}},ma=function(b,c){for(;b&&!a(b)&&c(b);){var d=b.parentNode;la(b),b=d}},na=function(a,b){if(a.nodeName.toUpperCase()===b.toUpperCase())return a;var c=ja(b);return a.style.cssText&&(c.style.cssText=a.style.cssText),N(c,list.from(a.childNodes)),M(c,a),la(a),c},oa=c("TEXTAREA"),pa=function(a,b){var c=oa(a[0])?a.val():a.html();return b?c.replace(/[\n\r]/g,""):c},qa=function(a,b){var c=pa(a);if(b){var d=/<(\/?)(\b(?!!)[^>\s]*)(.*?)(\s*\/?>)/g;c=c.replace(d,function(a,b,c){c=c.toUpperCase();var d=/^DIV|^TD|^TH|^P|^LI|^H[1-7]/.test(c)&&!!b,e=/^BLOCKQUOTE|^TABLE|^TBODY|^TR|^HR|^UL|^OL/.test(c);return a+(d||e?"\n":"")}),c=$.trim(c)}return c},ra=function(a){var b=$(a),c=b.offset(),d=b.outerHeight(!0);return{left:c.left,top:c.top+d}},sa=function(a,b){Object.keys(b).forEach(function(c){a.on(c,b[c])})},ta=function(a,b){Object.keys(b).forEach(function(c){a.off(c,b[c])})};return{NBSP_CHAR:NBSP_CHAR,ZERO_WIDTH_NBSP_CHAR:ZERO_WIDTH_NBSP_CHAR,blank:z,emptyPara:"<p>"+z+"</p>",makePredByNodeName:c,isEditable:a,isControlSizing:b,isText:d,isElement:e,isVoid:f,isPara:g,isPurePara:k,isHeading:h,isInline:n,isBlock:func.not(n),isBodyInline:v,isBody:w,isParaInline:u,isPre:i,isList:o,isTable:l,isData:m,isCell:q,isBlockquote:r,isBodyContainer:s,isAnchor:t,isDiv:c("DIV"),isLi:j,isBR:c("BR"),isSpan:c("SPAN"),isB:c("B"),isU:c("U"),isS:c("S"),isI:c("I"),isImg:c("IMG"),isTextarea:oa,isEmpty:B,isEmptyAnchor:func.and(t,B),isClosestSibling:x,withClosestSiblings:y,nodeLength:A,isLeftEdgePoint:O,isRightEdgePoint:P,isEdgePoint:Q,isLeftEdgeOf:R,isRightEdgeOf:S,isLeftEdgePointOf:T,isRightEdgePointOf:U,prevPoint:X,nextPoint:Y,isSamePoint:Z,isVisiblePoint:_,prevPointUntil:aa,nextPointUntil:ba,isCharPoint:ca,walkPoint:da,ancestor:D,singleChildAncestor:E,listAncestor:F,lastAncestor:G,listNext:J,listPrev:I,listDescendant:K,commonAncestor:H,wrap:L,insertAfter:M,appendChildNodes:N,position:V,hasChildren:W,makeOffsetPath:ea,fromOffsetPath:fa,splitTree:ha,splitPoint:ia,create:ja,createText:ka,remove:la,removeWhile:ma,replace:na,html:qa,value:pa,posFromPlaceholder:ra,attachEvents:sa,detachEvents:ta}}(),Context=function(a,b){var c=this,d=$.summernote.ui;return this.memos={},this.modules={},this.layoutInfo={},this.options=b,this.initialize=function(){return this.layoutInfo=d.createLayout(a,b),this._initialize(),a.hide(),this},this.destroy=function(){this._destroy(),a.removeData("summernote"),d.removeLayout(a,this.layoutInfo)},this.reset=function(){var a=c.isDisabled();this.code(dom.emptyPara),this._destroy(),this._initialize(),a&&c.disable()},this._initialize=function(){var a=$.extend({},this.options.buttons);Object.keys(a).forEach(function(b){c.memo("button."+b,a[b])});var b=$.extend({},this.options.modules,$.summernote.plugins||{});Object.keys(b).forEach(function(a){c.module(a,b[a],!0)}),Object.keys(this.modules).forEach(function(a){c.initializeModule(a)})},this._destroy=function(){Object.keys(this.modules).reverse().forEach(function(a){c.removeModule(a)}),Object.keys(this.memos).forEach(function(a){c.removeMemo(a)})},this.code=function(b){var c=this.invoke("codeview.isActivated");return void 0===b?(this.invoke("codeview.sync"),c?this.layoutInfo.codable.val():this.layoutInfo.editable.html()):(c?this.layoutInfo.codable.val(b):this.layoutInfo.editable.html(b),a.val(b),this.triggerEvent("change",b),void 0)},this.isDisabled=function(){return"false"===this.layoutInfo.editable.attr("contenteditable")},this.enable=function(){this.layoutInfo.editable.attr("contenteditable",!0),this.invoke("toolbar.activate",!0)},this.disable=function(){this.invoke("codeview.isActivated")&&this.invoke("codeview.deactivate"),this.layoutInfo.editable.attr("contenteditable",!1),this.invoke("toolbar.deactivate",!0)},this.triggerEvent=function(){var b=list.head(arguments),c=list.tail(list.from(arguments)),d=this.options.callbacks[func.namespaceToCamel(b,"on")];d&&d.apply(a[0],c),a.trigger("summernote."+b,c)},this.initializeModule=function(b){var c=this.modules[b];c.shouldInitialize=c.shouldInitialize||func.ok,c.shouldInitialize()&&(c.initialize&&c.initialize(),c.events&&dom.attachEvents(a,c.events))},this.module=function(a,b,c){return 1===arguments.length?this.modules[a]:(this.modules[a]=new b(this),void(c||this.initializeModule(a)))},this.removeModule=function(b){var c=this.modules[b];c.shouldInitialize()&&(c.events&&dom.detachEvents(a,c.events),c.destroy&&c.destroy()),delete this.modules[b]},this.memo=function(a,b){return 1===arguments.length?this.memos[a]:void(this.memos[a]=b)},this.removeMemo=function(a){this.memos[a]&&this.memos[a].destroy&&this.memos[a].destroy(),delete this.memos[a]},this.createInvokeHandler=function(a,b){return function(d){d.preventDefault(),c.invoke(a,b||$(d.target).closest("[data-value]").data("value"))}},this.invoke=function(){var a=list.head(arguments),b=list.tail(list.from(arguments)),c=a.split("."),d=c.length>1,e=d&&list.head(c),f=d?list.last(c):list.head(c),g=this.modules[e||"editor"];return!e&&this[f]?this[f].apply(this,b):g&&g[f]&&g.shouldInitialize()?g[f].apply(g,b):void 0},this.initialize()};$.fn.extend({summernote:function(){var a=$.type(list.head(arguments)),b="string"===a,c="object"===a,d=c?list.head(arguments):{};d=$.extend({},$.summernote.options,d),d.langInfo=$.extend(!0,{},$.summernote.lang["en-US"],$.summernote.lang[d.lang]),d.icons=$.extend(!0,{},$.summernote.options.icons,d.icons),this.each(function(a,b){var c=$(b);if(!c.data("summernote")){var e=new Context(c,d);c.data("summernote",e),c.data("summernote").triggerEvent("init",e.layoutInfo)}});var e=this.first();if(e.length){var f=e.data("summernote");if(b)return f.invoke.apply(f,list.from(arguments));d.focus&&f.invoke("editor.focus")}return this}});var Renderer=function(a,b,c,d){this.render=function(e){var f=$(a);if(c&&c.contents&&f.html(c.contents),c&&c.className&&f.addClass(c.className),c&&c.data&&$.each(c.data,function(a,b){f.attr("data-"+a,b)}),c&&c.click&&f.on("click",c.click),b){var g=f.find(".note-children-container");b.forEach(function(a){a.render(g.length?g:f)})}return d&&d(f,c),c&&c.callback&&c.callback(f),e&&e.append(f),f}},renderer={create:function(a,b){return function(){var c=$.isArray(arguments[0])?arguments[0]:[],d="object"==typeof arguments[1]?arguments[1]:arguments[0];return d&&d.children&&(c=d.children),new Renderer(a,c,d,b)}}},editor=renderer.create('<div class="note-editor note-frame panel panel-default"/>'),toolbar=renderer.create('<div class="note-toolbar panel-heading"/>'),editingArea=renderer.create('<div class="note-editing-area"/>'),codable=renderer.create('<textarea class="note-codable"/>'),editable=renderer.create('<div class="note-editable panel-body" contentEditable="true"/>'),statusbar=renderer.create(['<div class="note-statusbar">',' <div class="note-resizebar">',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>',' <div class="note-icon-bar"/>'," </div>","</div>"].join("")),airEditor=renderer.create('<div class="note-editor"/>'),airEditable=renderer.create('<div class="note-editable" contentEditable="true"/>'),buttonGroup=renderer.create('<div class="note-btn-group btn-group">'),button=renderer.create('<button type="button" class="note-btn btn btn-default btn-sm" tabindex="-1">',function(a,b){b&&b.tooltip&&a.attr({title:b.tooltip}).tooltip({container:"body",trigger:"hover",placement:"bottom"})}),dropdown=renderer.create('<div class="dropdown-menu">',function(a,b){var c=$.isArray(b.items)?b.items.map(function(a){var c="string"==typeof a?a:a.value||"",d=b.template?b.template(a):a;return'<li><a href="#" data-value="'+c+'">'+d+"</a></li>"}).join(""):b.items;a.html(c)}),dropdownCheck=renderer.create('<div class="dropdown-menu note-check">',function(a,b){var c=$.isArray(b.items)?b.items.map(function(a){var c="string"==typeof a?a:a.value||"",d=b.template?b.template(a):a;return'<li><a href="#" data-value="'+c+'">'+icon(b.checkClassName)+" "+d+"</a></li>"}).join(""):b.items;a.html(c)}),palette=renderer.create('<div class="note-color-palette"/>',function(a,b){for(var c=[],d=0,e=b.colors.length;e>d;d++){for(var f=b.eventName,g=b.colors[d],h=[],i=0,j=g.length;j>i;i++){var k=g[i];h.push(['<button type="button" class="note-color-btn"','style="background-color:',k,'" ','data-event="',f,'" ','data-value="',k,'" ','title="',k,'" ','data-toggle="button" tabindex="-1"></button>'].join(""))}c.push('<div class="note-color-row">'+h.join("")+"</div>")}a.html(c.join("")),a.find(".note-color-btn").tooltip({container:"body",trigger:"hover",placement:"bottom"})}),dialog=renderer.create('<div class="modal" aria-hidden="false" tabindex="-1"/>',function(a,b){b.fade&&a.addClass("fade"),a.html(['<div class="modal-dialog">',' <div class="modal-content">',b.title?' <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button> <h4 class="modal-title">'+b.title+"</h4> </div>":"",' <div class="modal-body">'+b.body+"</div>",b.footer?' <div class="modal-footer">'+b.footer+"</div>":""," </div>","</div>"].join(""))}),popover=renderer.create(['<div class="note-popover popover in">',' <div class="arrow"/>',' <div class="popover-content note-children-container"/>',"</div>"].join(""),function(a,b){var c="undefined"!=typeof b.direction?b.direction:"bottom";a.addClass(c),b.hideArrow&&a.find(".arrow").hide()}),icon=function(a,b){return b=b||"i","<"+b+' class="'+a+'"/>'},ui={editor:editor,toolbar:toolbar,editingArea:editingArea,codable:codable,editable:editable,statusbar:statusbar,airEditor:airEditor,airEditable:airEditable,buttonGroup:buttonGroup,button:button,dropdown:dropdown,dropdownCheck:dropdownCheck,palette:palette,dialog:dialog,popover:popover,icon:icon,toggleBtn:function(a,b){a.toggleClass("disabled",!b),a.attr("disabled",!b)},toggleBtnActive:function(a,b){a.toggleClass("active",b)},onDialogShown:function(a,b){a.one("shown.bs.modal",b)},onDialogHidden:function(a,b){a.one("hidden.bs.modal",b)},showDialog:function(a){a.modal("show")},hideDialog:function(a){a.modal("hide")},createLayout:function(a,b){var c=(b.airMode?ui.airEditor([ui.editingArea([ui.airEditable()])]):ui.editor([ui.toolbar(),ui.editingArea([ui.codable(),ui.editable()]),ui.statusbar()])).render();return c.insertAfter(a),{note:a,editor:c,toolbar:c.find(".note-toolbar"),editingArea:c.find(".note-editing-area"),editable:c.find(".note-editable"),codable:c.find(".note-codable"),statusbar:c.find(".note-statusbar")}},removeLayout:function(a,b){a.html(b.editable.html()),b.editor.remove(),a.show()}};$.summernote=$.summernote||{lang:{}},$.extend($.summernote.lang,{"en-US":{font:{bold:"Bold",italic:"Italic",underline:"Underline",clear:"Remove Font Style",height:"Line Height",name:"Font Family",strikethrough:"Strikethrough",subscript:"Subscript",superscript:"Superscript",size:"Font Size"},image:{image:"Picture",insert:"Insert Image",resizeFull:"Resize Full",resizeHalf:"Resize Half",resizeQuarter:"Resize Quarter",floatLeft:"Float Left",floatRight:"Float Right",floatNone:"Float None",shapeRounded:"Shape: Rounded",shapeCircle:"Shape: Circle",shapeThumbnail:"Shape: Thumbnail",shapeNone:"Shape: None",dragImageHere:"Drag image or text here",dropImage:"Drop image or Text",selectFromFiles:"Select from files",maximumFileSize:"Maximum file size",maximumFileSizeError:"Maximum file size exceeded.",url:"Image URL",remove:"Remove Image"},video:{video:"Video",videoLink:"Video Link",insert:"Insert Video",url:"Video URL?",providers:"(YouTube, Vimeo, Vine, Instagram, DailyMotion or Youku)"},link:{link:"Link",insert:"Insert Link",unlink:"Unlink",edit:"Edit",textToDisplay:"Text to display",url:"To what URL should this link go?",openInNewWindow:"Open in new window"},table:{table:"Table"},hr:{insert:"Insert Horizontal Rule"},style:{style:"Style",normal:"Normal",blockquote:"Quote",pre:"Code",h1:"Header 1",h2:"Header 2",h3:"Header 3",h4:"Header 4",h5:"Header 5",h6:"Header 6"},lists:{unordered:"Unordered list",ordered:"Ordered list"},options:{help:"Help",fullscreen:"Full Screen",codeview:"Code View"},paragraph:{paragraph:"Paragraph",outdent:"Outdent",indent:"Indent",left:"Align left",center:"Align center",right:"Align right",justify:"Justify full"},color:{recent:"Recent Color",more:"More Color",background:"Background Color",foreground:"Foreground Color",transparent:"Transparent",setTransparent:"Set transparent",reset:"Reset",resetToDefault:"Reset to default"},shortcut:{shortcuts:"Keyboard shortcuts",close:"Close",textFormatting:"Text formatting",action:"Action",paragraphFormatting:"Paragraph formatting",documentStyle:"Document Style",extraKeys:"Extra keys"},help:{insertParagraph:"Insert Paragraph",undo:"Undoes the last command",redo:"Redoes the last command",tab:"Tab",untab:"Untab",bold:"Set a bold style",italic:"Set a italic style",underline:"Set a underline style",strikethrough:"Set a strikethrough style",removeFormat:"Clean a style",justifyLeft:"Set left align",justifyCenter:"Set center align",justifyRight:"Set right align",justifyFull:"Set full align",insertUnorderedList:"Toggle unordered list",insertOrderedList:"Toggle ordered list",outdent:"Outdent on current paragraph",indent:"Indent on current paragraph",formatPara:"Change current block's format as a paragraph(P tag)",formatH1:"Change current block's format as H1",formatH2:"Change current block's format as H2",formatH3:"Change current block's format as H3",formatH4:"Change current block's format as H4",formatH5:"Change current block's format as H5",formatH6:"Change current block's format as H6",insertHorizontalRule:"Insert horizontal rule","linkDialog.show":"Show Link Dialog"},history:{undo:"Undo",redo:"Redo"},specialChar:{specialChar:"SPECIAL CHARACTERS",select:"Select Special characters"}}});var key=function(){var a={BACKSPACE:8,TAB:9,ENTER:13,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,NUM0:48,NUM1:49,NUM2:50,NUM3:51,NUM4:52,NUM5:53,NUM6:54,NUM7:55,NUM8:56,B:66,E:69,I:73,J:74,K:75,L:76,R:82,S:83,U:85,V:86,Y:89,Z:90,SLASH:191,LEFTBRACKET:219,BACKSLASH:220,RIGHTBRACKET:221};return{isEdit:function(b){return list.contains([a.BACKSPACE,a.TAB,a.ENTER,a.SPACE],b)},isMove:function(b){return list.contains([a.LEFT,a.UP,a.RIGHT,a.DOWN],b)},nameFromCode:func.invertObject(a),code:a}}(),range=function(){var a=function(a,b){var c,d,e=a.parentElement(),f=document.body.createTextRange(),g=list.from(e.childNodes);for(c=0;c<g.length;c++)if(!dom.isText(g[c])){if(f.moveToElementText(g[c]),f.compareEndPoints("StartToStart",a)>=0)break;d=g[c]}if(0!==c&&dom.isText(g[c-1])){var h=document.body.createTextRange(),i=null;h.moveToElementText(d||e),h.collapse(!d),i=d?d.nextSibling:e.firstChild;var j=a.duplicate();j.setEndPoint("StartToStart",h);for(var k=j.text.replace(/[\r\n]/g,"").length;k>i.nodeValue.length&&i.nextSibling;)k-=i.nodeValue.length,i=i.nextSibling;i.nodeValue;b&&i.nextSibling&&dom.isText(i.nextSibling)&&k===i.nodeValue.length&&(k-=i.nodeValue.length,i=i.nextSibling),e=i,c=k}return{cont:e,offset:c}},b=function(a){var b=function(a,c){var d,e;if(dom.isText(a)){var f=dom.listPrev(a,func.not(dom.isText)),g=list.last(f).previousSibling;d=g||a.parentNode,c+=list.sum(list.tail(f),dom.nodeLength),e=!g}else{if(d=a.childNodes[c]||a,dom.isText(d))return b(d,0);c=0,e=!1}return{node:d,collapseToStart:e,offset:c}},c=document.body.createTextRange(),d=b(a.node,a.offset);return c.moveToElementText(d.node),c.collapse(d.collapseToStart),c.moveStart("character",d.offset),c},c=function(a,d,e,f){this.sc=a,this.so=d,this.ec=e,this.eo=f;var g=function(){if(agent.isW3CRangeSupport){var c=document.createRange();return c.setStart(a,d),c.setEnd(e,f),c}var g=b({node:a,offset:d});return g.setEndPoint("EndToEnd",b({node:e,offset:f})),g};this.getPoints=function(){return{sc:a,so:d,ec:e,eo:f}},this.getStartPoint=function(){return{node:a,offset:d}},this.getEndPoint=function(){return{node:e,offset:f}},this.select=function(){var a=g();if(agent.isW3CRangeSupport){var b=document.getSelection();b.rangeCount>0&&b.removeAllRanges(),b.addRange(a)}else a.select();return this},this.scrollIntoView=function(a){var b=$(a).height();return a.scrollTop+b<this.sc.offsetTop&&(a.scrollTop+=Math.abs(a.scrollTop+b-this.sc.offsetTop)),this},this.normalize=function(){var a=function(a,b){if(dom.isVisiblePoint(a)&&!dom.isEdgePoint(a)||dom.isVisiblePoint(a)&&dom.isRightEdgePoint(a)&&!b||dom.isVisiblePoint(a)&&dom.isLeftEdgePoint(a)&&b||dom.isVisiblePoint(a)&&dom.isBlock(a.node)&&dom.isEmpty(a.node))return a;var c=dom.ancestor(a.node,dom.isBlock);if((dom.isLeftEdgePointOf(a,c)||dom.isVoid(dom.prevPoint(a).node))&&!b||(dom.isRightEdgePointOf(a,c)||dom.isVoid(dom.nextPoint(a).node))&&b){if(dom.isVisiblePoint(a))return a;b=!b}var d=b?dom.nextPointUntil(dom.nextPoint(a),dom.isVisiblePoint):dom.prevPointUntil(dom.prevPoint(a),dom.isVisiblePoint);return d||a},b=a(this.getEndPoint(),!1),d=this.isCollapsed()?b:a(this.getStartPoint(),!0);return new c(d.node,d.offset,b.node,b.offset)},this.nodes=function(a,b){a=a||func.ok;var c=b&&b.includeAncestor,d=b&&b.fullyContains,e=this.getStartPoint(),f=this.getEndPoint(),g=[],h=[];return dom.walkPoint(e,f,function(b){if(!dom.isEditable(b.node)){var e;d?(dom.isLeftEdgePoint(b)&&h.push(b.node),dom.isRightEdgePoint(b)&&list.contains(h,b.node)&&(e=b.node)):e=c?dom.ancestor(b.node,a):b.node,e&&a(e)&&g.push(e)}},!0),list.unique(g)},this.commonAncestor=function(){return dom.commonAncestor(a,e)},this.expand=function(b){var g=dom.ancestor(a,b),h=dom.ancestor(e,b);if(!g&&!h)return new c(a,d,e,f);var i=this.getPoints();return g&&(i.sc=g,i.so=0),h&&(i.ec=h,i.eo=dom.nodeLength(h)),new c(i.sc,i.so,i.ec,i.eo)},this.collapse=function(b){return b?new c(a,d,a,d):new c(e,f,e,f)},this.splitText=function(){var b=a===e,g=this.getPoints();return dom.isText(e)&&!dom.isEdgePoint(this.getEndPoint())&&e.splitText(f),dom.isText(a)&&!dom.isEdgePoint(this.getStartPoint())&&(g.sc=a.splitText(d),g.so=0,b&&(g.ec=g.sc,g.eo=f-d)),new c(g.sc,g.so,g.ec,g.eo)},this.deleteContents=function(){if(this.isCollapsed())return this;var a=this.splitText(),b=a.nodes(null,{fullyContains:!0}),d=dom.prevPointUntil(a.getStartPoint(),function(a){return!list.contains(b,a.node)}),e=[];return $.each(b,function(a,b){var c=b.parentNode;d.node!==c&&1===dom.nodeLength(c)&&e.push(c),dom.remove(b,!1)}),$.each(e,function(a,b){dom.remove(b,!1)}),new c(d.node,d.offset,d.node,d.offset).normalize()};var h=function(b){return function(){var c=dom.ancestor(a,b);return!!c&&c===dom.ancestor(e,b)}};this.isOnEditable=h(dom.isEditable),this.isOnList=h(dom.isList),this.isOnAnchor=h(dom.isAnchor),this.isOnCell=h(dom.isCell),this.isOnData=h(dom.isData),this.isLeftEdgeOf=function(a){if(!dom.isLeftEdgePoint(this.getStartPoint()))return!1;var b=dom.ancestor(this.sc,a);return b&&dom.isLeftEdgeOf(this.sc,b)},this.isCollapsed=function(){return a===e&&d===f},this.wrapBodyInlineWithPara=function(){if(dom.isBodyContainer(a)&&dom.isEmpty(a))return a.innerHTML=dom.emptyPara,new c(a.firstChild,0,a.firstChild,0);var b=this.normalize();if(dom.isParaInline(a)||dom.isPara(a))return b;var d;if(dom.isInline(b.sc)){var e=dom.listAncestor(b.sc,func.not(dom.isInline));d=list.last(e),dom.isInline(d)||(d=e[e.length-2]||b.sc.childNodes[b.so])}else d=b.sc.childNodes[b.so>0?b.so-1:0];var f=dom.listPrev(d,dom.isParaInline).reverse();if(f=f.concat(dom.listNext(d.nextSibling,dom.isParaInline)),f.length){var g=dom.wrap(list.head(f),"p");dom.appendChildNodes(g,list.tail(f))}return this.normalize()},this.insertNode=function(a){var b=this.wrapBodyInlineWithPara().deleteContents(),c=dom.splitPoint(b.getStartPoint(),dom.isInline(a));return c.rightNode?c.rightNode.parentNode.insertBefore(a,c.rightNode):c.container.appendChild(a),a},this.pasteHTML=function(a){var b=$("<div></div>").html(a)[0],c=list.from(b.childNodes),d=this.wrapBodyInlineWithPara().deleteContents();return c.reverse().map(function(a){return d.insertNode(a)}).reverse()},this.toString=function(){var a=g();return agent.isW3CRangeSupport?a.toString():a.text},this.getWordRange=function(a){var b=this.getEndPoint();if(!dom.isCharPoint(b))return this;var d=dom.prevPointUntil(b,function(a){return!dom.isCharPoint(a)});return a&&(b=dom.nextPointUntil(b,function(a){return!dom.isCharPoint(a)})),new c(d.node,d.offset,b.node,b.offset)},this.bookmark=function(b){return{s:{path:dom.makeOffsetPath(b,a),offset:d},e:{path:dom.makeOffsetPath(b,e),offset:f}}},this.paraBookmark=function(b){return{s:{path:list.tail(dom.makeOffsetPath(list.head(b),a)),offset:d},e:{path:list.tail(dom.makeOffsetPath(list.last(b),e)),offset:f}}},this.getClientRects=function(){var a=g();return a.getClientRects()}};return{create:function(a,b,d,e){if(4===arguments.length)return new c(a,b,d,e);if(2===arguments.length)return d=a,e=b,new c(a,b,d,e);var f=this.createFromSelection();return f||1!==arguments.length?f:(f=this.createFromNode(arguments[0]),f.collapse(dom.emptyPara===arguments[0].innerHTML))},createFromSelection:function(){var b,d,e,f;if(agent.isW3CRangeSupport){var g=document.getSelection();if(!g||0===g.rangeCount)return null;if(dom.isBody(g.anchorNode))return null;var h=g.getRangeAt(0);b=h.startContainer,d=h.startOffset,e=h.endContainer,f=h.endOffset}else{var i=document.selection.createRange(),j=i.duplicate();j.collapse(!1);var k=i;k.collapse(!0);var l=a(k,!0),m=a(j,!1);dom.isText(l.node)&&dom.isLeftEdgePoint(l)&&dom.isTextNode(m.node)&&dom.isRightEdgePoint(m)&&m.node.nextSibling===l.node&&(l=m),b=l.cont,d=l.offset,e=m.cont,f=m.offset}return new c(b,d,e,f)},createFromNode:function(a){var b=a,c=0,d=a,e=dom.nodeLength(d);return dom.isVoid(b)&&(c=dom.listPrev(b).length-1,b=b.parentNode),dom.isBR(d)?(e=dom.listPrev(d).length-1,d=d.parentNode):dom.isVoid(d)&&(e=dom.listPrev(d).length,d=d.parentNode),this.create(b,c,d,e)},createFromNodeBefore:function(a){return this.createFromNode(a).collapse(!0)},createFromNodeAfter:function(a){return this.createFromNode(a).collapse()},createFromBookmark:function(a,b){var d=dom.fromOffsetPath(a,b.s.path),e=b.s.offset,f=dom.fromOffsetPath(a,b.e.path),g=b.e.offset;return new c(d,e,f,g)},createFromParaBookmark:function(a,b){var d=a.s.offset,e=a.e.offset,f=dom.fromOffsetPath(list.head(b),a.s.path),g=dom.fromOffsetPath(list.last(b),a.e.path);return new c(f,d,g,e)}}}(),async=function(){var a=function(a){return $.Deferred(function(b){$.extend(new FileReader,{onload:function(a){var c=a.target.result;b.resolve(c)},onerror:function(){b.reject(this)}}).readAsDataURL(a)}).promise()},b=function(a){return $.Deferred(function(b){var c=$("<img>");c.one("load",function(){c.off("error abort"),b.resolve(c)}).one("error abort",function(){c.off("load").detach(),b.reject(c)}).css({display:"none"}).appendTo(document.body).attr("src",a)}).promise()};return{readFileAsDataURL:a,createImage:b +}}(),History=function(a){var b=[],c=-1,d=a[0],e=function(){var b=range.create(d),c={s:{path:[],offset:0},e:{path:[],offset:0}};return{contents:a.html(),bookmark:b?b.bookmark(d):c}},f=function(b){null!==b.contents&&a.html(b.contents),null!==b.bookmark&&range.createFromBookmark(d,b.bookmark).select()};this.rewind=function(){a.html()!==b[c].contents&&this.recordUndo(),c=0,f(b[c])},this.reset=function(){b=[],c=-1,a.html(""),this.recordUndo()},this.undo=function(){a.html()!==b[c].contents&&this.recordUndo(),c>0&&(c--,f(b[c]))},this.redo=function(){b.length-1>c&&(c++,f(b[c]))},this.recordUndo=function(){c++,b.length>c&&(b=b.slice(0,c)),b.push(e())}},Style=function(){var a=function(a,b){if(agent.jqueryVersion<1.9){var c={};return $.each(b,function(b,d){c[d]=a.css(d)}),c}return a.css.call(a,b)};this.fromNode=function(b){var c=["font-family","font-size","text-align","list-style-type","line-height"],d=a(b,c)||{};return d["font-size"]=parseInt(d["font-size"],10),d},this.stylePara=function(a,b){$.each(a.nodes(dom.isPara,{includeAncestor:!0}),function(a,c){$(c).css(b)})},this.styleNodes=function(a,b){a=a.splitText();var c=b&&b.nodeName||"SPAN",d=!(!b||!b.expandClosestSibling),e=!(!b||!b.onlyPartialContains);if(a.isCollapsed())return[a.insertNode(dom.create(c))];var f=dom.makePredByNodeName(c),g=a.nodes(dom.isText,{fullyContains:!0}).map(function(a){return dom.singleChildAncestor(a,f)||dom.wrap(a,c)});if(d){if(e){var h=a.nodes();f=func.and(f,function(a){return list.contains(h,a)})}return g.map(function(a){var b=dom.withClosestSiblings(a,f),c=list.head(b),d=list.tail(b);return $.each(d,function(a,b){dom.appendChildNodes(c,b.childNodes),dom.remove(b)}),list.head(b)})}return g},this.current=function(a){var b=$(dom.isElement(a.sc)?a.sc:a.sc.parentNode),c=this.fromNode(b);try{c=$.extend(c,{"font-bold":document.queryCommandState("bold")?"bold":"normal","font-italic":document.queryCommandState("italic")?"italic":"normal","font-underline":document.queryCommandState("underline")?"underline":"normal","font-subscript":document.queryCommandState("subscript")?"subscript":"normal","font-superscript":document.queryCommandState("superscript")?"superscript":"normal","font-strikethrough":document.queryCommandState("strikethrough")?"strikethrough":"normal"})}catch(d){}if(a.isOnList()){var e=["circle","disc","disc-leading-zero","square"],f=$.inArray(c["list-style-type"],e)>-1;c["list-style"]=f?"unordered":"ordered"}else c["list-style"]="none";var g=dom.ancestor(a.sc,dom.isPara);if(g&&g.style["line-height"])c["line-height"]=g.style.lineHeight;else{var h=parseInt(c["line-height"],10)/parseInt(c["font-size"],10);c["line-height"]=h.toFixed(1)}return c.anchor=a.isOnAnchor()&&dom.ancestor(a.sc,dom.isAnchor),c.ancestors=dom.listAncestor(a.sc,dom.isEditable),c.range=a,c}},Bullet=function(){var a=this;this.insertOrderedList=function(a){this.toggleList("OL",a)},this.insertUnorderedList=function(a){this.toggleList("UL",a)},this.indent=function(a){var b=this,c=range.create(a).wrapBodyInlineWithPara(),d=c.nodes(dom.isPara,{includeAncestor:!0}),e=list.clusterBy(d,func.peq2("parentNode"));$.each(e,function(a,c){var d=list.head(c);dom.isLi(d)?b.wrapList(c,d.parentNode.nodeName):$.each(c,function(a,b){$(b).css("marginLeft",function(a,b){return(parseInt(b,10)||0)+25})})}),c.select()},this.outdent=function(a){var b=this,c=range.create(a).wrapBodyInlineWithPara(),d=c.nodes(dom.isPara,{includeAncestor:!0}),e=list.clusterBy(d,func.peq2("parentNode"));$.each(e,function(a,c){var d=list.head(c);dom.isLi(d)?b.releaseList([c]):$.each(c,function(a,b){$(b).css("marginLeft",function(a,b){return b=parseInt(b,10)||0,b>25?b-25:""})})}),c.select()},this.toggleList=function(b,c){var d=range.create(c).wrapBodyInlineWithPara(),e=d.nodes(dom.isPara,{includeAncestor:!0}),f=d.paraBookmark(e),g=list.clusterBy(e,func.peq2("parentNode"));if(list.find(e,dom.isPurePara)){var h=[];$.each(g,function(c,d){h=h.concat(a.wrapList(d,b))}),e=h}else{var i=d.nodes(dom.isList,{includeAncestor:!0}).filter(function(a){return!$.nodeName(a,b)});i.length?$.each(i,function(a,c){dom.replace(c,b)}):e=this.releaseList(g,!0)}range.createFromParaBookmark(f,e).select()},this.wrapList=function(a,b){var c=list.head(a),d=list.last(a),e=dom.isList(c.previousSibling)&&c.previousSibling,f=dom.isList(d.nextSibling)&&d.nextSibling,g=e||dom.insertAfter(dom.create(b||"UL"),d);return a=a.map(function(a){return dom.isPurePara(a)?dom.replace(a,"LI"):a}),dom.appendChildNodes(g,a),f&&(dom.appendChildNodes(g,list.from(f.childNodes)),dom.remove(f)),a},this.releaseList=function(a,b){var c=[];return $.each(a,function(a,d){var e=list.head(d),f=list.last(d),g=b?dom.lastAncestor(e,dom.isList):e.parentNode,h=g.childNodes.length>1?dom.splitTree(g,{node:f.parentNode,offset:dom.position(f)+1},{isSkipPaddingBlankHTML:!0}):null,i=dom.splitTree(g,{node:e.parentNode,offset:dom.position(e)},{isSkipPaddingBlankHTML:!0});d=b?dom.listDescendant(i,dom.isLi):list.from(i.childNodes).filter(dom.isLi),(b||!dom.isList(g.parentNode))&&(d=d.map(function(a){return dom.replace(a,"P")})),$.each(list.from(d).reverse(),function(a,b){dom.insertAfter(b,g)});var j=list.compact([g,i,h]);$.each(j,function(a,b){var c=[b].concat(dom.listDescendant(b,dom.isList));$.each(c.reverse(),function(a,b){dom.nodeLength(b)||dom.remove(b,!0)})}),c=c.concat(d)}),c}},Typing=function(){var a=new Bullet;this.insertTab=function(a,b){var c=dom.createText(new Array(b+1).join(dom.NBSP_CHAR));a=a.deleteContents(),a.insertNode(c,!0),a=range.create(c,b),a.select()},this.insertParagraph=function(b){var c=range.create(b);c=c.deleteContents(),c=c.wrapBodyInlineWithPara();var d,e=dom.ancestor(c.sc,dom.isPara);if(e){if(dom.isEmpty(e)&&dom.isLi(e))return void a.toggleList(e.parentNode.nodeName);if(dom.isEmpty(e)&&dom.isPara(e)&&dom.isBlockquote(e.parentNode))dom.insertAfter(e,e.parentNode),d=e;else{d=dom.splitTree(e,c.getStartPoint());var f=dom.listDescendant(e,dom.isEmptyAnchor);f=f.concat(dom.listDescendant(d,dom.isEmptyAnchor)),$.each(f,function(a,b){dom.remove(b)}),(dom.isHeading(d)||dom.isPre(d))&&dom.isEmpty(d)&&(d=dom.replace(d,"p"))}}else{var g=c.sc.childNodes[c.so];d=$(dom.emptyPara)[0],g?c.sc.insertBefore(d,g):c.sc.appendChild(d)}range.create(d,0).normalize().select().scrollIntoView(b)}},Table=function(){this.tab=function(a,b){var c=dom.ancestor(a.commonAncestor(),dom.isCell),d=dom.ancestor(c,dom.isTable),e=dom.listDescendant(d,dom.isCell),f=list[b?"prev":"next"](e,c);f&&range.create(f,0).select()},this.createTable=function(a,b,c){for(var d,e=[],f=0;a>f;f++)e.push("<td>"+dom.blank+"</td>");d=e.join("");for(var g,h=[],i=0;b>i;i++)h.push("<tr>"+d+"</tr>");g=h.join("");var j=$("<table>"+g+"</table>");return c&&c.tableClassName&&j.addClass(c.tableClassName),j[0]}},KEY_BOGUS="bogus",Editor=function(a){var b=this,c=a.layoutInfo.note,d=a.layoutInfo.editor,e=a.layoutInfo.editable,f=a.options,g=f.langInfo,h=e[0],i=null,j=new Style,k=new Table,l=new Typing,m=new Bullet,n=new History(e);this.initialize=function(){e.on("keydown",function(c){c.keyCode===key.code.ENTER&&a.triggerEvent("enter",c),a.triggerEvent("keydown",c),c.isDefaultPrevented()||(f.shortcuts?b.handleKeyMap(c):b.preventDefaultEditableShortCuts(c))}).on("keyup",function(b){a.triggerEvent("keyup",b)}).on("focus",function(b){a.triggerEvent("focus",b)}).on("blur",function(b){a.triggerEvent("blur",b)}).on("mousedown",function(b){a.triggerEvent("mousedown",b)}).on("mouseup",function(b){a.triggerEvent("mouseup",b)}).on("scroll",function(b){a.triggerEvent("scroll",b)}).on("paste",function(b){a.triggerEvent("paste",b)}),e.html(dom.html(c)||dom.emptyPara);var g=agent.isMSIE?"DOMCharacterDataModified DOMSubtreeModified DOMNodeInserted":"input";e.on(g,func.debounce(function(){a.triggerEvent("change",e.html())},250)),d.on("focusin",function(b){a.triggerEvent("focusin",b)}).on("focusout",function(b){a.triggerEvent("focusout",b)}),f.airMode||(f.width&&d.outerWidth(f.width),f.height&&e.outerHeight(f.height),f.maxHeight&&e.css("max-height",f.maxHeight),f.minHeight&&e.css("min-height",f.minHeight)),n.recordUndo()},this.destroy=function(){e.off()},this.handleKeyMap=function(b){var c=f.keyMap[agent.isMac?"mac":"pc"],d=[];b.metaKey&&d.push("CMD"),b.ctrlKey&&!b.altKey&&d.push("CTRL"),b.shiftKey&&d.push("SHIFT");var e=key.nameFromCode[b.keyCode];e&&d.push(e);var g=c[d.join("+")];g?(b.preventDefault(),a.invoke(g)):key.isEdit(b.keyCode)&&this.afterCommand()},this.preventDefaultEditableShortCuts=function(a){(a.ctrlKey||a.metaKey)&&list.contains([66,73,85],a.keyCode)&&a.preventDefault()},this.createRange=function(){return this.focus(),range.create(h)},this.saveRange=function(a){i=this.createRange(),a&&i.collapse().select()},this.restoreRange=function(){i&&(i.select(),this.focus())},this.saveTarget=function(a){e.data("target",a)},this.clearTarget=function(){e.removeData("target")},this.restoreTarget=function(){return e.data("target")},this.currentStyle=function(){var a=range.create();return a&&(a=a.normalize()),a?j.current(a):j.fromNode(e)},this.styleFromNode=function(a){return j.fromNode(a)},this.undo=function(){a.triggerEvent("before.command",e.html()),n.undo(),a.triggerEvent("change",e.html())},a.memo("help.undo",g.help.undo),this.redo=function(){a.triggerEvent("before.command",e.html()),n.redo(),a.triggerEvent("change",e.html())},a.memo("help.redo",g.help.redo);for(var o=this.beforeCommand=function(){a.triggerEvent("before.command",e.html()),b.focus()},p=this.afterCommand=function(b){n.recordUndo(),b||a.triggerEvent("change",e.html())},q=["bold","italic","underline","strikethrough","superscript","subscript","justifyLeft","justifyCenter","justifyRight","justifyFull","formatBlock","removeFormat","backColor","foreColor","fontName"],r=0,s=q.length;s>r;r++)this[q[r]]=function(a){return function(b){o(),document.execCommand(a,!1,b),p(!0)}}(q[r]),a.memo("help."+q[r],g.help[q[r]]);this.tab=function(){var a=this.createRange();a.isCollapsed()&&a.isOnCell()?k.tab(a):(o(),l.insertTab(a,f.tabSize),p())},a.memo("help.tab",g.help.tab),this.untab=function(){var a=this.createRange();a.isCollapsed()&&a.isOnCell()&&k.tab(a,!0)},a.memo("help.untab",g.help.untab),this.wrapCommand=function(a){return function(){o(),a.apply(b,arguments),p()}},this.insertParagraph=this.wrapCommand(function(){l.insertParagraph(h)}),a.memo("help.insertParagraph",g.help.insertParagraph),this.insertOrderedList=this.wrapCommand(function(){m.insertOrderedList(h)}),a.memo("help.insertOrderedList",g.help.insertOrderedList),this.insertUnorderedList=this.wrapCommand(function(){m.insertUnorderedList(h)}),a.memo("help.insertUnorderedList",g.help.insertUnorderedList),this.indent=this.wrapCommand(function(){m.indent(h)}),a.memo("help.indent",g.help.indent),this.outdent=this.wrapCommand(function(){m.outdent(h)}),a.memo("help.outdent",g.help.outdent),this.insertImage=function(b,c){return async.createImage(b,c).then(function(a){o(),"function"==typeof c?c(a):("string"==typeof c&&a.attr("data-filename",c),a.css("width",Math.min(e.width(),a.width()))),a.show(),range.create(h).insertNode(a[0]),range.createFromNodeAfter(a[0]).select(),p()}).fail(function(b){a.triggerEvent("image.upload.error",b)})},this.insertImages=function(c){$.each(c,function(c,d){var e=d.name;f.maximumImageFileSize&&f.maximumImageFileSize<d.size?a.triggerEvent("image.upload.error",g.image.maximumFileSizeError):async.readFileAsDataURL(d).then(function(a){return b.insertImage(a,e)}).fail(function(){a.triggerEvent("image.upload.error")})})},this.insertImagesOrCallback=function(b){var c=f.callbacks;c.onImageUpload?a.triggerEvent("image.upload",b):this.insertImages(b)},this.insertNode=this.wrapCommand(function(a){var b=this.createRange();b.insertNode(a),range.createFromNodeAfter(a).select()}),this.insertText=this.wrapCommand(function(a){var b=this.createRange(),c=b.insertNode(dom.createText(a));range.create(c,dom.nodeLength(c)).select()}),this.getSelectedText=function(){var a=this.createRange();return a.isOnAnchor()&&(a=range.createFromNode(dom.ancestor(a.sc,dom.isAnchor))),a.toString()},this.pasteHTML=this.wrapCommand(function(a){var b=this.createRange().pasteHTML(a);range.createFromNodeAfter(list.last(b)).select()}),this.formatBlock=this.wrapCommand(function(a){a=agent.isMSIE?"<"+a+">":a,document.execCommand("FormatBlock",!1,a)}),this.formatPara=function(){this.formatBlock("P")},a.memo("help.formatPara",g.help.formatPara);for(var r=1;6>=r;r++)this["formatH"+r]=function(a){return function(){this.formatBlock("H"+a)}}(r),a.memo("help.formatH"+r,g.help["formatH"+r]);this.fontSize=function(a){var b=this.createRange();if(b&&b.isCollapsed()){var c=j.styleNodes(b),d=list.head(c);$(c).css({"font-size":a+"px"}),d&&!dom.nodeLength(d)&&(d.innerHTML=dom.ZERO_WIDTH_NBSP_CHAR,range.createFromNodeAfter(d.firstChild).select(),e.data(KEY_BOGUS,d))}else o(),$(j.styleNodes(b)).css({"font-size":a+"px"}),p()},this.insertHorizontalRule=this.wrapCommand(function(){var a=this.createRange().insertNode(dom.create("HR"));a.nextSibling&&range.create(a.nextSibling,0).normalize().select()}),a.memo("help.insertHorizontalRule",g.help.insertHorizontalRule),this.removeBogus=function(){var a=e.data(KEY_BOGUS);if(a){var b=list.find(list.from(a.childNodes),dom.isText),c=b.nodeValue.indexOf(dom.ZERO_WIDTH_NBSP_CHAR);-1!==c&&b.deleteData(c,1),dom.isEmpty(a)&&dom.remove(a),e.removeData(KEY_BOGUS)}},this.lineHeight=this.wrapCommand(function(a){j.stylePara(this.createRange(),{lineHeight:a})}),this.unlink=function(){var a=this.createRange();if(a.isOnAnchor()){var b=dom.ancestor(a.sc,dom.isAnchor);a=range.createFromNode(b),a.select(),o(),document.execCommand("unlink"),p()}},this.createLink=this.wrapCommand(function(a){var b=a.url,c=a.text,d=a.isNewWindow,e=a.range||this.createRange(),g=e.toString()!==c;"string"==typeof b&&(b=b.trim()),f.onCreateLink&&(b=f.onCreateLink(b));var h=[];if(g){e=e.deleteContents();var i=e.insertNode($("<A>"+c+"</A>")[0]);h.push(i)}else h=j.styleNodes(e,{nodeName:"A",expandClosestSibling:!0,onlyPartialContains:!0});$.each(h,function(a,c){b=/^[A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?/.test(b)?b:"http://"+b,$(c).attr("href",b),d?$(c).attr("target","_blank"):$(c).removeAttr("target")});var k=range.createFromNodeBefore(list.head(h)),l=k.getStartPoint(),m=range.createFromNodeAfter(list.last(h)),n=m.getEndPoint();range.create(l.node,l.offset,n.node,n.offset).select()}),this.getLinkInfo=function(){var a=this.createRange().expand(dom.isAnchor),b=$(list.head(a.nodes(dom.isAnchor)));return{range:a,text:a.toString(),isNewWindow:b.length?"_blank"===b.attr("target"):!1,url:b.length?b.attr("href"):""}},this.color=this.wrapCommand(function(a){var b=a.foreColor,c=a.backColor;b&&document.execCommand("foreColor",!1,b),c&&document.execCommand("backColor",!1,c)}),this.insertTable=this.wrapCommand(function(a){var b=a.split("x"),c=this.createRange().deleteContents();c.insertNode(k.createTable(b[0],b[1],f))}),this.floatMe=this.wrapCommand(function(a){var b=$(this.restoreTarget());b.css("float",a)}),this.resize=this.wrapCommand(function(a){var b=$(this.restoreTarget());b.css({width:100*a+"%",height:""})}),this.resizeTo=function(a,b,c){var d;if(c){var e=a.y/a.x,f=b.data("ratio");d={width:f>e?a.x:a.y/f,height:f>e?a.x*f:a.y}}else d={width:a.x,height:a.y};b.css(d)},this.removeMedia=this.wrapCommand(function(){var b=$(this.restoreTarget()).detach();a.triggerEvent("media.delete",b,e)}),this.hasFocus=function(){return e.is(":focus")},this.focus=function(){this.hasFocus()||e.focus()},this.isEmpty=function(){return dom.isEmpty(e[0])||dom.emptyPara===e.html()},this.empty=function(){a.invoke("code",dom.emptyPara)}},Clipboard=function(a){var b=this,c=a.layoutInfo.editable;this.events={"summernote.keydown":function(c,d){b.needKeydownHook()&&(d.ctrlKey||d.metaKey)&&d.keyCode===key.code.V&&(a.invoke("editor.saveRange"),b.$paste.focus(),setTimeout(function(){b.pasteByHook()},0))}},this.needKeydownHook=function(){return agent.isMSIE&&agent.browserVersion>10||agent.isFF},this.initialize=function(){this.needKeydownHook()?(this.$paste=$('<div tabindex="-1" />').attr("contenteditable",!0).css({position:"absolute",left:-1e5,opacity:0}),c.before(this.$paste),this.$paste.on("paste",function(b){a.triggerEvent("paste",b)})):c.on("paste",this.pasteByEvent)},this.destroy=function(){this.needKeydownHook()&&(this.$paste.remove(),this.$paste=null)},this.pasteByHook=function(){var b=this.$paste[0].firstChild;if(dom.isImg(b)){for(var c=b.src,d=atob(c.split(",")[1]),e=new Uint8Array(d.length),f=0;f<d.length;f++)e[f]=d.charCodeAt(f);var g=new Blob([e],{type:"image/png"});g.name="clipboard.png",a.invoke("editor.restoreRange"),a.invoke("editor.focus"),a.invoke("editor.insertImagesOrCallback",[g])}else{var h=$("<div />").html(this.$paste.html()).html();a.invoke("editor.restoreRange"),a.invoke("editor.focus"),h&&a.invoke("editor.pasteHTML",h)}this.$paste.empty()},this.pasteByEvent=function(b){var c=b.originalEvent.clipboardData;if(c&&c.items&&c.items.length){var d=list.head(c.items);"file"===d.kind&&-1!==d.type.indexOf("image/")&&a.invoke("editor.insertImagesOrCallback",[d.getAsFile()]),a.invoke("editor.afterCommand")}}},Dropzone=function(a){var b=$(document),c=a.layoutInfo.editor,d=a.layoutInfo.editable,e=a.options,f=e.langInfo,g={},h=$(['<div class="note-dropzone">',' <div class="note-dropzone-message"/>',"</div>"].join("")).prependTo(c),i=function(){Object.keys(g).forEach(function(a){b.off(a.substr(2).toLowerCase(),g[a])}),g={}};this.initialize=function(){e.disableDragAndDrop?(g.onDrop=function(a){a.preventDefault()},b.on("drop",g.onDrop)):this.attachDragAndDropEvent()},this.attachDragAndDropEvent=function(){var e=$(),i=h.find(".note-dropzone-message");g.onDragenter=function(b){var d=a.invoke("codeview.isActivated"),g=c.width()>0&&c.height()>0;d||e.length||!g||(c.addClass("dragover"),h.width(c.width()),h.height(c.height()),i.text(f.image.dragImageHere)),e=e.add(b.target)},g.onDragleave=function(a){e=e.not(a.target),e.length||c.removeClass("dragover")},g.onDrop=function(){e=$(),c.removeClass("dragover")},b.on("dragenter",g.onDragenter).on("dragleave",g.onDragleave).on("drop",g.onDrop),h.on("dragenter",function(){h.addClass("hover"),i.text(f.image.dropImage)}).on("dragleave",function(){h.removeClass("hover"),i.text(f.image.dragImageHere)}),h.on("drop",function(b){var c=b.originalEvent.dataTransfer;c&&c.files&&c.files.length?(b.preventDefault(),d.focus(),a.invoke("editor.insertImagesOrCallback",c.files)):$.each(c.types,function(b,d){var e=c.getData(d);d.toLowerCase().indexOf("text")>-1?a.invoke("editor.pasteHTML",e):$(e).each(function(){a.invoke("editor.insertNode",this)})})}).on("dragover",!1)},this.destroy=function(){i()}},CodeMirror;agent.hasCodeMirror&&(agent.isSupportAmd?require(["codemirror"],function(a){CodeMirror=a}):CodeMirror=window.CodeMirror);var Codeview=function(a){var b=a.layoutInfo.editor,c=a.layoutInfo.editable,d=a.layoutInfo.codable,e=a.options;this.sync=function(){var a=this.isActivated();a&&agent.hasCodeMirror&&d.data("cmEditor").save()},this.isActivated=function(){return b.hasClass("codeview")},this.toggle=function(){this.isActivated()?this.deactivate():this.activate(),a.triggerEvent("codeview.toggled")},this.activate=function(){if(d.val(dom.html(c,e.prettifyHtml)),d.height(c.height()),a.invoke("toolbar.updateCodeview",!0),b.addClass("codeview"),d.focus(),agent.hasCodeMirror){var f=CodeMirror.fromTextArea(d[0],e.codemirror);if(e.codemirror.tern){var g=new CodeMirror.TernServer(e.codemirror.tern);f.ternServer=g,f.on("cursorActivity",function(a){g.updateArgHints(a)})}f.setSize(null,c.outerHeight()),d.data("cmEditor",f)}},this.deactivate=function(){if(agent.hasCodeMirror){var f=d.data("cmEditor");d.val(f.getValue()),f.toTextArea()}var g=dom.value(d,e.prettifyHtml)||dom.emptyPara,h=c.html()!==g;c.html(g),c.height(e.height?d.height():"auto"),b.removeClass("codeview"),h&&a.triggerEvent("change",c.html(),c),c.focus(),a.invoke("toolbar.updateCodeview",!1)},this.destroy=function(){this.isActivated()&&this.deactivate()}},EDITABLE_PADDING=24,Statusbar=function(a){var b=$(document),c=a.layoutInfo.statusbar,d=a.layoutInfo.editable,e=a.options;this.initialize=function(){e.airMode||e.disableResizeEditor||c.on("mousedown",function(a){a.preventDefault(),a.stopPropagation();var c=d.offset().top-b.scrollTop();b.on("mousemove",function(a){var b=a.clientY-(c+EDITABLE_PADDING);b=e.minheight>0?Math.max(b,e.minheight):b,b=e.maxHeight>0?Math.min(b,e.maxHeight):b,d.height(b)}).one("mouseup",function(){b.off("mousemove")})})},this.destroy=function(){c.off(),c.remove()}},Fullscreen=function(a){var b=a.layoutInfo.editor,c=a.layoutInfo.toolbar,d=a.layoutInfo.editable,e=a.layoutInfo.codable,f=$(window),g=$("html, body");this.toggle=function(){var h=function(a){d.css("height",a.h),e.css("height",a.h),e.data("cmeditor")&&e.data("cmeditor").setsize(null,a.h)};b.toggleClass("fullscreen"),this.isFullscreen()?(d.data("orgHeight",d.css("height")),f.on("resize",function(){h({h:f.height()-c.outerHeight()})}).trigger("resize"),g.css("overflow","hidden")):(f.off("resize"),h({h:d.data("orgHeight")}),g.css("overflow","visible")),a.invoke("toolbar.updateFullscreen",this.isFullscreen())},this.isFullscreen=function(){return b.hasClass("fullscreen")}},Handle=function(a){var b=this,c=$(document),d=a.layoutInfo.editingArea,e=a.options;this.events={"summernote.mousedown":function(a,c){b.update(c.target)&&c.preventDefault()},"summernote.keyup summernote.scroll summernote.change summernote.dialog.shown":function(){b.update()}},this.initialize=function(){this.$handle=$(['<div class="note-handle">','<div class="note-control-selection">','<div class="note-control-selection-bg"></div>','<div class="note-control-holder note-control-nw"></div>','<div class="note-control-holder note-control-ne"></div>','<div class="note-control-holder note-control-sw"></div>','<div class="',e.disableResizeImage?"note-control-holder":"note-control-sizing",' note-control-se"></div>',e.disableResizeImage?"":'<div class="note-control-selection-info"></div>',"</div>","</div>"].join("")).prependTo(d),this.$handle.on("mousedown",function(d){if(dom.isControlSizing(d.target)){d.preventDefault(),d.stopPropagation();var e=b.$handle.find(".note-control-selection").data("target"),f=e.offset(),g=c.scrollTop();c.on("mousemove",function(c){a.invoke("editor.resizeTo",{x:c.clientX-f.left,y:c.clientY-(f.top-g)},e,!c.shiftKey),b.update(e[0])}).one("mouseup",function(b){b.preventDefault(),c.off("mousemove"),a.invoke("editor.afterCommand")}),e.data("ratio")||e.data("ratio",e.height()/e.width())}})},this.destroy=function(){this.$handle.remove()},this.update=function(b){var c=dom.isImg(b),d=this.$handle.find(".note-control-selection");if(a.invoke("imagePopover.update",b),c){var e=$(b),f=e.position(),g={w:e.outerWidth(!0),h:e.outerHeight(!0)};d.css({display:"block",left:f.left,top:f.top,width:g.w,height:g.h}).data("target",e);var h=g.w+"x"+g.h;d.find(".note-control-selection-info").text(h),a.invoke("editor.saveTarget",b)}else this.hide();return c},this.hide=function(){a.invoke("editor.clearTarget"),this.$handle.children().hide()}},AutoLink=function(a){var b=this,c="http://",d=/^([A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?|mailto:[A-Z0-9._%+-]+@)?(www\.)?(.+)$/i;this.events={"summernote.keyup":function(a,c){c.isDefaultPrevented()||b.handleKeyup(c)},"summernote.keydown":function(a,c){b.handleKeydown(c)}},this.initialize=function(){this.lastWordRange=null},this.destroy=function(){this.lastWordRange=null},this.replace=function(){if(this.lastWordRange){var b=this.lastWordRange.toString(),e=b.match(d);if(e&&(e[1]||e[2])){var f=e[1]?b:c+b,g=$("<a />").html(b).attr("href",f)[0];this.lastWordRange.insertNode(g),this.lastWordRange=null,a.invoke("editor.focus")}}},this.handleKeydown=function(b){if(list.contains([key.code.ENTER,key.code.SPACE],b.keyCode)){var c=a.invoke("editor.createRange").getWordRange();this.lastWordRange=c}},this.handleKeyup=function(a){list.contains([key.code.ENTER,key.code.SPACE],a.keyCode)&&this.replace()}},AutoSync=function(a){var b=a.layoutInfo.note;this.events={"summernote.change":function(){b.val(a.invoke("code"))}},this.shouldInitialize=function(){return dom.isTextarea(b[0])}},Placeholder=function(a){var b=this,c=a.layoutInfo.editingArea,d=a.options;this.events={"summernote.init summernote.change":function(){b.update()},"summernote.codeview.toggled":function(){b.update()}},this.shouldInitialize=function(){return!!d.placeholder},this.initialize=function(){this.$placeholder=$('<div class="note-placeholder">'),this.$placeholder.on("click",function(){a.invoke("focus")}).text(d.placeholder).prependTo(c)},this.destroy=function(){this.$placeholder.remove()},this.update=function(){var b=!a.invoke("codeview.isActivated")&&a.invoke("editor.isEmpty");this.$placeholder.toggle(b)}},Buttons=function(a){var b=this,c=$.summernote.ui,d=a.layoutInfo.toolbar,e=a.options,f=e.langInfo,g=func.invertObject(e.keyMap[agent.isMac?"mac":"pc"]),h=this.representShortcut=function(a){var b=g[a];return e.shortcuts&&b?(agent.isMac&&(b=b.replace("CMD","⌘").replace("SHIFT","⇧")),b=b.replace("BACKSLASH","\\").replace("SLASH","/").replace("LEFTBRACKET","[").replace("RIGHTBRACKET","]")," ("+b+")"):""};this.initialize=function(){this.addToolbarButtons(),this.addImagePopoverButtons(),this.addLinkPopoverButtons(),this.fontInstalledMap={}},this.destroy=function(){delete this.fontInstalledMap},this.isFontInstalled=function(a){return b.fontInstalledMap.hasOwnProperty(a)||(b.fontInstalledMap[a]=agent.isFontInstalled(a)||list.contains(e.fontNamesIgnoreCheck,a)),b.fontInstalledMap[a]},this.addToolbarButtons=function(){a.memo("button.style",function(){return c.buttonGroup([c.button({className:"dropdown-toggle",contents:c.icon(e.icons.magic)+" "+c.icon(e.icons.caret,"span"),tooltip:f.style.style,data:{toggle:"dropdown"}}),c.dropdown({className:"dropdown-style",items:a.options.styleTags,template:function(a){"string"==typeof a&&(a={tag:a,title:f.style.hasOwnProperty(a)?f.style[a]:a});var b=a.tag,c=a.title,d=a.style?' style="'+a.style+'" ':"",e=a.className?' class="'+a.className+'"':"";return"<"+b+d+e+">"+c+"</"+b+">"},click:a.createInvokeHandler("editor.formatBlock")})]).render()}),a.memo("button.bold",function(){return c.button({className:"note-btn-bold",contents:c.icon(e.icons.bold),tooltip:f.font.bold+h("bold"),click:a.createInvokeHandler("editor.bold")}).render()}),a.memo("button.italic",function(){return c.button({className:"note-btn-italic",contents:c.icon(e.icons.italic),tooltip:f.font.italic+h("italic"),click:a.createInvokeHandler("editor.italic")}).render()}),a.memo("button.underline",function(){return c.button({className:"note-btn-underline",contents:c.icon(e.icons.underline),tooltip:f.font.underline+h("underline"),click:a.createInvokeHandler("editor.underline")}).render()}),a.memo("button.clear",function(){return c.button({contents:c.icon(e.icons.eraser),tooltip:f.font.clear+h("removeFormat"),click:a.createInvokeHandler("editor.removeFormat")}).render()}),a.memo("button.strikethrough",function(){return c.button({className:"note-btn-strikethrough",contents:c.icon(e.icons.strikethrough),tooltip:f.font.strikethrough+h("strikethrough"),click:a.createInvokeHandler("editor.strikethrough")}).render()}),a.memo("button.superscript",function(){return c.button({className:"note-btn-superscript",contents:c.icon(e.icons.superscript),tooltip:f.font.superscript,click:a.createInvokeHandler("editor.superscript")}).render()}),a.memo("button.subscript",function(){return c.button({className:"note-btn-subscript",contents:c.icon(e.icons.subscript),tooltip:f.font.subscript,click:a.createInvokeHandler("editor.subscript")}).render()}),a.memo("button.fontname",function(){return c.buttonGroup([c.button({className:"dropdown-toggle",contents:'<span class="note-current-fontname"/> '+c.icon(e.icons.caret,"span"),tooltip:f.font.name,data:{toggle:"dropdown"}}),c.dropdownCheck({className:"dropdown-fontname",checkClassName:e.icons.menuCheck,items:e.fontNames.filter(b.isFontInstalled),template:function(a){return'<span style="font-family:'+a+'">'+a+"</span>"},click:a.createInvokeHandler("editor.fontName")})]).render()}),a.memo("button.fontsize",function(){return c.buttonGroup([c.button({className:"dropdown-toggle",contents:'<span class="note-current-fontsize"/>'+c.icon(e.icons.caret,"span"),tooltip:f.font.size,data:{toggle:"dropdown"}}),c.dropdownCheck({className:"dropdown-fontsize",checkClassName:e.icons.menuCheck,items:e.fontSizes,click:a.createInvokeHandler("editor.fontSize")})]).render()}),a.memo("button.color",function(){return c.buttonGroup({className:"note-color",children:[c.button({className:"note-current-color-button",contents:c.icon(e.icons.font+" note-recent-color"),tooltip:f.color.recent,click:function(b){var c=$(b.currentTarget);a.invoke("editor.color",{backColor:c.attr("data-backColor"),foreColor:c.attr("data-foreColor")})},callback:function(a){var b=a.find(".note-recent-color");b.css("background-color","#FFFF00"),a.attr("data-backColor","#FFFF00")}}),c.button({className:"dropdown-toggle",contents:c.icon(e.icons.caret,"span"),tooltip:f.color.more,data:{toggle:"dropdown"}}),c.dropdown({items:["<li>",'<div class="btn-group">',' <div class="note-palette-title">'+f.color.background+"</div>"," <div>",' <button type="button" class="note-color-reset btn btn-default" data-event="backColor" data-value="inherit">',f.color.transparent," </button>"," </div>",' <div class="note-holder" data-event="backColor"/>',"</div>",'<div class="btn-group">',' <div class="note-palette-title">'+f.color.foreground+"</div>"," <div>",' <button type="button" class="note-color-reset btn btn-default" data-event="removeFormat" data-value="foreColor">',f.color.resetToDefault," </button>"," </div>",' <div class="note-holder" data-event="foreColor"/>',"</div>","</li>"].join(""),callback:function(a){a.find(".note-holder").each(function(){var a=$(this);a.append(c.palette({colors:e.colors,eventName:a.data("event")}).render())})},click:function(b){var c=$(b.target),d=c.data("event"),e=c.data("value");if(d&&e){var f="backColor"===d?"background-color":"color",g=c.closest(".note-color").find(".note-recent-color"),h=c.closest(".note-color").find(".note-current-color-button");g.css(f,e),h.attr("data-"+d,e),a.invoke("editor."+d,e)}}})]}).render()}),a.memo("button.ul",function(){return c.button({contents:c.icon(e.icons.unorderedlist),tooltip:f.lists.unordered+h("insertUnorderedList"),click:a.createInvokeHandler("editor.insertUnorderedList")}).render()}),a.memo("button.ol",function(){return c.button({contents:c.icon(e.icons.orderedlist),tooltip:f.lists.ordered+h("insertOrderedList"),click:a.createInvokeHandler("editor.insertOrderedList")}).render()});var d=c.button({contents:c.icon(e.icons.alignLeft),tooltip:f.paragraph.left+h("justifyLeft"),click:a.createInvokeHandler("editor.justifyLeft")}),g=c.button({contents:c.icon(e.icons.alignCenter),tooltip:f.paragraph.center+h("justifyCenter"),click:a.createInvokeHandler("editor.justifyCenter")}),i=c.button({contents:c.icon(e.icons.alignRight),tooltip:f.paragraph.right+h("justifyRight"),click:a.createInvokeHandler("editor.justifyRight")}),j=c.button({contents:c.icon(e.icons.alignJustify),tooltip:f.paragraph.justify+h("justifyFull"),click:a.createInvokeHandler("editor.justifyFull")}),k=c.button({contents:c.icon(e.icons.outdent),tooltip:f.paragraph.outdent+h("outdent"),click:a.createInvokeHandler("editor.outdent")}),l=c.button({contents:c.icon(e.icons.indent),tooltip:f.paragraph.indent+h("indent"),click:a.createInvokeHandler("editor.indent")});a.memo("button.justifyLeft",func.invoke(d,"render")),a.memo("button.justifyCenter",func.invoke(g,"render")),a.memo("button.justifyRight",func.invoke(i,"render")),a.memo("button.justifyFull",func.invoke(j,"render")),a.memo("button.outdent",func.invoke(k,"render")),a.memo("button.indent",func.invoke(l,"render")),a.memo("button.paragraph",function(){return c.buttonGroup([c.button({className:"dropdown-toggle",contents:c.icon(e.icons.alignLeft)+" "+c.icon(e.icons.caret,"span"),tooltip:f.paragraph.paragraph,data:{toggle:"dropdown"}}),c.dropdown([c.buttonGroup({className:"note-align",children:[d,g,i,j] +}),c.buttonGroup({className:"note-list",children:[k,l]})])]).render()}),a.memo("button.height",function(){return c.buttonGroup([c.button({className:"dropdown-toggle",contents:c.icon(e.icons.textHeight)+" "+c.icon(e.icons.caret,"span"),tooltip:f.font.height,data:{toggle:"dropdown"}}),c.dropdownCheck({items:e.lineHeights,checkClassName:e.icons.menuCheck,className:"dropdown-line-height",click:a.createInvokeHandler("editor.lineHeight")})]).render()}),a.memo("button.table",function(){return c.buttonGroup([c.button({className:"dropdown-toggle",contents:c.icon(e.icons.table)+" "+c.icon(e.icons.caret,"span"),tooltip:f.table.table,data:{toggle:"dropdown"}}),c.dropdown({className:"note-table",items:['<div class="note-dimension-picker">',' <div class="note-dimension-picker-mousecatcher" data-event="insertTable" data-value="1x1"/>',' <div class="note-dimension-picker-highlighted"/>',' <div class="note-dimension-picker-unhighlighted"/>',"</div>",'<div class="note-dimension-display">1 x 1</div>'].join("")})],{callback:function(c){var d=c.find(".note-dimension-picker-mousecatcher");d.css({width:e.insertTableMaxSize.col+"em",height:e.insertTableMaxSize.row+"em"}).mousedown(a.createInvokeHandler("editor.insertTable")).on("mousemove",b.tableMoveHandler)}}).render()}),a.memo("button.link",function(){return c.button({contents:c.icon(e.icons.link),tooltip:f.link.link+h("linkDialog.show"),click:a.createInvokeHandler("linkDialog.show")}).render()}),a.memo("button.picture",function(){return c.button({contents:c.icon(e.icons.picture),tooltip:f.image.image,click:a.createInvokeHandler("imageDialog.show")}).render()}),a.memo("button.video",function(){return c.button({contents:c.icon(e.icons.video),tooltip:f.video.video,click:a.createInvokeHandler("videoDialog.show")}).render()}),a.memo("button.hr",function(){return c.button({contents:c.icon(e.icons.minus),tooltip:f.hr.insert+h("insertHorizontalRule"),click:a.createInvokeHandler("editor.insertHorizontalRule")}).render()}),a.memo("button.fullscreen",function(){return c.button({className:"btn-fullscreen",contents:c.icon(e.icons.arrowsAlt),tooltip:f.options.fullscreen,click:a.createInvokeHandler("fullscreen.toggle")}).render()}),a.memo("button.codeview",function(){return c.button({className:"btn-codeview",contents:c.icon(e.icons.code),tooltip:f.options.codeview,click:a.createInvokeHandler("codeview.toggle")}).render()}),a.memo("button.redo",function(){return c.button({contents:c.icon(e.icons.redo),tooltip:f.history.redo+h("redo"),click:a.createInvokeHandler("editor.redo")}).render()}),a.memo("button.undo",function(){return c.button({contents:c.icon(e.icons.undo),tooltip:f.history.undo+h("undo"),click:a.createInvokeHandler("editor.undo")}).render()}),a.memo("button.help",function(){return c.button({contents:c.icon(e.icons.question),tooltip:f.options.help,click:a.createInvokeHandler("helpDialog.show")}).render()})},this.addImagePopoverButtons=function(){a.memo("button.imageSize100",function(){return c.button({contents:'<span class="note-fontsize-10">100%</span>',tooltip:f.image.resizeFull,click:a.createInvokeHandler("editor.resize","1")}).render()}),a.memo("button.imageSize50",function(){return c.button({contents:'<span class="note-fontsize-10">50%</span>',tooltip:f.image.resizeHalf,click:a.createInvokeHandler("editor.resize","0.5")}).render()}),a.memo("button.imageSize25",function(){return c.button({contents:'<span class="note-fontsize-10">25%</span>',tooltip:f.image.resizeQuarter,click:a.createInvokeHandler("editor.resize","0.25")}).render()}),a.memo("button.floatLeft",function(){return c.button({contents:c.icon(e.icons.alignLeft),tooltip:f.image.floatLeft,click:a.createInvokeHandler("editor.floatMe","left")}).render()}),a.memo("button.floatRight",function(){return c.button({contents:c.icon(e.icons.alignRight),tooltip:f.image.floatRight,click:a.createInvokeHandler("editor.floatMe","right")}).render()}),a.memo("button.floatNone",function(){return c.button({contents:c.icon(e.icons.alignJustify),tooltip:f.image.floatNone,click:a.createInvokeHandler("editor.floatMe","none")}).render()}),a.memo("button.removeMedia",function(){return c.button({contents:c.icon(e.icons.trash),tooltip:f.image.remove,click:a.createInvokeHandler("editor.removeMedia")}).render()})},this.addLinkPopoverButtons=function(){a.memo("button.linkDialogShow",function(){return c.button({contents:c.icon(e.icons.link),tooltip:f.link.edit,click:a.createInvokeHandler("linkDialog.show")}).render()}),a.memo("button.unlink",function(){return c.button({contents:c.icon(e.icons.unlink),tooltip:f.link.unlink,click:a.createInvokeHandler("editor.unlink")}).render()})},this.build=function(b,d){for(var e=0,f=d.length;f>e;e++){for(var g=d[e],h=g[0],i=g[1],j=c.buttonGroup({className:"note-"+h}).render(),k=0,l=i.length;l>k;k++){var m=a.memo("button."+i[k]);m&&j.append("function"==typeof m?m(a):m)}j.appendTo(b)}},this.updateCurrentStyle=function(){var c=a.invoke("editor.currentStyle");if(this.updateBtnStates({".note-btn-bold":function(){return"bold"===c["font-bold"]},".note-btn-italic":function(){return"italic"===c["font-italic"]},".note-btn-underline":function(){return"underline"===c["font-underline"]},".note-btn-subscript":function(){return"subscript"===c["font-subscript"]},".note-btn-superscript":function(){return"superscript"===c["font-superscript"]},".note-btn-strikethrough":function(){return"strikethrough"===c["font-strikethrough"]}}),c["font-family"]){var e=c["font-family"].split(",").map(function(a){return a.replace(/[\'\"]/g,"").replace(/\s+$/,"").replace(/^\s+/,"")}),f=list.find(e,b.isFontInstalled);d.find(".dropdown-fontname li a").each(function(){var a=$(this).data("value")+""==f+"";this.className=a?"checked":""}),d.find(".note-current-fontname").text(f)}if(c["font-size"]){var g=c["font-size"];d.find(".dropdown-fontsize li a").each(function(){var a=$(this).data("value")+""==g+"";this.className=a?"checked":""}),d.find(".note-current-fontsize").text(g)}if(c["line-height"]){var h=c["line-height"];d.find(".dropdown-line-height li a").each(function(){var a=$(this).data("value")+""==h+"";this.className=a?"checked":""})}},this.updateBtnStates=function(a){$.each(a,function(a,b){c.toggleBtnActive(d.find(a),b())})},this.tableMoveHandler=function(a){var b,c=18,d=$(a.target.parentNode),f=d.next(),g=d.find(".note-dimension-picker-mousecatcher"),h=d.find(".note-dimension-picker-highlighted"),i=d.find(".note-dimension-picker-unhighlighted");if(void 0===a.offsetX){var j=$(a.target).offset();b={x:a.pageX-j.left,y:a.pageY-j.top}}else b={x:a.offsetX,y:a.offsetY};var k={c:Math.ceil(b.x/c)||1,r:Math.ceil(b.y/c)||1};h.css({width:k.c+"em",height:k.r+"em"}),g.data("value",k.c+"x"+k.r),3<k.c&&k.c<e.insertTableMaxSize.col&&i.css({width:k.c+1+"em"}),3<k.r&&k.r<e.insertTableMaxSize.row&&i.css({height:k.r+1+"em"}),f.html(k.c+" x "+k.r)}},Toolbar=function(a){var b=$.summernote.ui,c=a.layoutInfo.note,d=a.layoutInfo.toolbar,e=a.options;this.shouldInitialize=function(){return!e.airMode},this.initialize=function(){e.toolbar=e.toolbar||[],e.toolbar.length?a.invoke("buttons.build",d,e.toolbar):d.hide(),e.toolbarContainer&&d.appendTo(e.toolbarContainer),c.on("summernote.keyup summernote.mouseup summernote.change",function(){a.invoke("buttons.updateCurrentStyle")}),a.invoke("buttons.updateCurrentStyle")},this.destroy=function(){d.children().remove()},this.updateFullscreen=function(a){b.toggleBtnActive(d.find(".btn-fullscreen"),a)},this.updateCodeview=function(a){b.toggleBtnActive(d.find(".btn-codeview"),a),a?this.deactivate():this.activate()},this.activate=function(a){var c=d.find("button");a||(c=c.not(".btn-codeview")),b.toggleBtn(c,!0)},this.deactivate=function(a){var c=d.find("button");a||(c=c.not(".btn-codeview")),b.toggleBtn(c,!1)}},LinkDialog=function(a){var b=this,c=$.summernote.ui,d=a.layoutInfo.editor,e=a.options,f=e.langInfo;this.initialize=function(){var a=e.dialogsInBody?$(document.body):d,b='<div class="form-group"><label>'+f.link.textToDisplay+'</label><input class="note-link-text form-control" type="text" /></div><div class="form-group"><label>'+f.link.url+'</label><input class="note-link-url form-control" type="text" value="http://" /></div>'+(e.disableLinkTarget?"":'<div class="checkbox"><label><input type="checkbox" checked> '+f.link.openInNewWindow+"</label></div>"),g='<button href="#" class="btn btn-primary note-link-btn disabled" disabled>'+f.link.insert+"</button>";this.$dialog=c.dialog({className:"link-dialog",title:f.link.insert,fade:e.dialogsFade,body:b,footer:g}).render().appendTo(a)},this.destroy=function(){c.hideDialog(this.$dialog),this.$dialog.remove()},this.bindEnterKey=function(a,b){a.on("keypress",function(a){a.keyCode===key.code.ENTER&&b.trigger("click")})},this.toggleLinkBtn=function(a,b,d){c.toggleBtn(a,b.val()&&d.val())},this.showLinkDialog=function(d){return $.Deferred(function(e){var f=b.$dialog.find(".note-link-text"),g=b.$dialog.find(".note-link-url"),h=b.$dialog.find(".note-link-btn"),i=b.$dialog.find("input[type=checkbox]");c.onDialogShown(b.$dialog,function(){a.triggerEvent("dialog.shown"),d.url||(d.url=d.text),f.val(d.text);var c=function(){b.toggleLinkBtn(h,f,g),d.text=f.val()};f.on("input",c).on("paste",function(){setTimeout(c,0)});var j=function(){b.toggleLinkBtn(h,f,g),d.text||f.val(g.val())};g.on("input",j).on("paste",function(){setTimeout(j,0)}).val(d.url).trigger("focus"),b.toggleLinkBtn(h,f,g),b.bindEnterKey(g,h),b.bindEnterKey(f,h),i.prop("checked",d.isNewWindow),h.one("click",function(a){a.preventDefault(),e.resolve({range:d.range,url:g.val(),text:f.val(),isNewWindow:i.is(":checked")}),b.$dialog.modal("hide")})}),c.onDialogHidden(b.$dialog,function(){f.off("input paste keypress"),g.off("input paste keypress"),h.off("click"),"pending"===e.state()&&e.reject()}),c.showDialog(b.$dialog)}).promise()},this.show=function(){var b=a.invoke("editor.getLinkInfo");a.invoke("editor.saveRange"),this.showLinkDialog(b).then(function(b){a.invoke("editor.restoreRange"),a.invoke("editor.createLink",b)}).fail(function(){a.invoke("editor.restoreRange")})},a.memo("help.linkDialog.show",e.langInfo.help["linkDialog.show"])},LinkPopover=function(a){var b=this,c=$.summernote.ui,d=a.options;this.events={"summernote.keyup summernote.mouseup summernote.change summernote.scroll":function(){b.update()},"summernote.dialog.shown":function(){b.hide()}},this.shouldInitialize=function(){return!list.isEmpty(d.popover.link)},this.initialize=function(){this.$popover=c.popover({className:"note-link-popover",callback:function(a){var b=a.find(".popover-content");b.prepend('<span><a target="_blank"></a> </span>')}}).render().appendTo("body");var b=this.$popover.find(".popover-content");a.invoke("buttons.build",b,d.popover.link)},this.destroy=function(){this.$popover.remove()},this.update=function(){if(!a.invoke("editor.hasFocus"))return void this.hide();var b=a.invoke("editor.createRange");if(b.isCollapsed()&&b.isOnAnchor()){var c=dom.ancestor(b.sc,dom.isAnchor),d=$(c).attr("href");this.$popover.find("a").attr("href",d).html(d);var e=dom.posFromPlaceholder(c);this.$popover.css({display:"block",left:e.left,top:e.top})}else this.hide()},this.hide=function(){this.$popover.hide()}},ImageDialog=function(a){var b=this,c=$.summernote.ui,d=a.layoutInfo.editor,e=a.options,f=e.langInfo;this.initialize=function(){var a=e.dialogsInBody?$(document.body):d,b="";if(e.maximumImageFileSize){var g=Math.floor(Math.log(e.maximumImageFileSize)/Math.log(1024)),h=1*(e.maximumImageFileSize/Math.pow(1024,g)).toFixed(2)+" "+" KMGTP"[g]+"B";b="<small>"+f.image.maximumFileSize+" : "+h+"</small>"}var i='<div class="form-group note-group-select-from-files"><label>'+f.image.selectFromFiles+'</label><input class="note-image-input form-control" type="file" name="files" accept="image/*" multiple="multiple" />'+b+'</div><div class="form-group note-group-image-url" style="overflow:auto;"><label>'+f.image.url+'</label><input class="note-image-url form-control col-md-12" type="text" /></div>',j='<button href="#" class="btn btn-primary note-image-btn disabled" disabled>'+f.image.insert+"</button>";this.$dialog=c.dialog({title:f.image.insert,fade:e.dialogsFade,body:i,footer:j}).render().appendTo(a)},this.destroy=function(){c.hideDialog(this.$dialog),this.$dialog.remove()},this.bindEnterKey=function(a,b){a.on("keypress",function(a){a.keyCode===key.code.ENTER&&b.trigger("click")})},this.show=function(){a.invoke("editor.saveRange"),this.showImageDialog().then(function(d){c.hideDialog(b.$dialog),a.invoke("editor.restoreRange"),"string"==typeof d?a.invoke("editor.insertImage",d):a.invoke("editor.insertImagesOrCallback",d)}).fail(function(){a.invoke("editor.restoreRange")})},this.showImageDialog=function(){return $.Deferred(function(d){var e=b.$dialog.find(".note-image-input"),f=b.$dialog.find(".note-image-url"),g=b.$dialog.find(".note-image-btn");c.onDialogShown(b.$dialog,function(){a.triggerEvent("dialog.shown"),e.replaceWith(e.clone().on("change",function(){d.resolve(this.files||this.value)}).val("")),g.click(function(a){a.preventDefault(),d.resolve(f.val())}),f.on("keyup paste",function(){var a=f.val();c.toggleBtn(g,a)}).val("").trigger("focus"),b.bindEnterKey(f,g)}),c.onDialogHidden(b.$dialog,function(){e.off("change"),f.off("keyup paste keypress"),g.off("click"),"pending"===d.state()&&d.reject()}),c.showDialog(b.$dialog)})}},ImagePopover=function(a){var b=$.summernote.ui,c=a.options;this.shouldInitialize=function(){return!list.isEmpty(c.popover.image)},this.initialize=function(){this.$popover=b.popover({className:"note-image-popover"}).render().appendTo("body");var d=this.$popover.find(".popover-content");a.invoke("buttons.build",d,c.popover.image)},this.destroy=function(){this.$popover.remove()},this.update=function(a){if(dom.isImg(a)){var b=dom.posFromPlaceholder(a);this.$popover.css({display:"block",left:b.left,top:b.top})}else this.hide()},this.hide=function(){this.$popover.hide()}},VideoDialog=function(a){var b=this,c=$.summernote.ui,d=a.layoutInfo.editor,e=a.options,f=e.langInfo;this.initialize=function(){var a=e.dialogsInBody?$(document.body):d,b='<div class="form-group row-fluid"><label>'+f.video.url+' <small class="text-muted">'+f.video.providers+'</small></label><input class="note-video-url form-control span12" type="text" /></div>',g='<button href="#" class="btn btn-primary note-video-btn disabled" disabled>'+f.video.insert+"</button>";this.$dialog=c.dialog({title:f.video.insert,fade:e.dialogsFade,body:b,footer:g}).render().appendTo(a)},this.destroy=function(){c.hideDialog(this.$dialog),this.$dialog.remove()},this.bindEnterKey=function(a,b){a.on("keypress",function(a){a.keyCode===key.code.ENTER&&b.trigger("click")})},this.createVideoNode=function(a){var b,c=/^(?:https?:\/\/)?(?:www\.)?(?:youtu\.be\/|youtube\.com\/(?:embed\/|v\/|watch\?v=|watch\?.+&v=))((\w|-){11})(?:\S+)?$/,d=a.match(c),e=/(?:www\.|\/\/)instagram\.com\/p\/(.[a-zA-Z0-9_-]*)/,f=a.match(e),g=/\/\/vine\.co\/v\/([a-zA-Z0-9]+)/,h=a.match(g),i=/\/\/(player\.)?vimeo\.com\/([a-z]*\/)*([0-9]{6,11})[?]?.*/,j=a.match(i),k=/.+dailymotion.com\/(video|hub)\/([^_]+)[^#]*(#video=([^_&]+))?/,l=a.match(k),m=/\/\/v\.youku\.com\/v_show\/id_(\w+)=*\.html/,n=a.match(m),o=/^.+.(mp4|m4v)$/,p=a.match(o),q=/^.+.(ogg|ogv)$/,r=a.match(q),s=/^.+.(webm)$/,t=a.match(s);if(d&&11===d[1].length){var u=d[1];b=$("<iframe>").attr("frameborder",0).attr("src","//www.youtube.com/embed/"+u).attr("width","640").attr("height","360")}else if(f&&f[0].length)b=$("<iframe>").attr("frameborder",0).attr("src","https://instagram.com/p/"+f[1]+"/embed/").attr("width","612").attr("height","710").attr("scrolling","no").attr("allowtransparency","true");else if(h&&h[0].length)b=$("<iframe>").attr("frameborder",0).attr("src",h[0]+"/embed/simple").attr("width","600").attr("height","600").attr("class","vine-embed");else if(j&&j[3].length)b=$("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("src","//player.vimeo.com/video/"+j[3]).attr("width","640").attr("height","360");else if(l&&l[2].length)b=$("<iframe>").attr("frameborder",0).attr("src","//www.dailymotion.com/embed/video/"+l[2]).attr("width","640").attr("height","360");else if(n&&n[1].length)b=$("<iframe webkitallowfullscreen mozallowfullscreen allowfullscreen>").attr("frameborder",0).attr("height","498").attr("width","510").attr("src","//player.youku.com/embed/"+n[1]);else{if(!(p||r||t))return!1;b=$("<video controls>").attr("src",a).attr("width","640").attr("height","360")}return b.addClass("note-video-clip"),b[0]},this.show=function(){var d=a.invoke("editor.getSelectedText");a.invoke("editor.saveRange"),this.showVideoDialog(d).then(function(d){c.hideDialog(b.$dialog),a.invoke("editor.restoreRange");var e=b.createVideoNode(d);e&&a.invoke("editor.insertNode",e)}).fail(function(){a.invoke("editor.restoreRange")})},this.showVideoDialog=function(d){return $.Deferred(function(e){var f=b.$dialog.find(".note-video-url"),g=b.$dialog.find(".note-video-btn");c.onDialogShown(b.$dialog,function(){a.triggerEvent("dialog.shown"),f.val(d).on("input",function(){c.toggleBtn(g,f.val())}).trigger("focus"),g.click(function(a){a.preventDefault(),e.resolve(f.val())}),b.bindEnterKey(f,g)}),c.onDialogHidden(b.$dialog,function(){f.off("input"),g.off("click"),"pending"===e.state()&&e.reject()}),c.showDialog(b.$dialog)})}},HelpDialog=function(a){var b=this,c=$.summernote.ui,d=a.layoutInfo.editor,e=a.options,f=e.langInfo;this.createShortCutList=function(){var b=e.keyMap[agent.isMac?"mac":"pc"];return Object.keys(b).map(function(c){var d=b[c],e=$('<div><div class="help-list-item"/></div>');return e.append($("<label><kbd>"+c+"</kdb></label>").css({width:180,"margin-right":10})).append($("<span/>").html(a.memo("help."+d)||d)),e.html()}).join("")},this.initialize=function(){var a=e.dialogsInBody?$(document.body):d,b=['<p class="text-center">','<a href="http://summernote.org/" target="_blank">Summernote 0.8.2</a> · ','<a href="https://github.com/summernote/summernote" target="_blank">Project</a> · ','<a href="https://github.com/summernote/summernote/issues" target="_blank">Issues</a>',"</p>"].join("");this.$dialog=c.dialog({title:f.options.help,fade:e.dialogsFade,body:this.createShortCutList(),footer:b,callback:function(a){a.find(".modal-body").css({"max-height":300,overflow:"scroll"})}}).render().appendTo(a)},this.destroy=function(){c.hideDialog(this.$dialog),this.$dialog.remove()},this.showHelpDialog=function(){return $.Deferred(function(d){c.onDialogShown(b.$dialog,function(){a.triggerEvent("dialog.shown"),d.resolve()}),c.showDialog(b.$dialog)}).promise()},this.show=function(){a.invoke("editor.saveRange"),this.showHelpDialog().then(function(){a.invoke("editor.restoreRange")})}},AirPopover=function(a){var b=this,c=$.summernote.ui,d=a.options,e=20;this.events={"summernote.keyup summernote.mouseup summernote.scroll":function(){b.update()},"summernote.change summernote.dialog.shown":function(){b.hide()},"summernote.focusout":function(a,c){agent.isFF||c.relatedTarget&&dom.ancestor(c.relatedTarget,func.eq(b.$popover[0]))||b.hide()}},this.shouldInitialize=function(){return d.airMode&&!list.isEmpty(d.popover.air)},this.initialize=function(){this.$popover=c.popover({className:"note-air-popover"}).render().appendTo("body");var b=this.$popover.find(".popover-content");a.invoke("buttons.build",b,d.popover.air)},this.destroy=function(){this.$popover.remove()},this.update=function(){var b=a.invoke("editor.currentStyle");if(b.range&&!b.range.isCollapsed()){var c=list.last(b.range.getClientRects());if(c){var d=func.rect2bnd(c);this.$popover.css({display:"block",left:Math.max(d.left+d.width/2,0)-e,top:d.top+d.height})}}else this.hide()},this.hide=function(){this.$popover.hide()}},HintPopover=function(a){var b=this,c=$.summernote.ui,d=5,e=a.options.hint||[],f=a.options.hintDirection||"bottom",g=$.isArray(e)?e:[e];this.events={"summernote.keyup":function(a,c){c.isDefaultPrevented()||b.handleKeyup(c)},"summernote.keydown":function(a,c){b.handleKeydown(c)},"summernote.dialog.shown":function(){b.hide()}},this.shouldInitialize=function(){return g.length>0},this.initialize=function(){this.lastWordRange=null,this.$popover=c.popover({className:"note-hint-popover",hideArrow:!0,direction:""}).render().appendTo("body"),this.$popover.hide(),this.$content=this.$popover.find(".popover-content"),this.$content.on("click",".note-hint-item",function(){b.$content.find(".active").removeClass("active"),$(this).addClass("active"),b.replace()})},this.destroy=function(){this.$popover.remove()},this.selectItem=function(a){this.$content.find(".active").removeClass("active"),a.addClass("active"),this.$content[0].scrollTop=a[0].offsetTop-this.$content.innerHeight()/2},this.moveDown=function(){var a=this.$content.find(".note-hint-item.active"),b=a.next();if(b.length)this.selectItem(b);else{var c=a.parent().next();c.length||(c=this.$content.find(".note-hint-group").first()),this.selectItem(c.find(".note-hint-item").first())}},this.moveUp=function(){var a=this.$content.find(".note-hint-item.active"),b=a.prev();if(b.length)this.selectItem(b);else{var c=a.parent().prev();c.length||(c=this.$content.find(".note-hint-group").last()),this.selectItem(c.find(".note-hint-item").last())}},this.replace=function(){var b=this.$content.find(".note-hint-item.active");if(b.length){var c=this.nodeFromItem(b);this.lastWordRange.insertNode(c),range.createFromNode(c).collapse().select(),this.lastWordRange=null,this.hide(),a.invoke("editor.focus")}},this.nodeFromItem=function(a){var b=g[a.data("index")],c=a.data("item"),d=b.content?b.content(c):c;return"string"==typeof d&&(d=dom.createText(d)),d},this.createItemTemplates=function(a,b){var c=g[a];return b.map(function(b,d){var e=$('<div class="note-hint-item"/>');return e.append(c.template?c.template(b):b+""),e.data({index:a,item:b}),0===a&&0===d&&e.addClass("active"),e})},this.handleKeydown=function(a){this.$popover.is(":visible")&&(a.keyCode===key.code.ENTER?(a.preventDefault(),this.replace()):a.keyCode===key.code.UP?(a.preventDefault(),this.moveUp()):a.keyCode===key.code.DOWN&&(a.preventDefault(),this.moveDown()))},this.searchKeyword=function(a,b,c){var d=g[a];if(d&&d.match.test(b)&&d.search){var e=d.match.exec(b);d.search(e[1],c)}else c()},this.createGroup=function(a,c){var d=$('<div class="note-hint-group note-hint-group-'+a+'"/>');return this.searchKeyword(a,c,function(c){c=c||[],c.length&&(d.html(b.createItemTemplates(a,c)),b.show())}),d},this.handleKeyup=function(c){if(list.contains([key.code.ENTER,key.code.UP,key.code.DOWN],c.keyCode)){if(c.keyCode===key.code.ENTER&&this.$popover.is(":visible"))return}else{var e=a.invoke("editor.createRange").getWordRange(),h=e.toString();if(g.length&&h){this.$content.empty();var i=func.rect2bnd(list.last(e.getClientRects()));i&&(this.$popover.hide(),this.lastWordRange=e,g.forEach(function(a,c){a.match.test(h)&&b.createGroup(c,h).appendTo(b.$content)}),"top"===f?this.$popover.css({left:i.left,top:i.top-this.$popover.outerHeight()-d}):this.$popover.css({left:i.left,top:i.top+i.height+d}))}else this.hide()}},this.show=function(){this.$popover.show()},this.hide=function(){this.$popover.hide()}};$.summernote=$.extend($.summernote,{version:"0.8.2",ui:ui,dom:dom,plugins:{},options:{modules:{editor:Editor,clipboard:Clipboard,dropzone:Dropzone,codeview:Codeview,statusbar:Statusbar,fullscreen:Fullscreen,handle:Handle,hintPopover:HintPopover,autoLink:AutoLink,autoSync:AutoSync,placeholder:Placeholder,buttons:Buttons,toolbar:Toolbar,linkDialog:LinkDialog,linkPopover:LinkPopover,imageDialog:ImageDialog,imagePopover:ImagePopover,videoDialog:VideoDialog,helpDialog:HelpDialog,airPopover:AirPopover},buttons:{},lang:"en-US",toolbar:[["style",["style"]],["font",["bold","underline","clear"]],["fontname",["fontname"]],["color",["color"]],["para",["ul","ol","paragraph"]],["table",["table"]],["insert",["link","picture","video"]],["view",["fullscreen","codeview","help"]]],popover:{image:[["imagesize",["imageSize100","imageSize50","imageSize25"]],["float",["floatLeft","floatRight","floatNone"]],["remove",["removeMedia"]]],link:[["link",["linkDialogShow","unlink"]]],air:[["color",["color"]],["font",["bold","underline","clear"]],["para",["ul","paragraph"]],["table",["table"]],["insert",["link","picture"]]]},airMode:!1,width:null,height:null,focus:!1,tabSize:4,styleWithSpan:!0,shortcuts:!0,textareaAutoSync:!0,direction:null,styleTags:["p","blockquote","pre","h1","h2","h3","h4","h5","h6"],fontNames:["Arial","Arial Black","Comic Sans MS","Courier New","Helvetica Neue","Helvetica","Impact","Lucida Grande","Tahoma","Times New Roman","Verdana"],fontSizes:["8","9","10","11","12","14","18","24","36"],colors:[["#000000","#424242","#636363","#9C9C94","#CEC6CE","#EFEFEF","#F7F7F7","#FFFFFF"],["#FF0000","#FF9C00","#FFFF00","#00FF00","#00FFFF","#0000FF","#9C00FF","#FF00FF"],["#F7C6CE","#FFE7CE","#FFEFC6","#D6EFD6","#CEDEE7","#CEE7F7","#D6D6E7","#E7D6DE"],["#E79C9C","#FFC69C","#FFE79C","#B5D6A5","#A5C6CE","#9CC6EF","#B5A5D6","#D6A5BD"],["#E76363","#F7AD6B","#FFD663","#94BD7B","#73A5AD","#6BADDE","#8C7BC6","#C67BA5"],["#CE0000","#E79439","#EFC631","#6BA54A","#4A7B8C","#3984C6","#634AA5","#A54A7B"],["#9C0000","#B56308","#BD9400","#397B21","#104A5A","#085294","#311873","#731842"],["#630000","#7B3900","#846300","#295218","#083139","#003163","#21104A","#4A1031"]],lineHeights:["1.0","1.2","1.4","1.5","1.6","1.8","2.0","3.0"],tableClassName:"table table-bordered",insertTableMaxSize:{col:10,row:10},dialogsInBody:!1,dialogsFade:!1,maximumImageFileSize:null,callbacks:{onInit:null,onFocus:null,onBlur:null,onEnter:null,onKeyup:null,onKeydown:null,onImageUpload:null,onImageUploadError:null},codemirror:{mode:"text/html",htmlMode:!0,lineNumbers:!0},keyMap:{pc:{ENTER:"insertParagraph","CTRL+Z":"undo","CTRL+Y":"redo",TAB:"tab","SHIFT+TAB":"untab","CTRL+B":"bold","CTRL+I":"italic","CTRL+U":"underline","CTRL+SHIFT+S":"strikethrough","CTRL+BACKSLASH":"removeFormat","CTRL+SHIFT+L":"justifyLeft","CTRL+SHIFT+E":"justifyCenter","CTRL+SHIFT+R":"justifyRight","CTRL+SHIFT+J":"justifyFull","CTRL+SHIFT+NUM7":"insertUnorderedList","CTRL+SHIFT+NUM8":"insertOrderedList","CTRL+LEFTBRACKET":"outdent","CTRL+RIGHTBRACKET":"indent","CTRL+NUM0":"formatPara","CTRL+NUM1":"formatH1","CTRL+NUM2":"formatH2","CTRL+NUM3":"formatH3","CTRL+NUM4":"formatH4","CTRL+NUM5":"formatH5","CTRL+NUM6":"formatH6","CTRL+ENTER":"insertHorizontalRule","CTRL+K":"linkDialog.show"},mac:{ENTER:"insertParagraph","CMD+Z":"undo","CMD+SHIFT+Z":"redo",TAB:"tab","SHIFT+TAB":"untab","CMD+B":"bold","CMD+I":"italic","CMD+U":"underline","CMD+SHIFT+S":"strikethrough","CMD+BACKSLASH":"removeFormat","CMD+SHIFT+L":"justifyLeft","CMD+SHIFT+E":"justifyCenter","CMD+SHIFT+R":"justifyRight","CMD+SHIFT+J":"justifyFull","CMD+SHIFT+NUM7":"insertUnorderedList","CMD+SHIFT+NUM8":"insertOrderedList","CMD+LEFTBRACKET":"outdent","CMD+RIGHTBRACKET":"indent","CMD+NUM0":"formatPara","CMD+NUM1":"formatH1","CMD+NUM2":"formatH2","CMD+NUM3":"formatH3","CMD+NUM4":"formatH4","CMD+NUM5":"formatH5","CMD+NUM6":"formatH6","CMD+ENTER":"insertHorizontalRule","CMD+K":"linkDialog.show"}},icons:{align:"note-icon-align",alignCenter:"note-icon-align-center",alignJustify:"note-icon-align-justify",alignLeft:"note-icon-align-left",alignRight:"note-icon-align-right",indent:"note-icon-align-indent",outdent:"note-icon-align-outdent",arrowsAlt:"note-icon-arrows-alt",bold:"note-icon-bold",caret:"note-icon-caret",circle:"note-icon-circle",close:"note-icon-close",code:"note-icon-code",eraser:"note-icon-eraser",font:"note-icon-font",frame:"note-icon-frame",italic:"note-icon-italic",link:"note-icon-link",unlink:"note-icon-chain-broken",magic:"note-icon-magic",menuCheck:"note-icon-check",minus:"note-icon-minus",orderedlist:"note-icon-orderedlist",pencil:"note-icon-pencil",picture:"note-icon-picture",question:"note-icon-question",redo:"note-icon-redo",square:"note-icon-square",strikethrough:"note-icon-strikethrough",subscript:"note-icon-subscript",superscript:"note-icon-superscript",table:"note-icon-table",textHeight:"note-icon-text-height",trash:"note-icon-trash",underline:"note-icon-underline",undo:"note-icon-undo",unorderedlist:"note-icon-unorderedlist",video:"note-icon-video"}}})});
\ No newline at end of file |