Examples of use Trumbowyg
27 | 28 |
29 | Close an editor on clic on "Close" in top right corner.
30 | To reopen an editor, double-click on his text.
31 |
├── src ├── ui │ ├── images │ │ ├── icons │ │ │ ├── bold.png │ │ │ ├── gras.png │ │ │ ├── link.png │ │ │ ├── barre.png │ │ │ ├── close.png │ │ │ ├── image.png │ │ │ ├── italic.png │ │ │ ├── video.png │ │ │ ├── souligne.png │ │ │ ├── underline.png │ │ │ ├── view-html.png │ │ │ ├── attachement.png │ │ │ ├── center-align.png │ │ │ ├── formatting.png │ │ │ ├── fullscreen.png │ │ │ ├── left-align.png │ │ │ ├── ordered-list.png │ │ │ ├── right-align.png │ │ │ ├── justify-align.png │ │ │ ├── strikethrough.png │ │ │ ├── unordered-list.png │ │ │ ├── fullscreen-exit.png │ │ │ └── horizontal-rule.png │ │ └── icons-2x │ │ │ ├── bold.png │ │ │ ├── gras.png │ │ │ ├── link.png │ │ │ ├── barre.png │ │ │ ├── close.png │ │ │ ├── image.png │ │ │ ├── italic.png │ │ │ ├── video.png │ │ │ ├── souligne.png │ │ │ ├── underline.png │ │ │ ├── view-html.png │ │ │ ├── attachement.png │ │ │ ├── formatting.png │ │ │ ├── fullscreen.png │ │ │ ├── left-align.png │ │ │ ├── right-align.png │ │ │ ├── center-align.png │ │ │ ├── justify-align.png │ │ │ ├── ordered-list.png │ │ │ ├── strikethrough.png │ │ │ ├── unordered-list.png │ │ │ ├── fullscreen-exit.png │ │ │ └── horizontal-rule.png │ └── sass │ │ └── trumbowyg.scss ├── langs │ ├── en.js │ ├── zh_cn.js │ ├── ko.js │ ├── ru.js │ ├── fa.js │ ├── es.js │ ├── fi.js │ ├── it.js │ ├── pl.js │ ├── tr.js │ ├── de.js │ ├── es_ar.js │ ├── fr.js │ ├── ca.js │ ├── id.js │ ├── pt.js │ └── ro.js └── trumbowyg.js ├── .gitattributes ├── .gitignore ├── .jshintrc ├── README.md ├── bower.json ├── LICENSE ├── package.json ├── plugins ├── upload │ ├── trumbowyg.upload.php │ └── trumbowyg.upload.js └── base64 │ └── trumbowyg.base64.js ├── Gulpfile.js └── index.html /src/ui/images/icons/bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/bold.png -------------------------------------------------------------------------------- /src/ui/images/icons/gras.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/gras.png -------------------------------------------------------------------------------- /src/ui/images/icons/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/link.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/bold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/bold.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/gras.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/gras.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/link.png -------------------------------------------------------------------------------- /src/ui/images/icons/barre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/barre.png -------------------------------------------------------------------------------- /src/ui/images/icons/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/close.png -------------------------------------------------------------------------------- /src/ui/images/icons/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/image.png -------------------------------------------------------------------------------- /src/ui/images/icons/italic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/italic.png -------------------------------------------------------------------------------- /src/ui/images/icons/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/video.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/barre.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/barre.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/close.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/image.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/image.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/italic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/italic.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/video.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/video.png -------------------------------------------------------------------------------- /src/ui/images/icons/souligne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/souligne.png -------------------------------------------------------------------------------- /src/ui/images/icons/underline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/underline.png -------------------------------------------------------------------------------- /src/ui/images/icons/view-html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/view-html.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/souligne.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/souligne.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/underline.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/underline.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/view-html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/view-html.png -------------------------------------------------------------------------------- /src/ui/images/icons/attachement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/attachement.png -------------------------------------------------------------------------------- /src/ui/images/icons/center-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/center-align.png -------------------------------------------------------------------------------- /src/ui/images/icons/formatting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/formatting.png -------------------------------------------------------------------------------- /src/ui/images/icons/fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/fullscreen.png -------------------------------------------------------------------------------- /src/ui/images/icons/left-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/left-align.png -------------------------------------------------------------------------------- /src/ui/images/icons/ordered-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/ordered-list.png -------------------------------------------------------------------------------- /src/ui/images/icons/right-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/right-align.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/attachement.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/attachement.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/formatting.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/formatting.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/fullscreen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/fullscreen.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/left-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/left-align.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/right-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/right-align.png -------------------------------------------------------------------------------- /src/ui/images/icons/justify-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/justify-align.png -------------------------------------------------------------------------------- /src/ui/images/icons/strikethrough.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/strikethrough.png -------------------------------------------------------------------------------- /src/ui/images/icons/unordered-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/unordered-list.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/center-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/center-align.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/justify-align.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/justify-align.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/ordered-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/ordered-list.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/strikethrough.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/strikethrough.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/unordered-list.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/unordered-list.png -------------------------------------------------------------------------------- /src/ui/images/icons/fullscreen-exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/fullscreen-exit.png -------------------------------------------------------------------------------- /src/ui/images/icons/horizontal-rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons/horizontal-rule.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/fullscreen-exit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/fullscreen-exit.png -------------------------------------------------------------------------------- /src/ui/images/icons-2x/horizontal-rule.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tscanlin/Trumbowyg/master/src/ui/images/icons-2x/horizontal-rule.png -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | 4 | # SCSS and JS files must always use LF for tools to work 5 | *.js eol=lf 6 | *.scss eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Others 2 | ~$* 3 | /.sass-cache 4 | /uploaded-files 5 | /node_modules 6 | /bower_components 7 | /dist 8 | /src/ui/sass/_sprite* 9 | 10 | 11 | # Windows image file caches 12 | Thumbs.db 13 | 14 | # Folder config file 15 | Desktop.ini 16 | 17 | # Mac crap 18 | .DS_Store -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "expr": true, 3 | "noarg": true, 4 | "onevar": true, 5 | "quotmark": "simple", 6 | "undef": true, 7 | "unused": true, 8 | 9 | "browser": true, 10 | "node": true, 11 | 12 | "globals": { 13 | "jQuery": false 14 | } 15 | } -------------------------------------------------------------------------------- /src/langs/en.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * en.js 3 | * English translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Alexandre Demode (Alex-D) 7 | * Twitter : @AlexandreDemode 8 | * Website : alex-d.fr 9 | */ 10 | 11 | /** 12 | * English is the default languange of Trumbowyg, 13 | * you don't need to include any file :) 14 | */ -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Trumbowyg WYSIWYG Editor 2 | 3 | Trumbowyg is a simple and lightweight WYSIWYG editor, is only 15kB for faster page loading. 4 | 5 | 6 | # Website 7 | 8 | http://alex-d.github.io/Trumbowyg/ 9 | 10 | 11 | # Documentation 12 | 13 | http://alex-d.github.io/Trumbowyg/documentation.html 14 | 15 | 16 | # Contribute 17 | 18 | You can contribute to Trumbowyg with translations in languages you know. 19 | Thanks to `node` and `gulp`, you can improve core script, style or icons easily. 20 | 21 | 22 | # Thanks 23 | 24 | Vinz, who has make some icons for default design. 25 | 26 | 27 | # License 28 | 29 | This project is under MIT license. See LICENSE file for details. -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "trumbowyg", 3 | "version": "1.1.2", 4 | "homepage": "https://github.com/Alex-D/Trumbowyg", 5 | "authors": [ 6 | { 7 | "name": "Alexandre Demode (Alex-D)", 8 | "email": "contact@alex-d.fr", 9 | "homepage": "http://alex-d.fr" 10 | } 11 | ], 12 | "description": "A lightweight WYSIWYG editor", 13 | "main": "dist/trumbowyg.js", 14 | "keywords": [ 15 | "editor", 16 | "wysiwyg", 17 | "javascript", 18 | "richtext" 19 | ], 20 | "license": "MIT", 21 | "ignore": [ 22 | "**/.*", 23 | "bower_components", 24 | "node_modules", 25 | "plugins", 26 | "!dist/plugins", 27 | "test", 28 | "tests", 29 | "src", 30 | "Gulpfile.js", 31 | "package.json" 32 | ], 33 | "dependencies": { 34 | "jquery": ">=1.7" 35 | } 36 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2012-2014 Alexandre Demode (Alex-D) 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "trumbowyg", 3 | "title": "Trumbowyg", 4 | "description": "A lightweight WYSIWYG editor", 5 | "version": "1.1.2", 6 | "main": "dist/trumbowyg.js", 7 | "homepage": "http://alex-d.github.io/Trumbowyg", 8 | "author": { 9 | "name": "Alexandre Demode (Alex-D)", 10 | "email": "contact@alex-d.fr", 11 | "url": "http://alex-d.fr" 12 | }, 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/Alex-D/Trumbowyg.git" 16 | }, 17 | "bugs": { 18 | "url": "https://github.com/Alex-D/Trumbowyg/issues" 19 | }, 20 | "license": "MIT", 21 | "dependencies": { 22 | "bower": "^1.3.9" 23 | }, 24 | "devDependencies": { 25 | "gulp": "^3.8.5", 26 | "gulp-autoprefixer": "0.0.8", 27 | "gulp-clean": "~0.3.1", 28 | "gulp-concat": "~2.3.4", 29 | "gulp-header": "~1.0.5", 30 | "gulp-imagemin": "~1.0.0", 31 | "gulp-jshint": "~1.8.4", 32 | "gulp-livereload": "~2.1.0", 33 | "gulp-load-plugins": "~0.5.3", 34 | "gulp-minify-css": "~0.3.7", 35 | "gulp-newer": "~0.3.0", 36 | "gulp-rename": "~1.2.0", 37 | "gulp-sass": "~0.7.3", 38 | "gulp-size": "~1.0.0", 39 | "gulp.spritesmith": "~1.1.1", 40 | "gulp-uglify": "~0.3.1", 41 | "jshint-stylish": "~0.4.0" 42 | }, 43 | "scripts": { 44 | "build": "npm install && gulp build", 45 | "start": "gulp", 46 | "test": "gulp test" 47 | } 48 | } -------------------------------------------------------------------------------- /plugins/upload/trumbowyg.upload.php: -------------------------------------------------------------------------------- 1 | 'uploadSuccess', 32 | 'file' => $file, 33 | ); 34 | } else { 35 | $error = true; 36 | $data = array( 37 | 'message' => 'uploadError', 38 | ); 39 | } 40 | } else { 41 | $data = array( 42 | 'message' => 'uploadNotAjax', 43 | 'formData' => $_POST 44 | ); 45 | } 46 | 47 | 48 | 49 | echo json_encode($data); -------------------------------------------------------------------------------- /src/langs/zh_cn.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * zh_cn.js 3 | * Simplified Chinese translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Liu Kai (akai) 7 | * Twitter : @akai404 8 | * Github : https://github.com/akai 9 | */ 10 | 11 | jQuery.trumbowyg.langs.zh_cn = { 12 | viewHTML: "源代码", 13 | 14 | formatting: "格式", 15 | p: "段落", 16 | blockquote: "引用", 17 | code: "代码", 18 | header: "标题", 19 | 20 | bold: "加粗", 21 | italic: "斜体", 22 | strikethrough: "删除线", 23 | underline: "下划线", 24 | 25 | strong: "加粗", 26 | em: "斜体", 27 | del: "删除线", 28 | 29 | unorderedList: "无序列表", 30 | orderedList: "有序列表", 31 | 32 | insertImage: "插入图片", 33 | insertVideo: "插入视频", 34 | link: "超链接", 35 | createLink: "插入链接", 36 | unlink: "取消链接", 37 | 38 | justifyLeft: "居左对齐", 39 | justifyCenter: "居中对齐", 40 | justifyRight: "居右对齐", 41 | justifyFull: "两端对齐", 42 | 43 | horizontalRule: "插入分隔线", 44 | 45 | fullscreen: "全屏", 46 | 47 | close: "关闭", 48 | 49 | submit: "确定", 50 | reset: "取消", 51 | 52 | invalidUrl: "无效的 URL", 53 | required: "必需的", 54 | description: "描述", 55 | title: "标题", 56 | text: "文字" 57 | }; -------------------------------------------------------------------------------- /src/langs/ko.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * ko.js 3 | * Korean translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : JoongSeob Vito Kim (dorajistyle) 7 | * Blog : http://dorajistyle.pe.kr 8 | * Github : https://github.com/dorajistyle 9 | */ 10 | 11 | jQuery.trumbowyg.langs.ko = { 12 | viewHTML: "HTML로 보기", 13 | 14 | formatting: "양식", 15 | p: "문단", 16 | blockquote: "인용부호", 17 | code: "코드", 18 | header: "머릿말", 19 | 20 | bold: "진하게", 21 | italic: "기울임", 22 | strikethrough: "취소선", 23 | underline: "밑줄", 24 | 25 | strong: "굵게", 26 | em: "강조", 27 | del: "취소", 28 | 29 | unorderedList: "순차 목록", 30 | orderedList: "비순차 목록", 31 | 32 | insertImage: "이미지 넣기", 33 | insertVideo: "비디오 넣기", 34 | link: "링크", 35 | createLink: "링크 넣기", 36 | unlink: "링크 없애기", 37 | 38 | justifyLeft: "왼쪽 정렬", 39 | justifyCenter: "가운데 정렬", 40 | justifyRight: "오른쪽 정렬", 41 | justifyFull: "혼합 정렬", 42 | 43 | horizontalRule: "가로줄 넣기", 44 | 45 | fullscreen: "전체 화면", 46 | 47 | close: "닫기", 48 | 49 | submit: "전송", 50 | reset: "초기화", 51 | 52 | invalidUrl: "올바르지 않은 URL입니다.", 53 | required: "꼭 입력해야 합니다.", 54 | description: "설명", 55 | title: "제목", 56 | text: "본문 내용" 57 | }; -------------------------------------------------------------------------------- /src/langs/ru.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * ru.js 3 | * Russion translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Yuri Lya 7 | */ 8 | 9 | jQuery.trumbowyg.langs.ru = { 10 | viewHTML: "Посмотреть HTML", 11 | 12 | formatting: "Форматирование", 13 | p: "Обычный", 14 | blockquote: "Цитата", 15 | code: "Код", 16 | header: "Заголовок", 17 | 18 | bold: "Полужирный", 19 | italic: "Курсив", 20 | strikethrough: "Зачеркнутый", 21 | underline: "Подчеркнутый", 22 | 23 | strong: "Полужирный", 24 | em: "Курсив", 25 | del: "Зачеркнутый", 26 | 27 | unorderedList: "Обычный список", 28 | orderedList: "Нумерованный список", 29 | 30 | insertImage: "Вставить изображение", 31 | insertVideo: "Вставить видео", 32 | link: "Ссылка", 33 | createLink: "Вставить ссылку", 34 | unlink: "Удалить ссылку", 35 | 36 | justifyLeft: "По левому краю", 37 | justifyCenter: "По центру", 38 | justifyRight: "По правому краю", 39 | justifyFull: "По ширине", 40 | 41 | horizontalRule: "Горизонтальная линия", 42 | 43 | fullscreen: "Во весь экран", 44 | 45 | close: "Закрыть", 46 | 47 | submit: "Вставить", 48 | reset: "Отменить", 49 | 50 | invalidUrl: "Неверный URL", 51 | required: "Обязательное", 52 | description: "Описание", 53 | title: "Подсказка", 54 | text: "Текст" 55 | }; -------------------------------------------------------------------------------- /src/langs/fa.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * fa.js 3 | * Persian translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Kiarash Soleimanzadeh 7 | * Github : https://github.com/kiyarash 8 | * Email : kiarash.s@hotmail.com 9 | */ 10 | 11 | jQuery.trumbowyg.langs.fa = { 12 | viewHTML: "نمایش کد اچ تی ام ال", 13 | 14 | formatting: "قالب بندی", 15 | p: "پاراگراف", 16 | blockquote: "نقل قول", 17 | code: "کد", 18 | header: "سر تیتر", 19 | 20 | bold: "ضخیم", 21 | italic: "مورب", 22 | strikethrough: "میان خط دار", 23 | underline: "زیر خط دار", 24 | 25 | strong: "برجسته", 26 | em: "مورب", 27 | del: "حذف شده", 28 | 29 | unorderedList: "لیست نامرتب", 30 | orderedList: "لیست مرتب", 31 | 32 | insertImage: "درج تصویر", 33 | insertVideo: "درج ویدئو", 34 | link: "لینک", 35 | createLink: "درج لینک", 36 | unlink: "حذف لینک", 37 | 38 | justifyLeft: "تراز به چپ", 39 | justifyCenter: "تراز به وسط", 40 | justifyRight: "تراز به راست", 41 | justifyFull: "تراز به چپ و راست", 42 | 43 | horizontalRule: "درج خط افقی", 44 | 45 | fullscreen: "تمام صفحه", 46 | 47 | close: "بستن", 48 | 49 | submit: "تائید", 50 | reset: "انصراف", 51 | 52 | invalidUrl: "لینک نامعتبر", 53 | required: "اجباری", 54 | description: "توضیحات", 55 | title: "عنوان", 56 | text: "متن" 57 | }; -------------------------------------------------------------------------------- /src/langs/es.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * es.js 3 | * Spanish translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Moisés Márquez 7 | * Email : moises.marquez.g@gmail.com 8 | */ 9 | 10 | jQuery.trumbowyg.langs.es = { 11 | viewHTML: "Ver HTML", 12 | 13 | formatting: "Formato", 14 | p: "Párrafo", 15 | blockquote: "Cita", 16 | code: "Código", 17 | header: "Título", 18 | 19 | bold: "Negrita", 20 | italic: "Cursiva", 21 | strikethrough: "Tachado", 22 | underline: "Subrayado", 23 | 24 | strong: "Negrita", 25 | em: "Énfasis", 26 | del: "Borrar", 27 | 28 | unorderedList: "Lista Desordenada", 29 | orderedList: "Lista Ordenada", 30 | 31 | insertImage: "Insertar una imagen", 32 | insertVideo: "Insertar un vídeo", 33 | link: "Enlace", 34 | createLink: "Insertar un enlace", 35 | unlink: "Suprimir un enlace", 36 | 37 | justifyLeft: "Izquierda", 38 | justifyCenter: "Centrar", 39 | justifyRight: "Derecha", 40 | justifyFull: "Justificado", 41 | 42 | horizontalRule: "Insertar separador horizontal", 43 | 44 | fullscreen: "Pantalla completa", 45 | 46 | close: "Cerrar", 47 | 48 | submit: "Enviar", 49 | reset: "Cancelar", 50 | 51 | invalidUrl: "URL no válida", 52 | required: "Obligatorio", 53 | description: "Descripción", 54 | title: "Título", 55 | text: "Texto" 56 | }; -------------------------------------------------------------------------------- /src/langs/fi.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * fi.js 3 | * Finnish translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Teppo Koivula (teppokoivula) 7 | * Github : https://github.com/teppokoivula 8 | */ 9 | 10 | jQuery.trumbowyg.langs.fi = { 11 | viewHTML: "Näytä HTML", 12 | 13 | formatting: "Muotoilu", 14 | p: "Kappale", 15 | blockquote: "Lainaus", 16 | code: "Koodi", 17 | header: "Otsikko", 18 | 19 | bold: "Lihavointi", 20 | italic: "Kursivointi", 21 | strikethrough: "Yliviivaus", 22 | underline: "Allevivaus", 23 | 24 | strong: "Vahvennus", 25 | em: "Painotus", 26 | del: "Poistettu", 27 | 28 | unorderedList: "Numeroimaton lista", 29 | orderedList: "Numeroitu lista", 30 | 31 | insertImage: "Lisää kuva", 32 | insertVideo: "Lisää video", 33 | link: "Linkki", 34 | createLink: "Luo linkki", 35 | unlink: "Poista linkki", 36 | 37 | justifyLeft: "Asemoi vasemmalle", 38 | justifyCenter: "Keskitä", 39 | justifyRight: "Asemoi oikealle", 40 | justifyFull: "Tasaa", 41 | 42 | horizontalRule: "Vaakaviiva", 43 | 44 | fullscreen: "Kokoruutu", 45 | 46 | close: "Sulje", 47 | 48 | submit: "Lähetä", 49 | reset: "Palauta", 50 | 51 | invalidUrl: "Viallinen URL-osoite", 52 | required: "Pakollinen", 53 | description: "Kuvaus", 54 | title: "Otsikko", 55 | text: "Teksti" 56 | }; -------------------------------------------------------------------------------- /src/langs/it.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * it.js 3 | * Italian translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Mirko Buffoni 7 | */ 8 | 9 | jQuery.trumbowyg.langs.it = { 10 | viewHTML: "Mostra HTML", 11 | 12 | formatting: "Formattazione", 13 | p: "Paragrafo", 14 | blockquote: "Citazione", 15 | code: "Codice", 16 | header: "Intestazione", 17 | 18 | bold: "Grassetto", 19 | italic: "Italico", 20 | strikethrough: "Barrato", 21 | underline: "Sottolineato", 22 | 23 | strong: "Rafforza", 24 | em: "Enfatizza", 25 | del: "Cancella", 26 | 27 | unorderedList: "Elenco puntato", 28 | orderedList: "Elenco numerato", 29 | 30 | insertImage: "Inserisci immagine", 31 | insertVideo: "Inserisci video", 32 | link: "Collegamento", 33 | createLink: "Crea un collegamento", 34 | unlink: "Elimina collegamento", 35 | 36 | justifyLeft: "Allinea a sinistra", 37 | justifyCenter: "Centra", 38 | justifyRight: "Allinea a destra", 39 | justifyFull: "Giustifica", 40 | 41 | horizontalRule: "Inserisci un separatore orizzontale", 42 | 43 | fullscreen: "Schermo intero", 44 | 45 | close: "Chiudi", 46 | 47 | submit: "Invia", 48 | reset: "Annulla", 49 | 50 | invalidUrl: "URL invalido", 51 | required: "Obbligatorio", 52 | description: "Descrizione", 53 | title: "Titolo", 54 | text: "Testo" 55 | }; -------------------------------------------------------------------------------- /src/langs/pl.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * pl.js 3 | * Polish translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Paweł Abramowicz 7 | * Github : https://github.com/pawelabrams 8 | */ 9 | 10 | jQuery.trumbowyg.langs.pl = { 11 | viewHTML: "Pokaż HTML", 12 | 13 | formatting: "Format", 14 | p: "Akapit", 15 | blockquote: "Cytat", 16 | code: "Kod", 17 | header: "Nagłówek", 18 | 19 | bold: "Pogrubienie", 20 | italic: "Pochylenie", 21 | strikethrough: "Przekreślenie", 22 | underline: "Podkreślenie", 23 | 24 | strong: "Wytłuszczenie", 25 | em: "Uwydatnienie", 26 | del: "Usunięte", 27 | 28 | unorderedList: "Lista nieuporządkowana", 29 | orderedList: "Lista uporządkowana", 30 | 31 | insertImage: "Wstaw obraz", 32 | insertVideo: "Wstaw film", 33 | link: "Link", 34 | createLink: "Wstaw link", 35 | unlink: "Usuń link", 36 | 37 | justifyLeft: "Wyrównaj do lewej", 38 | justifyCenter: "Wyśrodkuj", 39 | justifyRight: "Wyrównaj do prawej", 40 | justifyFull: "Wyjustuj", 41 | 42 | horizontalRule: "Odkreśl linią", 43 | 44 | fullscreen: "Pełny ekran", 45 | 46 | close: "Zamknij", 47 | 48 | submit: "Zastosuj", 49 | reset: "Przywróć", 50 | 51 | invalidUrl: "Nieprawidłowy URL", 52 | required: "Wymagane", 53 | description: "Opis", 54 | title: "Tytuł", 55 | text: "Tekst" 56 | }; -------------------------------------------------------------------------------- /src/langs/tr.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * tr.js 3 | * Turkish translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Emrah Bilbay (munzur) 7 | * Github : https://github.com/munzur 8 | * Website: http://kafe.in/ 9 | */ 10 | 11 | jQuery.trumbowyg.langs.tr = { 12 | viewHTML: "HTML Kodu", 13 | 14 | formatting: "Biçimlendirme", 15 | p: "Paragraf", 16 | blockquote: "Alıntı", 17 | code: "Kod", 18 | header: "Başlık", 19 | 20 | bold: "Kalın", 21 | italic: "İtalik", 22 | strikethrough: "Orta çizgi", 23 | underline: "Alt çigzi", 24 | 25 | strong: "Koyu", 26 | em: "Vurgulu", 27 | del: "Üstü çizilmiş", 28 | 29 | unorderedList: "Numarasız liste", 30 | orderedList: "Numaralı liste", 31 | 32 | insertImage: "Resim yerleştir", 33 | insertVideo: "Video yerleştir", 34 | link: "Link", 35 | createLink: "Link yerleştir", 36 | unlink: "Linki sil", 37 | 38 | justifyLeft: "Sola hizala", 39 | justifyCenter: "Ortaya hizala", 40 | justifyRight: "Sağa hizala", 41 | justifyFull: "Yasla", 42 | 43 | horizontalRule: "Yatay çizgi ekle", 44 | 45 | fullscreen: "Tam ekran", 46 | 47 | close: "Kapat", 48 | 49 | submit: "Onayla", 50 | reset: "Sıfırla", 51 | 52 | invalidUrl: "Hatalı URL", 53 | required: "Gerekli", 54 | description: "Açıklama", 55 | title: "Başlık", 56 | text: "Metin" 57 | }; -------------------------------------------------------------------------------- /src/langs/de.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * de.js 3 | * German translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Manfred Timm 7 | * Github : https://github.com/Manfred62 8 | */ 9 | 10 | jQuery.trumbowyg.langs.de = { 11 | viewHTML: "HTML anzeigen", 12 | 13 | formatting: "Formatieren", 14 | p: "Absatz", 15 | blockquote: "Zitat", 16 | code: "Code", 17 | header: "Überschrift", 18 | 19 | bold: "Fett", 20 | italic: "Kursiv", 21 | strikethrough: "Durchgestrichen", 22 | underline: "Unterstrichen", 23 | 24 | strong: "Wichtig", 25 | em: "Betont", 26 | del: "Gelöscht", 27 | 28 | unorderedList: "Ungeordnete Liste", 29 | orderedList: "Geordnete Liste", 30 | 31 | insertImage: "Bild einfügen", 32 | insertVideo: "Video einfügen", 33 | link: "Link", 34 | createLink: "Link einfügen", 35 | unlink: "Link entfernen", 36 | 37 | justifyLeft: "Links ausrichten", 38 | justifyCenter: "Zentrieren", 39 | justifyRight: "Rechts ausrichten", 40 | justifyFull: "Blocksatz", 41 | 42 | horizontalRule: "Horizontale Linie einfügen", 43 | 44 | fullscreen: "Vollbild", 45 | 46 | close: "Schliessen", 47 | 48 | submit: "Bestätigen", 49 | reset: "Rücksetzen", 50 | 51 | invalidUrl: "Ungültige URL", 52 | required: "Erforderlich", 53 | description: "Beschreibung", 54 | title: "Titel", 55 | text: "Text" 56 | }; -------------------------------------------------------------------------------- /src/langs/es_ar.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * es_ar.js 3 | * Spanish (Argentina) translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Félix Vera 7 | * Email : felix.vera@gmail.com 8 | */ 9 | 10 | jQuery.trumbowyg.langs.es_ar = { 11 | viewHTML: "Ver HTML", 12 | 13 | formatting: "Formato", 14 | p: "Párrafo", 15 | blockquote: "Cita", 16 | code: "Código", 17 | header: "Título", 18 | 19 | bold: "Negrita", 20 | italic: "Itálica", 21 | strikethrough: "Tachado", 22 | underline: "Subrayado", 23 | 24 | strong: "Fuere", 25 | em: "Énfasis", 26 | del: "Borrar", 27 | 28 | unorderedList: "Lista Desordenada", 29 | orderedList: "Lista Ordenada", 30 | 31 | insertImage: "Insertar una imagen", 32 | insertVideo: "Insertar un video", 33 | link: "Vínculo", 34 | createLink: "Insertar un vínculo", 35 | unlink: "Suprimir un vínculo", 36 | 37 | justifyLeft: "Alinear a la Izquierda", 38 | justifyCenter: "Centrar", 39 | justifyRight: "Alinear a la Derecha", 40 | justifyFull: "Justificado", 41 | 42 | horizontalRule: "Insertar separado Horizontal", 43 | 44 | fullscreen: "Pantalla Completa", 45 | 46 | close: "Cerrar", 47 | 48 | submit: "Enviar", 49 | reset: "Cancelar", 50 | 51 | invalidUrl: "URL inválida", 52 | required: "Obligatorio", 53 | description: "Descripción", 54 | title: "Título", 55 | text: "Texto" 56 | }; -------------------------------------------------------------------------------- /src/langs/fr.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * fr.js 3 | * French translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Alexandre Demode (Alex-D) 7 | * Twitter : @AlexandreDemode 8 | * Website : alex-d.fr 9 | */ 10 | 11 | jQuery.trumbowyg.langs.fr = { 12 | viewHTML: "Voir le HTML", 13 | 14 | formatting: "Format", 15 | p: "Paragraphe", 16 | blockquote: "Citation", 17 | code: "Code", 18 | header: "Titre", 19 | 20 | bold: "Gras", 21 | italic: "Italique", 22 | strikethrough: "Rayé", 23 | underline: "Souligné", 24 | 25 | strong: "Fort", 26 | em: "Emphase", 27 | del: "Supprimé", 28 | 29 | unorderedList: "Liste à puces", 30 | orderedList: "Liste ordonnée", 31 | 32 | insertImage: "Insérer une image", 33 | insertVideo: "Insérer une video", 34 | link: "Lien", 35 | createLink: "Insérer un lien", 36 | unlink: "Supprimer le lien", 37 | 38 | justifyLeft: "Aligner à gauche", 39 | justifyCenter: "Centrer", 40 | justifyRight: "Aligner à droite", 41 | justifyFull: "Justifier", 42 | 43 | horizontalRule: "Insérer un séparateur horizontal", 44 | 45 | fullscreen: "Plein écran", 46 | 47 | close: "Fermer", 48 | 49 | submit: "Valider", 50 | reset: "Annuler", 51 | 52 | invalidUrl: "URL invalide", 53 | required: "Obligatoire", 54 | description: "Description", 55 | title: "Titre", 56 | text: "Texte" 57 | }; -------------------------------------------------------------------------------- /src/langs/ca.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * ca.js 3 | * Catalan translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Àlfons Sánchez (alsanan) 7 | * Twitter : @alsanan 8 | * Website : about.me/alsanan 9 | * Github : https://github.com/alsanan 10 | */ 11 | 12 | jQuery.trumbowyg.langs.ca = { 13 | viewHTML: "Veure HTML", 14 | 15 | formatting: "Formatar", 16 | p: "Paragraf", 17 | blockquote: "Citació", 18 | code: "Codi", 19 | header: "Títol", 20 | 21 | bold: "Negreta", 22 | italic: "Itàlica", 23 | strikethrough: "Suprimir", 24 | underline: "Subratllat", 25 | 26 | strong: "Forta", 27 | em: "Èmfasi", 28 | del: "Apagar", 29 | 30 | unorderedList: "Lista desordenada", 31 | orderedList: "Lista ordenada", 32 | 33 | insertImage: "Inserir imatge", 34 | insertVideo: "Inserir vídeo", 35 | link: "Enllaç", 36 | createLink: "Crear un enllaç", 37 | unlink: "Eliminar enllaç", 38 | 39 | justifyLeft: "Alinear a esquerra", 40 | justifyCenter: "Centrar", 41 | justifyRight: "Alinear a dreta", 42 | justifyFull: "Justificar", 43 | 44 | horizontalRule: "Inserir separador horitzontal", 45 | 46 | fullscreen: "Pantalla completa", 47 | 48 | close: "Tancar", 49 | 50 | submit: "Enviar", 51 | reset: "Reiniciar", 52 | 53 | invalidUrl: "URL invàlida", 54 | required: "Obligatori", 55 | description: "Descripció", 56 | title: "Títol", 57 | text: "Text" 58 | }; -------------------------------------------------------------------------------- /src/langs/id.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * id.js 3 | * Indonesian translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Rezha Julio (kimiamania) 7 | * Twitter : @kimiamania 8 | * Website : http://rezhajulio.web.id 9 | * Github : https://github.com/kimiamania 10 | */ 11 | 12 | jQuery.trumbowyg.langs.id = { 13 | viewHTML: "Lihat HTML", 14 | 15 | formatting: "Penyusunan", 16 | p: "Paragraf", 17 | blockquote: "Kutipan", 18 | code: "Kode", 19 | header: "Kepala", 20 | 21 | bold: "Tebal", 22 | italic: "Miring", 23 | strikethrough: "Coret", 24 | underline: "Garis bawah", 25 | 26 | strong: "Tebal", 27 | em: "Miring", 28 | del: "Dicoret", 29 | 30 | unorderedList: "Daftar tak teratur", 31 | orderedList: "Daftar teratur", 32 | 33 | insertImage: "Sisipkan gambar", 34 | insertVideo: "Sisipkan video", 35 | link: "Tautan", 36 | createLink: "Sisipkan Tautan", 37 | unlink: "Singkirkan tautan", 38 | 39 | justifyLeft: "Rata kiri", 40 | justifyCenter: "Rata Tengah", 41 | justifyRight: "Rata kanan", 42 | justifyFull: "Rata kiri dan kanan", 43 | 44 | horizontalRule: "Sisipkan garis mendatar", 45 | 46 | fullscreen: "Layar penuh", 47 | 48 | close: "Tutup", 49 | 50 | submit: "Setuju", 51 | reset: "Batal", 52 | 53 | invalidUrl: "Tautan salah", 54 | required: "Diperlukan", 55 | description: "Deskripsi", 56 | title: "Judul", 57 | text: "Teks" 58 | }; -------------------------------------------------------------------------------- /src/langs/pt.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * pt.js 3 | * Portuguese translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Ramiro Varandas Jr (ramirovjr) 7 | * Twitter : @ramirovjnr 8 | * Website : about.me/ramirovjnr 9 | * Github : https://github.com/ramirovjr 10 | */ 11 | 12 | jQuery.trumbowyg.langs.pt = { 13 | viewHTML: "Ver HTML", 14 | 15 | formatting: "Formatar", 16 | p: "Paragráfo", 17 | blockquote: "Citação", 18 | code: "Código", 19 | header: "Título", 20 | 21 | bold: "Negrito", 22 | italic: "Itálico", 23 | strikethrough: "Suprimir", 24 | underline: "Sublinhado", 25 | 26 | strong: "Forte", 27 | em: "Ênfase", 28 | del: "Apagar", 29 | 30 | unorderedList: "Lista não ordenada", 31 | orderedList: "Liste ordenada", 32 | 33 | insertImage: "Inserir imagem", 34 | insertVideo: "Inserir vídeo", 35 | link: "Link", 36 | createLink: "Criar um link", 37 | unlink: "Remover link", 38 | 39 | justifyLeft: "Alinhar a esquerda", 40 | justifyCenter: "Centralizar", 41 | justifyRight: "Alinhar a direita", 42 | justifyFull: "Justificar", 43 | 44 | horizontalRule: "Inserir separador horizontal", 45 | 46 | fullscreen: "Tela cheia", 47 | 48 | close: "Fechar", 49 | 50 | submit: "Enviar", 51 | reset: "Limpar", 52 | 53 | invalidUrl: "URL inválida", 54 | required: "Obrigatório", 55 | description: "Descrição", 56 | title: "Título", 57 | text: "Texto" 58 | }; -------------------------------------------------------------------------------- /src/langs/ro.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * ro.js 3 | * Romanian translation for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Vladut Radulescu (pacMakaveli) 7 | * 8 | * Email: pacMakaveli90@gmail.com 9 | * Twitter : @pacMakaveli90 10 | * Website : creative-studio51.co.uk 11 | * Github : https://github.com/pacMakaveli 12 | */ 13 | 14 | jQuery.trumbowyg.langs.pt = { 15 | viewHTML: "Vizualizare HTML", 16 | 17 | formatting: "Format", 18 | p: "Paragraf", 19 | blockquote: "Citație", 20 | code: "Cod", 21 | header: "Titlu", 22 | 23 | bold: "Bold", 24 | italic: "Italic", 25 | strikethrough: "Tăiat", 26 | underline: "Subliniat", 27 | 28 | strong: "Puternic", 29 | em: "Accentuat", 30 | del: "Sterge", 31 | 32 | unorderedList: "Lista dezordonată", 33 | orderedList: "Liste ordonată", 34 | 35 | insertImage: "Adăugare Imagine", 36 | insertVideo: "Adăugare Video", 37 | link: "Link", 38 | createLink: "Crează link", 39 | unlink: "Remover link", 40 | 41 | justifyLeft: "Aliniază stânga", 42 | justifyCenter: "Aliniază centru", 43 | justifyRight: "Aliniază dreapta", 44 | justifyFull: "Justificare", 45 | 46 | horizontalRule: "Linie orizontală", 47 | 48 | fullscreen: "Tot ecranul", 49 | 50 | close: "Închide", 51 | 52 | submit: "Procesează", 53 | reset: "Resetează", 54 | 55 | invalidUrl: "URL invalid", 56 | required: "Obligatoriu", 57 | description: "Descriere", 58 | title: "Titlu", 59 | text: "Text" 60 | }; -------------------------------------------------------------------------------- /plugins/base64/trumbowyg.base64.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * trumbowyg.base64.js v1.0 3 | * Base64 plugin for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Cyril Biencourt (lizardK) 7 | */ 8 | 9 | (function($){ 10 | 'use strict'; 11 | 12 | $.extend(true, $.trumbowyg, { 13 | langs: { 14 | en: { 15 | base64: "Image as base64", 16 | file: "File", 17 | errFileReaderNotSupported: "FileReader is not supported by your browser." 18 | }, 19 | fr: { 20 | base64: "Image en base64", 21 | file: "Fichier" 22 | } 23 | }, 24 | 25 | opts: { 26 | btnsDef: { 27 | base64: { 28 | isSupported: function(){ 29 | if(typeof FileReader === "undefined"){ 30 | console.err('[Trumbowyg - Plugin base64] FileReader is not supported by your browser.'); 31 | return false; 32 | } 33 | return true; 34 | }, 35 | func: function(params, tbw){ 36 | var file; 37 | tbw.openModalInsert( 38 | // Title 39 | tbw.lang.base64, 40 | 41 | // Fields 42 | { 43 | file: { 44 | type: 'file', 45 | required: true 46 | }, 47 | alt: { 48 | label: 'description' 49 | } 50 | }, 51 | 52 | // Callback 53 | function(values){ 54 | var fReader = new FileReader(); 55 | 56 | fReader.onloadend = function(){ 57 | tbw.execCmd('insertImage', fReader.result); 58 | $(['img[src="', fReader.result, '"]:not([alt])'].join(''), tbw.$box).attr('alt', values.alt); 59 | tbw.closeModal(); 60 | }; 61 | 62 | fReader.readAsDataURL(file); 63 | } 64 | ); 65 | 66 | $('input[type=file]').on('change', function(e){ 67 | file = e.target.files[0]; 68 | }); 69 | } 70 | } 71 | } 72 | } 73 | }); 74 | })(jQuery); 75 | -------------------------------------------------------------------------------- /plugins/upload/trumbowyg.upload.js: -------------------------------------------------------------------------------- 1 | /* =========================================================== 2 | * trumbowyg.upload.js v1.0 3 | * Upload plugin for Trumbowyg 4 | * http://alex-d.github.com/Trumbowyg 5 | * =========================================================== 6 | * Author : Alexandre Demode (Alex-D) 7 | * Twitter : @AlexandreDemode 8 | * Website : alex-d.fr 9 | */ 10 | 11 | (function($){ 12 | 'use strict'; 13 | 14 | addXhrProgressEvent(); 15 | 16 | $.extend(true, $.trumbowyg, { 17 | langs: { 18 | en: { 19 | upload: "Upload", 20 | file: "File", 21 | uploadError: "Error" 22 | }, 23 | fr: { 24 | upload: "Envoi", 25 | file: "Fichier", 26 | uploadError: "Erreur" 27 | } 28 | }, 29 | 30 | upload: { 31 | serverPath: './src/plugins/upload/trumbowyg.upload.php' 32 | }, 33 | 34 | opts: { 35 | btnsDef: { 36 | upload: { 37 | func: function(params, tbw){ 38 | var file, 39 | pfx = tbw.o.prefix; 40 | 41 | var $modal = tbw.openModalInsert( 42 | // Title 43 | tbw.lang.upload, 44 | 45 | // Fields 46 | { 47 | file: { 48 | type: 'file', 49 | required: true 50 | }, 51 | alt: { 52 | label: 'description' 53 | } 54 | }, 55 | 56 | // Callback 57 | function(){ 58 | var data = new FormData(); 59 | data.append('fileToUpload', file); 60 | 61 | if($('.' + pfx +'progress', $modal).length === 0) 62 | $('.' + pfx + 'modal-title', $modal) 63 | .after( 64 | $('
', { 65 | 'class': pfx +'progress' 66 | }) 67 | .append( 68 | $('', { 69 | 'class': pfx +'progress-bar' 70 | }) 71 | ) 72 | ); 73 | 74 | $.ajax({ 75 | url: $.trumbowyg.upload.serverPath, 76 | type: 'POST', 77 | data: data, 78 | cache: false, 79 | dataType: 'json', 80 | processData: false, 81 | contentType: false, 82 | 83 | progressUpload: function(e){ 84 | $('.' + pfx + 'progress-bar').stop().animate({ 85 | width: Math.round(e.loaded * 100 / e.total) + '%' 86 | }, 200); 87 | }, 88 | 89 | success: function(data){ 90 | if(data.message == "uploadSuccess") { 91 | tbw.execCmd('insertImage', data.file); 92 | setTimeout(function(){ 93 | tbw.closeModal(); 94 | }, 250); 95 | } else { 96 | tbw.addErrorOnModalField( 97 | $('input[type=file]', $modal), 98 | tbw.lang[data.message] 99 | ); 100 | } 101 | }, 102 | error: function(){ 103 | tbw.addErrorOnModalField( 104 | $('input[type=file]', $modal), 105 | tbw.lang.uploadError 106 | ); 107 | } 108 | }); 109 | } 110 | ); 111 | 112 | $('input[type=file]').on('change', function(e){ 113 | file = e.target.files[0]; 114 | }); 115 | } 116 | } 117 | } 118 | } 119 | }); 120 | 121 | 122 | function addXhrProgressEvent(){ 123 | if (!$.trumbowyg && !$.trumbowyg.addedXhrProgressEvent) { // Avoid adding progress event multiple times 124 | var originalXhr = $.ajaxSettings.xhr; 125 | $.ajaxSetup({ 126 | xhr: function() { 127 | var req = originalXhr(), 128 | that = this; 129 | if(req && typeof req.upload == "object" && that.progressUpload !== undefined) 130 | req.upload.addEventListener("progress", function(e){ 131 | that.progressUpload(e); 132 | }, false); 133 | 134 | return req; 135 | } 136 | }); 137 | $.trumbowyg.addedXhrProgressEvent = true; 138 | } 139 | } 140 | })(jQuery); 141 | -------------------------------------------------------------------------------- /Gulpfile.js: -------------------------------------------------------------------------------- 1 | var gulp = require('gulp'), 2 | $ = require('gulp-load-plugins')(), 3 | path = require('path'), 4 | spritesmith = require('gulp.spritesmith'); 5 | 6 | var paths = { 7 | scripts: ['src/trumbowyg.js'], 8 | langs: ['src/langs/**.js', '!src/langs/en.js'], 9 | plugins: ['plugins/*/**.js'], 10 | sprites: { 11 | 'icons': 'src/ui/images/icons/**.png', 12 | 'icons-2x': 'src/ui/images/icons-2x/**.png' 13 | }, 14 | mainStyle: 'src/ui/sass/trumbowyg.scss', 15 | styles: { 16 | sass: 'src/ui/sass', 17 | includePaths: ['src/ui/sass'] 18 | } 19 | }; 20 | 21 | var pkg = require('./package.json'); 22 | var banner = ['/**', 23 | ' * <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>', 24 | ' * <%= description %>', 25 | ' * ------------------------', 26 | ' * @link <%= pkg.homepage %>', 27 | ' * @license <%= pkg.license %>', 28 | ' * @author <%= pkg.author.name %>', 29 | ' * Twitter : @AlexandreDemode', 30 | ' * Website : <%= pkg.author.url.replace("http://", "") %>', 31 | ' */', 32 | '\n'].join('\n'); 33 | var bannerLight = ['/** <%= pkg.title %> v<%= pkg.version %> - <%= pkg.description %>', 34 | ' - <%= pkg.homepage.replace("http://", "") %>', 35 | ' - License <%= pkg.license %>', 36 | ' - Author : <%= pkg.author.name %>', 37 | ' / <%= pkg.author.url.replace("http://", "") %>', 38 | ' */', 39 | '\n'].join(''); 40 | 41 | 42 | 43 | 44 | gulp.task('clean', function(){ 45 | return gulp.src(['dist/*', 'src/ui/sass/_sprite*.scss']) 46 | .pipe($.clean()); 47 | }); 48 | 49 | gulp.task('test', ['test-scripts', 'test-langs', 'test-plugins']); 50 | gulp.task('test-scripts', function(){ 51 | return gulp.src(paths.scripts) 52 | .pipe($.jshint()) 53 | .pipe($.jshint.reporter('jshint-stylish')); 54 | }); 55 | gulp.task('test-langs', function(){ 56 | return gulp.src(paths.langs) 57 | .pipe($.jshint()) 58 | .pipe($.jshint.reporter('jshint-stylish')); 59 | }); 60 | gulp.task('test-plugins', function(){ 61 | return gulp.src(paths.plugins) 62 | .pipe($.jshint()) 63 | .pipe($.jshint.reporter('jshint-stylish')); 64 | }); 65 | 66 | gulp.task('scripts', ['test-scripts'], function(){ 67 | return gulp.src(paths.scripts) 68 | .pipe($.header(banner, { pkg: pkg, description: 'Trumbowyg core file' })) 69 | .pipe($.newer('dist/trumbowyg.js')) 70 | .pipe($.concat('trumbowyg.js', { newLine: '\r\n\r\n' })) 71 | .pipe(gulp.dest('dist/')) 72 | .pipe($.size({ title: 'trumbowyg.js' })) 73 | .pipe($.rename({ suffix: ".min" })) 74 | .pipe($.uglify()) 75 | .pipe($.header(bannerLight, { pkg: pkg })) 76 | .pipe(gulp.dest('dist/')) 77 | .pipe($.size({ title: 'trumbowyg.min.js' })) 78 | }); 79 | 80 | gulp.task('langs', ['test-langs'], function(){ 81 | return gulp.src(paths.langs) 82 | .pipe($.rename({ suffix: ".min" })) 83 | .pipe($.uglify({ 84 | preserveComments: 'all' 85 | })) 86 | .pipe(gulp.dest('dist/langs/')) 87 | }); 88 | 89 | gulp.task('plugins', ['test-plugins'], function(){ 90 | return gulp.src(paths.plugins) 91 | .pipe(gulp.dest('dist/plugins/')) 92 | .pipe($.rename({ suffix: ".min" })) 93 | .pipe($.uglify()) 94 | .pipe(gulp.dest('dist/plugins/')) 95 | }); 96 | 97 | 98 | 99 | gulp.task('sprites', function(){ 100 | return makeSprite() && makeSprite('-2x'); 101 | }); 102 | function makeSprite(resolution){ 103 | if(!resolution) 104 | resolution = ''; 105 | 106 | var sprite = gulp.src(paths.sprites['icons' + resolution]) 107 | .pipe(spritesmith({ 108 | imgName: 'icons' + resolution + '.png', 109 | cssName: '_sprite' + resolution + '.scss', 110 | cssTemplate: function(params){ 111 | var output = '', e; 112 | for(var i in params.items){ 113 | e = params.items[i]; 114 | output += '$' + e.name + resolution + ': ' + e.px.offset_x + ' ' + e.px.offset_y + ';\n'; 115 | } 116 | if(params.items.length > 0){ 117 | output += '\n\n'; 118 | output += '$sprite-height' + resolution + ': ' + params.items[0].px.total_height + ';\n'; 119 | output += '$sprite-width' + resolution + ': ' + params.items[0].px.total_width + ';\n'; 120 | output += '$icons' + resolution + ': "./images/icons' + resolution + '.png";'; 121 | } 122 | 123 | return output; 124 | } 125 | })); 126 | sprite.img.pipe(gulp.dest('dist/ui/images/')); 127 | sprite.css.pipe(gulp.dest(paths.styles.sass)); 128 | return sprite.css; 129 | } 130 | 131 | 132 | 133 | gulp.task("styles", ["sprites"], function(){ 134 | return gulp.src(paths.mainStyle) 135 | .pipe($.sass({ 136 | sass: paths.styles.sass, 137 | includePaths: paths.styles.includePaths 138 | })) 139 | .pipe($.autoprefixer(["last 1 version", "> 1%", "ff >= 20", "ie >= 8", "opera >= 12", "Android >= 2.2"], { cascade: true })) 140 | .pipe($.header(banner, { pkg: pkg, description: "Default stylesheet for Trumbowyg editor" })) 141 | .pipe(gulp.dest("dist/ui/")) 142 | .pipe($.size({ title: "trumbowyg.css" })) 143 | .pipe($.rename({ suffix: ".min" })) // génère une version minimifié 144 | .pipe($.minifyCss()) 145 | .pipe($.header(bannerLight, { pkg: pkg })) 146 | .pipe(gulp.dest("dist/ui/")) 147 | .pipe($.size({ title: "trumbowyg.min.css" })); 148 | }); 149 | 150 | 151 | 152 | gulp.task('watch', function(){ 153 | gulp.watch(paths.scripts, ['scripts']); 154 | gulp.watch(paths.langs, ['langs']); 155 | gulp.watch(paths.plugins, ['plugins']); 156 | gulp.watch(paths.mainStyle, ['styles']); 157 | 158 | gulp.watch(['dist/**', 'dist/*/**'], function(file){ 159 | $.livereload.changed(file); 160 | }); 161 | 162 | $.livereload.listen(); 163 | }); 164 | 165 | gulp.task('build', ['scripts', 'langs', 'plugins', 'styles']); 166 | 167 | gulp.task('default', ['build', 'watch']); -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 |
29 | Close an editor on clic on "Close" in top right corner.
30 | To reopen an editor, double-click on his text.
31 |
') 355 | .replace(' ', '') 356 | ); 357 | t.semanticCode(); 358 | } 359 | 360 | 361 | 362 | t.$editor 363 | .on('dblclick', 'img', function(){ 364 | var $img = $(this); 365 | t.openModalInsert(t.lang.insertImage, { 366 | url: { 367 | label: 'URL', 368 | value: $img.attr('src'), 369 | required: true 370 | }, 371 | alt: { 372 | label: 'description', 373 | value: $img.attr('alt') 374 | } 375 | }, function(v){ 376 | $img.attr('src', v.url); 377 | $img.attr('alt', v.alt); 378 | }); 379 | return false; 380 | }) 381 | .on('keyup', function(e){ 382 | t.semanticCode(false, e.which === 13); 383 | }) 384 | .on('blur', function(){ 385 | t.syncCode(); 386 | }); 387 | }, 388 | 389 | 390 | // Build the Textarea which contain HTML generated code 391 | buildTextarea: function(){ 392 | return $('', { 393 | name: this.$e.attr('id'), 394 | height: this.height 395 | }); 396 | }, 397 | 398 | 399 | // Build button pane, use o.btns and o.btnsAdd options 400 | buildBtnPane: function(){ 401 | var t = this, 402 | pfx = t.o.prefix; 403 | 404 | if(t.o.btns === false) 405 | return; 406 | 407 | t.$btnPane = $('
757 | semanticCode: function(force, full){ 758 | var t = this; 759 | t.syncCode(force); 760 | 761 | if(t.o.semantic){ 762 | t.semanticTag('b', 'strong'); 763 | t.semanticTag('i', 'em'); 764 | t.semanticTag('strike', 'del'); 765 | 766 | if(full){ 767 | // Wrap text nodes in p 768 | t.$editor.contents() 769 | .filter(function(){ 770 | // Only non-empty text nodes 771 | return this.nodeType === 3 && $.trim(this.nodeValue).length > 0; 772 | }).wrap('
').end() 773 | 774 | // Remove all br 775 | .filter('br').remove(); 776 | 777 | t.saveSelection(); 778 | t.semanticTag('div', 'p'); 779 | t.restoreSelection(); 780 | } 781 | 782 | t.$e.val(t.$editor.html()); 783 | } 784 | }, 785 | semanticTag: function(oldTag, newTag){ 786 | $(oldTag, this.$editor).each(function(){ 787 | $(this).replaceWith(function(){ 788 | return '<'+newTag+'>' + $(this).html() + ''+newTag+'>'; 789 | }); 790 | }); 791 | }, 792 | 793 | 794 | // Function call when user click on "Insert Link" 795 | createLink: function(){ 796 | var t = this; 797 | t.saveSelection(); 798 | t.openModalInsert(t.lang.createLink, { 799 | url: { 800 | label: 'URL', 801 | value: 'http://', 802 | required: true 803 | }, 804 | title: { 805 | label: t.lang.title, 806 | value: t.selection 807 | }, 808 | text: { 809 | label: t.lang.text, 810 | value: t.selection 811 | } 812 | }, function(v){ // v is value 813 | t.execCmd('createLink', v.url); 814 | var l = $('a[href="'+v.url+'"]:not([title])', t.$box); 815 | if(v.text.length > 0) 816 | l.text(v.text); 817 | 818 | if(v.title.length > 0) 819 | l.attr('title', v.title); 820 | 821 | return true; 822 | }); 823 | }, 824 | insertImage: function(){ 825 | var t = this; 826 | t.saveSelection(); 827 | t.openModalInsert(t.lang.insertImage, { 828 | url: { 829 | label: 'URL', 830 | value: 'http://', 831 | required: true 832 | }, 833 | alt: { 834 | label: t.lang.description, 835 | value: t.selection 836 | } 837 | }, function(v){ // v are values 838 | t.execCmd('insertImage', v.url); 839 | $('img[src="'+v.url+'"]:not([alt])', t.$box).attr('alt', v.alt); 840 | return true; 841 | }); 842 | }, 843 | 844 | 845 | /* 846 | * Call method of trumbowyg if exist 847 | * else try to call anonymous function 848 | * and finaly native execCommand 849 | */ 850 | execCmd: function(cmd, param){ 851 | var t = this; 852 | if(cmd != 'dropdown') 853 | t.$editor.focus(); 854 | 855 | try { 856 | t[cmd](param); 857 | } catch(e){ 858 | try { 859 | cmd(param, t); 860 | } catch(e2){ 861 | t.$editor.focus(); 862 | if(cmd == 'insertHorizontalRule') 863 | param = null; 864 | else if(cmd == 'formatBlock' && (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0)) 865 | param = '<' + param + '>'; 866 | 867 | document.execCommand(cmd, false, param); 868 | } 869 | } 870 | t.syncCode(); 871 | }, 872 | 873 | 874 | // Open a modal box 875 | openModal: function(title, content){ 876 | var t = this, 877 | pfx = t.o.prefix; 878 | 879 | // No open a modal box when exist other modal box 880 | if($('.' + pfx + 'modal-box', t.$box).size() > 0) 881 | return false; 882 | 883 | t.saveSelection(); 884 | t.showOverlay(); 885 | 886 | // Disable all btnPane btns 887 | t.$btnPane.addClass(pfx + 'disable'); 888 | 889 | // Build out of ModalBox, it's the mask for animations 890 | var $modal = $('', { 891 | class: pfx + 'modal ' + pfx + 'fixed-top' 892 | }).css({ 893 | top: (parseInt(t.$btnPane.css('height')) + 1) + 'px' 894 | }).appendTo(t.$box); 895 | 896 | // Click on overflay close modal by cancelling them 897 | t.$overlay.one('click', function(e){ 898 | e.preventDefault(); 899 | $modal.trigger(pfx + 'cancel'); 900 | }); 901 | 902 | // Build the form 903 | var $form = $('', { 904 | action: '', 905 | html: content 906 | }) 907 | .on('submit', function(e){ 908 | e.preventDefault(); 909 | $modal.trigger(pfx + 'confirm'); 910 | }) 911 | .on('reset', function(e){ 912 | e.preventDefault(); 913 | $modal.trigger(pfx + 'cancel'); 914 | }); 915 | 916 | 917 | // Build ModalBox and animate to show them 918 | var $box = $('', { 919 | class: pfx + 'modal-box', 920 | html: $form 921 | }) 922 | .css({ 923 | top: '-' + parseInt(t.$btnPane.outerHeight()) + 'px', 924 | opacity: 0 925 | }) 926 | .appendTo($modal) 927 | .animate({ 928 | top: 0, 929 | opacity: 1 930 | }, t.o.duration / 2); 931 | 932 | 933 | // Append title 934 | $('', { 935 | text: title, 936 | class: pfx + 'modal-title' 937 | }).prependTo($box); 938 | 939 | 940 | // Focus in modal box 941 | $box.find('input:first').focus(); 942 | 943 | 944 | // Append Confirm and Cancel buttons 945 | t.buildModalBtn('submit', $box); 946 | t.buildModalBtn('reset', $box); 947 | 948 | 949 | $(window).trigger('scroll'); 950 | 951 | return $modal; 952 | }, 953 | // @param n is name of modal 954 | buildModalBtn: function(n, modal){ 955 | var t = this, 956 | pfx = t.o.prefix; 957 | 958 | return $('', { 959 | class: pfx + 'modal-button ' + pfx + 'modal-' + n, 960 | type: n, 961 | text: t.lang[n] || n 962 | }).appendTo(modal.find('form')); 963 | }, 964 | // close current modal box 965 | closeModal: function(){ 966 | var t = this, 967 | pfx = t.o.prefix; 968 | 969 | t.$btnPane.removeClass(pfx + 'disable'); 970 | t.$overlay.off(); 971 | 972 | var $modalBox = $('.' + pfx + 'modal-box', t.$box); 973 | 974 | $modalBox.animate({ 975 | top: '-' + $modalBox.css('height') 976 | }, t.o.duration/2, function(){ 977 | $(this).parent().remove(); 978 | t.hideOverlay(); 979 | }); 980 | }, 981 | // Preformated build and management modal 982 | openModalInsert: function(title, fields, cmd){ 983 | var t = this, 984 | pfx = t.o.prefix, 985 | lg = t.lang, 986 | html = ''; 987 | 988 | for(var f in fields){ 989 | var fd = fields[f], // field definition 990 | label = (fd.label === undefined) ? (lg[f] ? lg[f] : f) : (lg[fd.label] ? lg[fd.label] : fd.label); 991 | 992 | if(fd.name === undefined) 993 | fd.name = f; 994 | 995 | if(!fd.pattern && f === 'url'){ 996 | fd.pattern = /^(http|https):\/\/([\w~#!:.?+=&%@!\-\/]+)$/; 997 | fd.patternError = lg.invalidUrl; 998 | } 999 | 1000 | html += ''; 1001 | } 1002 | 1003 | return t.openModal(title, html) 1004 | .on(pfx + 'confirm', function(){ 1005 | var $form = $(this).find('form'), 1006 | valid = true, 1007 | v = {}; // values 1008 | 1009 | for(var f in fields){ 1010 | var $field = $('input[name="'+f+'"]', $form); 1011 | 1012 | v[f] = $.trim($field.val()); 1013 | 1014 | // Validate value 1015 | if(fields[f].required && v[f] === ''){ 1016 | valid = false; 1017 | t.addErrorOnModalField($field, t.lang.required); 1018 | } else if(fields[f].pattern && !fields[f].pattern.test(v[f])){ 1019 | valid = false; 1020 | t.addErrorOnModalField($field, fields[f].patternError); 1021 | } 1022 | } 1023 | 1024 | if(valid){ 1025 | t.restoreSelection(); 1026 | 1027 | if(cmd(v, fields)){ 1028 | t.syncCode(); 1029 | t.closeModal(); 1030 | $(this).off(pfx + 'confirm'); 1031 | } 1032 | } 1033 | }) 1034 | .one(pfx + 'cancel', function(){ 1035 | $(this).off(pfx + 'confirm'); 1036 | t.closeModal(); 1037 | t.restoreSelection(); 1038 | }); 1039 | }, 1040 | addErrorOnModalField: function($field, err){ 1041 | var pfx = this.o.prefix, 1042 | $label = $field.parent(); 1043 | 1044 | $field.on('change keyup', function(){ 1045 | $label.removeClass(pfx + 'input-error'); 1046 | }); 1047 | $label 1048 | .addClass(pfx + 'input-error') 1049 | .find('input+span').append( 1050 | $('', { 1051 | class: pfx +'msg-error', 1052 | text: err 1053 | }) 1054 | ); 1055 | }, 1056 | 1057 | 1058 | 1059 | 1060 | // Selection management 1061 | saveSelection: function(){ 1062 | var t = this, 1063 | d = document; 1064 | 1065 | t.selection = null; 1066 | if(window.getSelection){ 1067 | var s = window.getSelection(); 1068 | if(s.getRangeAt && s.rangeCount) 1069 | t.selection = s.getRangeAt(0); 1070 | } else if(d.selection && d.selection.createRange) 1071 | t.selection = d.selection.createRange(); 1072 | }, 1073 | restoreSelection: function(){ 1074 | var range = this.selection; 1075 | if(range){ 1076 | if(window.getSelection){ 1077 | var s = window.getSelection(); 1078 | s.removeAllRanges(); 1079 | s.addRange(range); 1080 | } else if(document.selection && range.select) 1081 | range.select(); 1082 | } 1083 | }, 1084 | 1085 | 1086 | 1087 | // Return true if must enable Trumbowyg on this mobile device 1088 | isEnabled: function(){ 1089 | var exprTablet = new RegExp("(iPad|webOS)"), 1090 | exprMobile = new RegExp("(iPhone|iPod|Android|BlackBerry|Windows Phone|ZuneWP7)"), 1091 | ua = navigator.userAgent; 1092 | 1093 | return (this.o.tablet === true && exprTablet.test(ua)) || (this.o.mobile === true && exprMobile.test(ua)); 1094 | } 1095 | }; 1096 | })(window, document, jQuery); --------------------------------------------------------------------------------