├── .editorconfig
├── .gitignore
├── LICENSE
├── README.md
├── bower.json
├── css
└── bootstrap-markdown.min.css
├── js
└── bootstrap-markdown.js
├── less
└── bootstrap-markdown.less
├── locale
├── bootstrap-markdown.ar.js
├── bootstrap-markdown.cs.js
├── bootstrap-markdown.da.js
├── bootstrap-markdown.de.js
├── bootstrap-markdown.es.js
├── bootstrap-markdown.fa.js
├── bootstrap-markdown.fr.js
├── bootstrap-markdown.hu.js
├── bootstrap-markdown.it.js
├── bootstrap-markdown.ja.js
├── bootstrap-markdown.kr.js
├── bootstrap-markdown.nb.js
├── bootstrap-markdown.nl.js
├── bootstrap-markdown.pl.js
├── bootstrap-markdown.ptBR.js
├── bootstrap-markdown.ru.js
├── bootstrap-markdown.sl.js
├── bootstrap-markdown.sv.js
├── bootstrap-markdown.tr.js
├── bootstrap-markdown.ua.js
├── bootstrap-markdown.zh-tw.js
└── bootstrap-markdown.zh.js
├── package.json
└── scss
└── bootstrap-markdown.scss
/.editorconfig:
--------------------------------------------------------------------------------
1 | # EditorConfig is awesome: http://EditorConfig.org
2 |
3 | # top-most EditorConfig file
4 | root = true
5 |
6 | [*]
7 | charset = utf-8
8 | indent_style = space
9 | indent_size = 2
10 | end_of_line = lf
11 | trim_trailing_whitespace = true
12 | insert_final_newline = true
13 |
14 | [*.md]
15 | trim_trailing_whitespace = false
16 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bower_components
2 | .DS_Store
3 | node_modules/*
4 | .idea
5 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright {yyyy} {name of copyright owner}
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | ## Bootstrap Markdown
2 |
3 | Markdown editing meets Bootstrap.
4 |
5 | Demo and documentation available at [http://toopay.github.io/bootstrap-markdown/](http://toopay.github.io/bootstrap-markdown/)
6 |
7 | ### Compatibility
8 |
9 | | Version | Compatibility |
10 | | :---: | :---: |
11 | | v2.x | **only** Bootstrap 3.x |
12 | | v1.x | **only** Bootstrap 2.x |
13 |
14 | ### LICENSE
15 |
16 | > Copyright 2013-2016 Taufan Aditya
17 | >
18 | > Licensed under the Apache License, Version 2.0 (the "License");
19 | > you may not use this file except in compliance with the License.
20 | > You may obtain a copy of the License at
21 | >
22 | > http://www.apache.org/licenses/LICENSE-2.0
23 | >
24 | > Unless required by applicable law or agreed to in writing, software
25 | > distributed under the License is distributed on an "AS IS" BASIS,
26 | > WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
27 | > See the License for the specific language governing permissions and
28 | > limitations under the License.
29 |
--------------------------------------------------------------------------------
/bower.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap-markdown",
3 | "version": "2.10.0",
4 | "main": ["./js/bootstrap-markdown.js", "./css/bootstrap-markdown.min.css"],
5 | "license": "Apache-2.0",
6 | "dependencies": {
7 | "bootstrap": "~3"
8 | },
9 | "devDependencies": {
10 | "markdown":"~0.4.0"
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/css/bootstrap-markdown.min.css:
--------------------------------------------------------------------------------
1 | .md-editor{display:block;border:1px solid #ddd}.md-editor .md-footer,.md-editor>.md-header{display:block;padding:6px 4px;background:#f5f5f5}.md-editor>.md-header{margin:0}.md-editor>.md-preview{background:#fff;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;min-height:10px;overflow:auto}.md-editor>textarea{font-family:Menlo,Monaco,Consolas,"Courier New",monospace;font-size:14px;outline:0;margin:0;display:block;padding:0;width:100%;border:0;border-top:1px dashed #ddd;border-bottom:1px dashed #ddd;border-radius:0;box-shadow:none;background:#eee}.md-editor>textarea:focus{box-shadow:none;background:#fff}.md-editor.active{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6);box-shadow:inset 0 1px 1px rgba(0,0,0,.075),0 0 8px rgba(102,175,233,.6)}.md-editor .md-controls{float:right;padding:3px}.md-editor .md-controls .md-control{right:5px;color:#bebebe;padding:3px 3px 3px 10px}.md-editor .md-controls .md-control:hover{color:#333}.md-editor.md-fullscreen-mode{width:100%;height:100%;position:fixed;top:0;left:0;z-index:99999;padding:60px 30px 15px;background:#fff!important;border:0!important}.md-editor.md-fullscreen-mode .md-footer{display:none}.md-editor.md-fullscreen-mode .md-input,.md-editor.md-fullscreen-mode .md-preview{margin:0 auto!important;height:100%!important;font-size:20px!important;padding:20px!important;color:#999;line-height:1.6em!important;resize:none!important;box-shadow:none!important;background:#fff!important;border:0!important}.md-editor.md-fullscreen-mode .md-preview{color:#333;overflow:auto}.md-editor.md-fullscreen-mode .md-input:focus,.md-editor.md-fullscreen-mode .md-input:hover{color:#333;background:#fff!important}.md-editor.md-fullscreen-mode .md-header{background:0 0;text-align:center;position:fixed;width:100%;top:20px}.md-editor.md-fullscreen-mode .btn-group{float:none}.md-editor.md-fullscreen-mode .btn{border:0;background:0 0;color:#b3b3b3}.md-editor.md-fullscreen-mode .btn.active,.md-editor.md-fullscreen-mode .btn:active,.md-editor.md-fullscreen-mode .btn:focus,.md-editor.md-fullscreen-mode .btn:hover{box-shadow:none;color:#333}.md-editor.md-fullscreen-mode .md-fullscreen-controls{position:absolute;top:20px;right:20px;text-align:right;z-index:1002;display:block}.md-editor.md-fullscreen-mode .md-fullscreen-controls a{color:#b3b3b3;clear:right;margin:10px;width:30px;height:30px;text-align:center}.md-editor.md-fullscreen-mode .md-fullscreen-controls a:hover{color:#333;text-decoration:none}.md-editor.md-fullscreen-mode .md-editor{height:100%!important;position:relative}.md-editor .md-fullscreen-controls{display:none}.md-nooverflow{overflow:hidden;position:fixed;width:100%}
--------------------------------------------------------------------------------
/js/bootstrap-markdown.js:
--------------------------------------------------------------------------------
1 | /* ===================================================
2 | * bootstrap-markdown.js v2.10.0
3 | * http://github.com/toopay/bootstrap-markdown
4 | * ===================================================
5 | * Copyright 2013-2016 Taufan Aditya
6 | *
7 | * Licensed under the Apache License, Version 2.0 (the "License");
8 | * you may not use this file except in compliance with the License.
9 | * You may obtain a copy of the License at
10 | *
11 | * http://www.apache.org/licenses/LICENSE-2.0
12 | *
13 | * Unless required by applicable law or agreed to in writing, software
14 | * distributed under the License is distributed on an "AS IS" BASIS,
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 | * See the License for the specific language governing permissions and
17 | * limitations under the License.
18 | * ========================================================== */
19 | (function(factory) {
20 | if (typeof define === "function" && define.amd) {
21 | // RequireJS
22 | define(["jquery"], factory);
23 | } else if (typeof exports === 'object') {
24 | // Backbone.js
25 | factory(require('jquery'));
26 | } else {
27 | // jQuery plugin
28 | factory(jQuery);
29 | }
30 | }(function($) {
31 | "use strict";
32 |
33 | /* MARKDOWN CLASS DEFINITION
34 | * ========================== */
35 |
36 | var Markdown = function(element, options) {
37 | // @TODO : remove this BC on next major release
38 | // @see : https://github.com/toopay/bootstrap-markdown/issues/109
39 | var opts = ['autofocus', 'savable', 'hideable', 'width',
40 | 'height', 'resize', 'iconlibrary', 'language',
41 | 'footer', 'fullscreen', 'hiddenButtons', 'disabledButtons'
42 | ];
43 | $.each(opts, function(_, opt) {
44 | if (typeof $(element).data(opt) !== 'undefined') {
45 | options = typeof options == 'object' ? options : {};
46 | options[opt] = $(element).data(opt);
47 | }
48 | });
49 | // End BC
50 |
51 | // Class Properties
52 | this.$ns = 'bootstrap-markdown';
53 | this.$element = $(element);
54 | this.$editable = {
55 | el: null,
56 | type: null,
57 | attrKeys: [],
58 | attrValues: [],
59 | content: null
60 | };
61 | this.$options = $.extend(true, {}, $.fn.markdown.defaults, options, this.$element.data('options'));
62 | this.$oldContent = null;
63 | this.$isPreview = false;
64 | this.$isFullscreen = false;
65 | this.$editor = null;
66 | this.$textarea = null;
67 | this.$handler = [];
68 | this.$callback = [];
69 | this.$nextTab = [];
70 |
71 | this.showEditor();
72 | };
73 |
74 | Markdown.prototype = {
75 |
76 | constructor: Markdown,
77 | __alterButtons: function(name, alter) {
78 | var handler = this.$handler,
79 | isAll = (name == 'all'),
80 | that = this;
81 |
82 | $.each(handler, function(k, v) {
83 | var halt = true;
84 | if (isAll) {
85 | halt = false;
86 | } else {
87 | halt = v.indexOf(name) < 0;
88 | }
89 |
90 | if (halt === false) {
91 | alter(that.$editor.find('button[data-handler="' + v + '"]'));
92 | }
93 | });
94 | },
95 | __buildButtons: function(buttonsArray, container) {
96 | var i,
97 | ns = this.$ns,
98 | handler = this.$handler,
99 | callback = this.$callback;
100 |
101 | for (i = 0; i < buttonsArray.length; i++) {
102 | // Build each group container
103 | var y, btnGroups = buttonsArray[i];
104 | for (y = 0; y < btnGroups.length; y++) {
105 | // Build each button group
106 | var z,
107 | buttons = btnGroups[y].data,
108 | btnGroupContainer = $('
', {
109 | 'class': 'btn-group'
110 | });
111 |
112 | for (z = 0; z < buttons.length; z++) {
113 | var button = buttons[z],
114 | buttonContainer, buttonIconContainer,
115 | buttonHandler = ns + '-' + button.name,
116 | buttonIcon = this.__getIcon(button),
117 | btnText = button.btnText ? button.btnText : '',
118 | btnClass = button.btnClass ? button.btnClass : 'btn',
119 | tabIndex = button.tabIndex ? button.tabIndex : '-1',
120 | hotkey = typeof button.hotkey !== 'undefined' ? button.hotkey : '',
121 | hotkeyCaption = typeof jQuery.hotkeys !== 'undefined' && hotkey !== '' ? ' (' + hotkey + ')' : '';
122 |
123 | // Construct the button object
124 | buttonContainer = $(' ');
125 | buttonContainer.text(' ' + this.__localize(btnText)).addClass('btn-default btn-sm').addClass(btnClass);
126 | if (btnClass.match(/btn\-(primary|success|info|warning|danger|link)/)) {
127 | buttonContainer.removeClass('btn-default');
128 | }
129 | buttonContainer.attr({
130 | 'type': 'button',
131 | 'title': this.__localize(button.title) + hotkeyCaption,
132 | 'tabindex': tabIndex,
133 | 'data-provider': ns,
134 | 'data-handler': buttonHandler,
135 | 'data-hotkey': hotkey
136 | });
137 | if (button.toggle === true) {
138 | buttonContainer.attr('data-toggle', 'button');
139 | }
140 | buttonIconContainer = $(' ');
141 | buttonIconContainer.addClass(buttonIcon);
142 | buttonIconContainer.prependTo(buttonContainer);
143 |
144 | // Attach the button object
145 | btnGroupContainer.append(buttonContainer);
146 |
147 | // Register handler and callback
148 | handler.push(buttonHandler);
149 | callback.push(button.callback);
150 | }
151 |
152 | // Attach the button group into container DOM
153 | container.append(btnGroupContainer);
154 | }
155 | }
156 |
157 | return container;
158 | },
159 | __setListener: function() {
160 | // Set size and resizable Properties
161 | var hasRows = typeof this.$textarea.attr('rows') !== 'undefined',
162 | maxRows = this.$textarea.val().split("\n").length > 5 ? this.$textarea.val().split("\n").length : '5',
163 | rowsVal = hasRows ? this.$textarea.attr('rows') : maxRows;
164 |
165 | this.$textarea.attr('rows', rowsVal);
166 | if (this.$options.resize) {
167 | this.$textarea.css('resize', this.$options.resize);
168 | }
169 |
170 | // Re-attach markdown data
171 | this.$textarea.data('markdown', this);
172 | },
173 | __setEventListeners: function() {
174 | this.$textarea.on({
175 | 'focus': $.proxy(this.focus, this),
176 | 'keyup': $.proxy(this.keyup, this),
177 | 'change': $.proxy(this.change, this),
178 | 'select': $.proxy(this.select, this)
179 | });
180 |
181 | if (this.eventSupported('keydown')) {
182 | this.$textarea.on('keydown', $.proxy(this.keydown, this));
183 | }
184 |
185 | if (this.eventSupported('keypress')) {
186 | this.$textarea.on('keypress', $.proxy(this.keypress, this));
187 | }
188 | },
189 | __handle: function(e) {
190 | var target = $(e.currentTarget),
191 | handler = this.$handler,
192 | callback = this.$callback,
193 | handlerName = target.attr('data-handler'),
194 | callbackIndex = handler.indexOf(handlerName),
195 | callbackHandler = callback[callbackIndex];
196 |
197 | // Trigger the focusin
198 | $(e.currentTarget).focus();
199 |
200 | callbackHandler(this);
201 |
202 | // Trigger onChange for each button handle
203 | this.change(this);
204 |
205 | // Unless it was the save handler,
206 | // focusin the textarea
207 | if (handlerName.indexOf('cmdSave') < 0) {
208 | this.$textarea.focus();
209 | }
210 |
211 | e.preventDefault();
212 | },
213 | __localize: function(string) {
214 | var messages = $.fn.markdown.messages,
215 | language = this.$options.language;
216 | if (
217 | typeof messages !== 'undefined' &&
218 | typeof messages[language] !== 'undefined' &&
219 | typeof messages[language][string] !== 'undefined'
220 | ) {
221 | return messages[language][string];
222 | }
223 | return string;
224 | },
225 | __getIcon: function(src) {
226 | if(typeof src == 'object'){
227 | var customIcon = this.$options.customIcons[src.name];
228 | return typeof customIcon == 'undefined' ? src.icon[this.$options.iconlibrary] : customIcon;
229 | } else {
230 | return src;
231 | }
232 | },
233 | setFullscreen: function(mode) {
234 | var $editor = this.$editor,
235 | $textarea = this.$textarea;
236 |
237 | if (mode === true) {
238 | $editor.addClass('md-fullscreen-mode');
239 | $('body').addClass('md-nooverflow');
240 | this.$options.onFullscreen(this);
241 | } else {
242 | $editor.removeClass('md-fullscreen-mode');
243 | $('body').removeClass('md-nooverflow');
244 | this.$options.onFullscreenExit(this);
245 |
246 | if (this.$isPreview === true)
247 | this.hidePreview().showPreview();
248 | }
249 |
250 | this.$isFullscreen = mode;
251 | $textarea.focus();
252 | },
253 | showEditor: function() {
254 | var instance = this,
255 | textarea,
256 | ns = this.$ns,
257 | container = this.$element,
258 | originalHeigth = container.css('height'),
259 | originalWidth = container.css('width'),
260 | editable = this.$editable,
261 | handler = this.$handler,
262 | callback = this.$callback,
263 | options = this.$options,
264 | editor = $('
', {
265 | 'class': 'md-editor',
266 | click: function() {
267 | instance.focus();
268 | }
269 | });
270 |
271 | // Prepare the editor
272 | if (this.$editor === null) {
273 | // Create the panel
274 | var editorHeader = $('
', {
275 | 'class': 'md-header btn-toolbar'
276 | });
277 |
278 | // Merge the main & additional button groups together
279 | var allBtnGroups = [];
280 | if (options.buttons.length > 0) allBtnGroups = allBtnGroups.concat(options.buttons[0]);
281 | if (options.additionalButtons.length > 0) {
282 | // iterate the additional button groups
283 | $.each(options.additionalButtons[0], function(idx, buttonGroup) {
284 |
285 | // see if the group name of the additional group matches an existing group
286 | var matchingGroups = $.grep(allBtnGroups, function(allButtonGroup, allIdx) {
287 | return allButtonGroup.name === buttonGroup.name;
288 | });
289 |
290 | // if it matches add the additional buttons to that group, if not just add it to the all buttons group
291 | if (matchingGroups.length > 0) {
292 | matchingGroups[0].data = matchingGroups[0].data.concat(buttonGroup.data);
293 | } else {
294 | allBtnGroups.push(options.additionalButtons[0][idx]);
295 | }
296 |
297 | });
298 | }
299 |
300 | // Reduce and/or reorder the button groups
301 | if (options.reorderButtonGroups.length > 0) {
302 | allBtnGroups = allBtnGroups
303 | .filter(function(btnGroup) {
304 | return options.reorderButtonGroups.indexOf(btnGroup.name) > -1;
305 | })
306 | .sort(function(a, b) {
307 | if (options.reorderButtonGroups.indexOf(a.name) < options.reorderButtonGroups.indexOf(b.name)) return -1;
308 | if (options.reorderButtonGroups.indexOf(a.name) > options.reorderButtonGroups.indexOf(b.name)) return 1;
309 | return 0;
310 | });
311 | }
312 |
313 | // Build the buttons
314 | if (allBtnGroups.length > 0) {
315 | editorHeader = this.__buildButtons([allBtnGroups], editorHeader);
316 | }
317 |
318 | if (options.fullscreen.enable) {
319 | editorHeader.append('').on('click', '.md-control-fullscreen', function(e) {
320 | e.preventDefault();
321 | instance.setFullscreen(true);
322 | });
323 | }
324 |
325 | editor.append(editorHeader);
326 |
327 | // Wrap the textarea
328 | if (container.is('textarea')) {
329 | container.before(editor);
330 | textarea = container;
331 | textarea.addClass('md-input');
332 | editor.append(textarea);
333 | } else {
334 | var rawContent = (typeof toMarkdown == 'function') ? toMarkdown(container.html()) : container.html(),
335 | currentContent = $.trim(rawContent);
336 |
337 | // This is some arbitrary content that could be edited
338 | textarea = $('', {
339 | 'class': 'md-input',
340 | 'val': currentContent
341 | });
342 |
343 | editor.append(textarea);
344 |
345 | // Save the editable
346 | editable.el = container;
347 | editable.type = container.prop('tagName').toLowerCase();
348 | editable.content = container.html();
349 |
350 | $(container[0].attributes).each(function() {
351 | editable.attrKeys.push(this.nodeName);
352 | editable.attrValues.push(this.nodeValue);
353 | });
354 |
355 | // Set editor to block the original container
356 | container.replaceWith(editor);
357 | }
358 |
359 | var editorFooter = $('
', {
360 | 'class': 'md-footer'
361 | }),
362 | createFooter = false,
363 | footer = '';
364 | // Create the footer if savable
365 | if (options.savable) {
366 | createFooter = true;
367 | var saveHandler = 'cmdSave';
368 |
369 | // Register handler and callback
370 | handler.push(saveHandler);
371 | callback.push(options.onSave);
372 |
373 | editorFooter.append(' ' +
378 | this.__localize('Save') +
379 | ' ');
380 |
381 |
382 | }
383 |
384 | footer = typeof options.footer === 'function' ? options.footer(this) : options.footer;
385 |
386 | if ($.trim(footer) !== '') {
387 | createFooter = true;
388 | editorFooter.append(footer);
389 | }
390 |
391 | if (createFooter) editor.append(editorFooter);
392 |
393 | // Set width
394 | if (options.width && options.width !== 'inherit') {
395 | if (jQuery.isNumeric(options.width)) {
396 | editor.css('display', 'table');
397 | textarea.css('width', options.width + 'px');
398 | } else {
399 | editor.addClass(options.width);
400 | }
401 | }
402 |
403 | // Set height
404 | if (options.height && options.height !== 'inherit') {
405 | if (jQuery.isNumeric(options.height)) {
406 | var height = options.height;
407 | if (editorHeader) height = Math.max(0, height - editorHeader.outerHeight());
408 | if (editorFooter) height = Math.max(0, height - editorFooter.outerHeight());
409 | textarea.css('height', height + 'px');
410 | } else {
411 | editor.addClass(options.height);
412 | }
413 | }
414 |
415 | // Reference
416 | this.$editor = editor;
417 | this.$textarea = textarea;
418 | this.$editable = editable;
419 | this.$oldContent = this.getContent();
420 |
421 | this.__setListener();
422 | this.__setEventListeners();
423 |
424 | // Set editor attributes, data short-hand API and listener
425 | this.$editor.attr('id', (new Date()).getTime());
426 | this.$editor.on('click', '[data-provider="bootstrap-markdown"]', $.proxy(this.__handle, this));
427 |
428 | if (this.$element.is(':disabled') || this.$element.is('[readonly]')) {
429 | this.$editor.addClass('md-editor-disabled');
430 | this.disableButtons('all');
431 | }
432 |
433 | if (this.eventSupported('keydown') && typeof jQuery.hotkeys === 'object') {
434 | editorHeader.find('[data-provider="bootstrap-markdown"]').each(function() {
435 | var $button = $(this),
436 | hotkey = $button.attr('data-hotkey');
437 | if (hotkey.toLowerCase() !== '') {
438 | textarea.bind('keydown', hotkey, function() {
439 | $button.trigger('click');
440 | return false;
441 | });
442 | }
443 | });
444 | }
445 |
446 | if (options.initialstate === 'preview') {
447 | this.showPreview();
448 | } else if (options.initialstate === 'fullscreen' && options.fullscreen.enable) {
449 | this.setFullscreen(true);
450 | }
451 |
452 | } else {
453 | this.$editor.show();
454 | }
455 |
456 | if (options.autofocus) {
457 | this.$textarea.focus();
458 | this.$editor.addClass('active');
459 | }
460 |
461 | if (options.fullscreen.enable && options.fullscreen !== false) {
462 | this.$editor.append('');
466 | this.$editor.on('click', '.exit-fullscreen', function(e) {
467 | e.preventDefault();
468 | instance.setFullscreen(false);
469 | });
470 | }
471 |
472 | // hide hidden buttons from options
473 | this.hideButtons(options.hiddenButtons);
474 |
475 | // disable disabled buttons from options
476 | this.disableButtons(options.disabledButtons);
477 |
478 | // enable dropZone if available and configured
479 | if (options.dropZoneOptions) {
480 | if (this.$editor.dropzone) {
481 | if(!options.dropZoneOptions.init) {
482 | options.dropZoneOptions.init = function() {
483 | var caretPos = 0;
484 | this.on('drop', function(e) {
485 | caretPos = textarea.prop('selectionStart');
486 | });
487 | this.on('success', function(file, path) {
488 | var text = textarea.val();
489 | textarea.val(text.substring(0, caretPos) + '\n\n' + text.substring(caretPos));
490 | });
491 | this.on('error', function(file, error, xhr) {
492 | console.log('Error:', error);
493 | });
494 | };
495 | }
496 | this.$editor.addClass('dropzone');
497 | this.$editor.dropzone(options.dropZoneOptions);
498 | } else {
499 | console.log('dropZoneOptions was configured, but DropZone was not detected.');
500 | }
501 | }
502 |
503 | // enable data-uris via drag and drop
504 | if (options.enableDropDataUri === true) {
505 | this.$editor.on('drop', function(e) {
506 | var caretPos = textarea.prop('selectionStart');
507 | e.stopPropagation();
508 | e.preventDefault();
509 | $.each(e.originalEvent.dataTransfer.files, function(index, file){
510 | var fileReader = new FileReader();
511 | fileReader.onload = (function(file) {
512 | var type = file.type.split('/')[0];
513 | return function(e) {
514 | var text = textarea.val();
515 | if (type === 'image')
516 | textarea.val(text.substring(0, caretPos) + '\n \n' + text.substring(caretPos) );
517 | else
518 | textarea.val(text.substring(0, caretPos) + '\nDownload ' + file.name + ' \n' + text.substring(caretPos) );
519 | };
520 | })(file);
521 | fileReader.readAsDataURL(file);
522 | });
523 | });
524 | }
525 |
526 | // Trigger the onShow hook
527 | options.onShow(this);
528 |
529 | return this;
530 | },
531 | parseContent: function(val) {
532 | var content;
533 |
534 | // parse with supported markdown parser
535 | val = val || this.$textarea.val();
536 |
537 | if (this.$options.parser) {
538 | content = this.$options.parser(val);
539 | } else if (typeof markdown == 'object') {
540 | content = markdown.toHTML(val);
541 | } else if (typeof marked == 'function') {
542 | content = marked(val);
543 | } else {
544 | content = val;
545 | }
546 |
547 | return content;
548 | },
549 | showPreview: function() {
550 | var options = this.$options,
551 | container = this.$textarea,
552 | afterContainer = container.next(),
553 | replacementContainer = $('
', {
554 | 'class': 'md-preview',
555 | 'data-provider': 'markdown-preview'
556 | }),
557 | content,
558 | callbackContent;
559 |
560 | if (this.$isPreview === true) {
561 | // Avoid sequenced element creation on misused scenario
562 | // @see https://github.com/toopay/bootstrap-markdown/issues/170
563 | return this;
564 | }
565 |
566 | // Give flag that tells the editor to enter preview mode
567 | this.$isPreview = true;
568 | // Disable all buttons
569 | this.disableButtons('all').enableButtons('cmdPreview');
570 |
571 | // Try to get the content from callback
572 | callbackContent = options.onPreview(this, replacementContainer);
573 | // Set the content based on the callback content if string, otherwise parse value from textarea
574 | content = typeof callbackContent == 'string' ? callbackContent : this.parseContent();
575 |
576 | // Build preview element
577 | replacementContainer.html(content);
578 |
579 | if (afterContainer && afterContainer.attr('class') == 'md-footer') {
580 | // If there is footer element, insert the preview container before it
581 | replacementContainer.insertBefore(afterContainer);
582 | } else {
583 | // Otherwise, just append it after textarea
584 | container.parent().append(replacementContainer);
585 | }
586 |
587 | // Set the preview element dimensions
588 | replacementContainer.css({
589 | "width": container.outerWidth() + 'px',
590 | "min-height": container.outerHeight() + 'px',
591 | "height": "auto"
592 | });
593 |
594 | if (this.$options.resize) {
595 | replacementContainer.css('resize', this.$options.resize);
596 | }
597 |
598 | // Hide the last-active textarea
599 | container.hide();
600 |
601 | // Attach the editor instances
602 | replacementContainer.data('markdown', this);
603 |
604 | if (this.$element.is(':disabled') || this.$element.is('[readonly]')) {
605 | this.$editor.addClass('md-editor-disabled');
606 | this.disableButtons('all');
607 | }
608 |
609 | return this;
610 | },
611 | hidePreview: function() {
612 | // Give flag that tells the editor to quit preview mode
613 | this.$isPreview = false;
614 |
615 | // Obtain the preview container
616 | var container = this.$editor.find('div[data-provider="markdown-preview"]');
617 |
618 | // Remove the preview container
619 | container.remove();
620 |
621 | // Enable all buttons
622 | this.enableButtons('all');
623 | // Disable configured disabled buttons
624 | this.disableButtons(this.$options.disabledButtons);
625 |
626 | // Perform any callbacks
627 | this.$options.onPreviewEnd(this);
628 |
629 | // Back to the editor
630 | this.$textarea.show();
631 | this.__setListener();
632 |
633 | return this;
634 | },
635 | isDirty: function() {
636 | return this.$oldContent != this.getContent();
637 | },
638 | getContent: function() {
639 | return this.$textarea.val();
640 | },
641 | setContent: function(content) {
642 | this.$textarea.val(content);
643 |
644 | return this;
645 | },
646 | findSelection: function(chunk) {
647 | var content = this.getContent(),
648 | startChunkPosition;
649 |
650 | if (startChunkPosition = content.indexOf(chunk), startChunkPosition >= 0 && chunk.length > 0) {
651 | var oldSelection = this.getSelection(),
652 | selection;
653 |
654 | this.setSelection(startChunkPosition, startChunkPosition + chunk.length);
655 | selection = this.getSelection();
656 |
657 | this.setSelection(oldSelection.start, oldSelection.end);
658 |
659 | return selection;
660 | } else {
661 | return null;
662 | }
663 | },
664 | getSelection: function() {
665 |
666 | var e = this.$textarea[0];
667 |
668 | return (
669 |
670 | ('selectionStart' in e && function() {
671 | var l = e.selectionEnd - e.selectionStart;
672 | return {
673 | start: e.selectionStart,
674 | end: e.selectionEnd,
675 | length: l,
676 | text: e.value.substr(e.selectionStart, l)
677 | };
678 | }) ||
679 |
680 | /* browser not supported */
681 | function() {
682 | return null;
683 | }
684 |
685 | )();
686 |
687 | },
688 | setSelection: function(start, end) {
689 |
690 | var e = this.$textarea[0];
691 |
692 | return (
693 |
694 | ('selectionStart' in e && function() {
695 | e.selectionStart = start;
696 | e.selectionEnd = end;
697 | return;
698 | }) ||
699 |
700 | /* browser not supported */
701 | function() {
702 | return null;
703 | }
704 |
705 | )();
706 |
707 | },
708 | replaceSelection: function(text) {
709 |
710 | var e = this.$textarea[0];
711 |
712 | return (
713 |
714 | ('selectionStart' in e && function() {
715 | e.value = e.value.substr(0, e.selectionStart) + text + e.value.substr(e.selectionEnd, e.value.length);
716 | // Set cursor to the last replacement end
717 | e.selectionStart = e.value.length;
718 | return this;
719 | }) ||
720 |
721 | /* browser not supported */
722 | function() {
723 | e.value += text;
724 | return jQuery(e);
725 | }
726 |
727 | )();
728 | },
729 | getNextTab: function() {
730 | // Shift the nextTab
731 | if (this.$nextTab.length === 0) {
732 | return null;
733 | } else {
734 | var nextTab, tab = this.$nextTab.shift();
735 |
736 | if (typeof tab == 'function') {
737 | nextTab = tab();
738 | } else if (typeof tab == 'object' && tab.length > 0) {
739 | nextTab = tab;
740 | }
741 |
742 | return nextTab;
743 | }
744 | },
745 | setNextTab: function(start, end) {
746 | // Push new selection into nextTab collections
747 | if (typeof start == 'string') {
748 | var that = this;
749 | this.$nextTab.push(function() {
750 | return that.findSelection(start);
751 | });
752 | } else if (typeof start == 'number' && typeof end == 'number') {
753 | var oldSelection = this.getSelection();
754 |
755 | this.setSelection(start, end);
756 | this.$nextTab.push(this.getSelection());
757 |
758 | this.setSelection(oldSelection.start, oldSelection.end);
759 | }
760 |
761 | return;
762 | },
763 | __parseButtonNameParam: function(names) {
764 | return typeof names == 'string' ?
765 | names.split(' ') :
766 | names;
767 |
768 | },
769 | enableButtons: function(name) {
770 | var buttons = this.__parseButtonNameParam(name),
771 | that = this;
772 |
773 | $.each(buttons, function(i, v) {
774 | that.__alterButtons(buttons[i], function(el) {
775 | el.removeAttr('disabled');
776 | });
777 | });
778 |
779 | return this;
780 | },
781 | disableButtons: function(name) {
782 | var buttons = this.__parseButtonNameParam(name),
783 | that = this;
784 |
785 | $.each(buttons, function(i, v) {
786 | that.__alterButtons(buttons[i], function(el) {
787 | el.attr('disabled', 'disabled');
788 | });
789 | });
790 |
791 | return this;
792 | },
793 | hideButtons: function(name) {
794 | var buttons = this.__parseButtonNameParam(name),
795 | that = this;
796 |
797 | $.each(buttons, function(i, v) {
798 | that.__alterButtons(buttons[i], function(el) {
799 | el.addClass('hidden');
800 | });
801 | });
802 |
803 | return this;
804 | },
805 | showButtons: function(name) {
806 | var buttons = this.__parseButtonNameParam(name),
807 | that = this;
808 |
809 | $.each(buttons, function(i, v) {
810 | that.__alterButtons(buttons[i], function(el) {
811 | el.removeClass('hidden');
812 | });
813 | });
814 |
815 | return this;
816 | },
817 | eventSupported: function(eventName) {
818 | var isSupported = eventName in this.$element;
819 | if (!isSupported) {
820 | this.$element.setAttribute(eventName, 'return;');
821 | isSupported = typeof this.$element[eventName] === 'function';
822 | }
823 | return isSupported;
824 | },
825 | keyup: function(e) {
826 | var blocked = false;
827 | switch (e.keyCode) {
828 | case 40: // down arrow
829 | case 38: // up arrow
830 | case 16: // shift
831 | case 17: // ctrl
832 | case 18: // alt
833 | break;
834 |
835 | case 9: // tab
836 | var nextTab;
837 | if (nextTab = this.getNextTab(), nextTab !== null) {
838 | // Get the nextTab if exists
839 | var that = this;
840 | setTimeout(function() {
841 | that.setSelection(nextTab.start, nextTab.end);
842 | }, 500);
843 |
844 | blocked = true;
845 | } else {
846 | // The next tab's memory contains nothing...
847 | // check the cursor position to determine tab action
848 | var cursor = this.getSelection();
849 |
850 | if (cursor.start == cursor.end && cursor.end == this.getContent().length) {
851 | // The cursor has reached the end of the content
852 | blocked = false;
853 | } else {
854 | // Put the cursor to the end
855 | this.setSelection(this.getContent().length, this.getContent().length);
856 |
857 | blocked = true;
858 | }
859 | }
860 |
861 | break;
862 |
863 | case 13: // enter
864 | blocked = false;
865 | var chars = this.getContent().split('');
866 | var enterIndex = this.getSelection().start;
867 | var priorNewlineIndex = -1; // initial line break at before index 0
868 |
869 | // traverse backwards through chars to check if last line break was num/bullet item
870 | for (var i = enterIndex - 2; i >= 0; i--) {
871 | if (chars[i] === '\n') {
872 | priorNewlineIndex = i;
873 | break;
874 | }
875 | }
876 |
877 | if (chars.slice(priorNewlineIndex + 1, priorNewlineIndex + 4).join('') == '---') {
878 | break;
879 | }
880 |
881 | var charFollowingLastLineBreak = chars[priorNewlineIndex + 1];
882 | if (charFollowingLastLineBreak === '-') {
883 | this.addBullet(enterIndex);
884 | } else if ($.isNumeric(charFollowingLastLineBreak)) {
885 | var numBullet = this.getBulletNumber(priorNewlineIndex + 1);
886 | if (numBullet) {
887 | this.addNumberedBullet(enterIndex, numBullet);
888 | }
889 | }
890 | break;
891 |
892 | case 27: // escape
893 | if (this.$isFullscreen) this.setFullscreen(false);
894 | blocked = false;
895 | break;
896 |
897 | default:
898 | blocked = false;
899 | }
900 |
901 | if (blocked) {
902 | e.stopPropagation();
903 | e.preventDefault();
904 | }
905 |
906 | this.$options.onChange(this);
907 | },
908 | insertContent: function(index, content) {
909 | var firstHalf = this.getContent().slice(0, index);
910 | var secondHalf = this.getContent().slice(index + 1);
911 | this.setContent(firstHalf.concat(content).concat(secondHalf));
912 | },
913 | addBullet: function(index) {
914 | this.insertContent(index, '- \n');
915 | this.setSelection(index + 2, index + 2); // Put the cursor after the bullet
916 | },
917 | addNumberedBullet: function(index, num) {
918 | var numBullet = (num + 1) + '. \n';
919 | this.insertContent(index, numBullet);
920 |
921 | var prefixLength = num.toString().length + 2;
922 | this.setSelection(index + prefixLength, index + prefixLength); // Put the cursor after the number
923 | },
924 | getBulletNumber: function(startIndex) {
925 | var bulletNum = this.getContent().slice(startIndex).split('.')[0];
926 | return $.isNumeric(bulletNum) ? parseInt(bulletNum) : null;
927 | },
928 | change: function(e) {
929 | this.$options.onChange(this);
930 | return this;
931 | },
932 | select: function(e) {
933 | this.$options.onSelect(this);
934 | return this;
935 | },
936 | focus: function(e) {
937 | var options = this.$options,
938 | isHideable = options.hideable,
939 | editor = this.$editor;
940 |
941 | editor.addClass('active');
942 |
943 | // Blur other markdown(s)
944 | $(document).find('.md-editor').each(function() {
945 | if ($(this).attr('id') !== editor.attr('id')) {
946 | var attachedMarkdown;
947 |
948 | if (attachedMarkdown = $(this).find('textarea').data('markdown'),
949 | attachedMarkdown === null) {
950 | attachedMarkdown = $(this).find('div[data-provider="markdown-preview"]').data('markdown');
951 | }
952 |
953 | if (attachedMarkdown) {
954 | attachedMarkdown.blur();
955 | }
956 | }
957 | });
958 |
959 | // Trigger the onFocus hook
960 | options.onFocus(this);
961 |
962 | return this;
963 | },
964 | blur: function(e) {
965 | var options = this.$options,
966 | isHideable = options.hideable,
967 | editor = this.$editor,
968 | editable = this.$editable;
969 |
970 | if (editor.hasClass('active') || this.$element.parent().length === 0) {
971 | editor.removeClass('active');
972 |
973 | if (isHideable) {
974 | // Check for editable elements
975 | if (editable.el !== null) {
976 | // Build the original element
977 | var oldElement = $('<' + editable.type + '/>'),
978 | content = this.getContent(),
979 | currentContent = this.parseContent(content);
980 |
981 | $(editable.attrKeys).each(function(k, v) {
982 | oldElement.attr(editable.attrKeys[k], editable.attrValues[k]);
983 | });
984 |
985 | // Get the editor content
986 | oldElement.html(currentContent);
987 |
988 | editor.replaceWith(oldElement);
989 | } else {
990 | editor.hide();
991 | }
992 | }
993 |
994 | // Trigger the onBlur hook
995 | options.onBlur(this);
996 | }
997 |
998 | return this;
999 | }
1000 |
1001 | };
1002 |
1003 | /* MARKDOWN PLUGIN DEFINITION
1004 | * ========================== */
1005 |
1006 | var old = $.fn.markdown;
1007 |
1008 | $.fn.markdown = function(option) {
1009 | return this.each(function() {
1010 | var $this = $(this),
1011 | data = $this.data('markdown'),
1012 | options = typeof option == 'object' && option;
1013 | if (!data)
1014 | $this.data('markdown', (data = new Markdown(this, options)));
1015 | });
1016 | };
1017 |
1018 | $.fn.markdown.messages = {};
1019 |
1020 | $.fn.markdown.defaults = {
1021 | /* Editor Properties */
1022 | autofocus: false,
1023 | hideable: false,
1024 | savable: false,
1025 | width: 'inherit',
1026 | height: 'inherit',
1027 | resize: 'none',
1028 | iconlibrary: 'glyph',
1029 | language: 'en',
1030 | initialstate: 'editor',
1031 | parser: null,
1032 | dropZoneOptions: null,
1033 | enableDropDataUri: false,
1034 |
1035 | /* Buttons Properties */
1036 | buttons: [
1037 | [{
1038 | name: 'groupFont',
1039 | data: [{
1040 | name: 'cmdBold',
1041 | hotkey: 'Ctrl+B',
1042 | title: 'Bold',
1043 | icon: {
1044 | glyph: 'glyphicon glyphicon-bold',
1045 | fa: 'fa fa-bold',
1046 | 'fa-3': 'icon-bold',
1047 | 'fa-5': 'fas fa-bold',
1048 | octicons: 'octicon octicon-bold'
1049 | },
1050 | callback: function(e) {
1051 | // Give/remove ** surround the selection
1052 | var chunk, cursor, selected = e.getSelection(),
1053 | content = e.getContent();
1054 |
1055 | if (selected.length === 0) {
1056 | // Give extra word
1057 | chunk = e.__localize('strong text');
1058 | } else {
1059 | chunk = selected.text;
1060 | }
1061 |
1062 | // transform selection and set the cursor into chunked text
1063 | if (content.substr(selected.start - 2, 2) === '**' &&
1064 | content.substr(selected.end, 2) === '**') {
1065 | e.setSelection(selected.start - 2, selected.end + 2);
1066 | e.replaceSelection(chunk);
1067 | cursor = selected.start - 2;
1068 | } else {
1069 | e.replaceSelection('**' + chunk + '**');
1070 | cursor = selected.start + 2;
1071 | }
1072 |
1073 | // Set the cursor
1074 | e.setSelection(cursor, cursor + chunk.length);
1075 | }
1076 | }, {
1077 | name: 'cmdItalic',
1078 | title: 'Italic',
1079 | hotkey: 'Ctrl+I',
1080 | icon: {
1081 | glyph: 'glyphicon glyphicon-italic',
1082 | fa: 'fa fa-italic',
1083 | 'fa-3': 'icon-italic',
1084 | 'fa-5': 'fas fa-italic',
1085 | octicons: 'octicon octicon-italic'
1086 | },
1087 | callback: function(e) {
1088 | // Give/remove * surround the selection
1089 | var chunk, cursor, selected = e.getSelection(),
1090 | content = e.getContent();
1091 |
1092 | if (selected.length === 0) {
1093 | // Give extra word
1094 | chunk = e.__localize('emphasized text');
1095 | } else {
1096 | chunk = selected.text;
1097 | }
1098 |
1099 | // transform selection and set the cursor into chunked text
1100 | if (content.substr(selected.start - 1, 1) === '_' &&
1101 | content.substr(selected.end, 1) === '_') {
1102 | e.setSelection(selected.start - 1, selected.end + 1);
1103 | e.replaceSelection(chunk);
1104 | cursor = selected.start - 1;
1105 | } else {
1106 | e.replaceSelection('_' + chunk + '_');
1107 | cursor = selected.start + 1;
1108 | }
1109 |
1110 | // Set the cursor
1111 | e.setSelection(cursor, cursor + chunk.length);
1112 | }
1113 | }, {
1114 | name: 'cmdHeading',
1115 | title: 'Heading',
1116 | hotkey: 'Ctrl+H',
1117 | icon: {
1118 | glyph: 'glyphicon glyphicon-header',
1119 | fa: 'fa fa-header',
1120 | 'fa-3': 'icon-font',
1121 | 'fa-5': 'fas fa-heading',
1122 | octicons: 'octicon octicon-text-size'
1123 | },
1124 | callback: function(e) {
1125 | // Append/remove ### surround the selection
1126 | var chunk, cursor, selected = e.getSelection(),
1127 | content = e.getContent(),
1128 | pointer, prevChar;
1129 |
1130 | if (selected.length === 0) {
1131 | // Give extra word
1132 | chunk = e.__localize('heading text');
1133 | } else {
1134 | chunk = selected.text + '\n';
1135 | }
1136 |
1137 | // transform selection and set the cursor into chunked text
1138 | if ((pointer = 4, content.substr(selected.start - pointer, pointer) === '### ') ||
1139 | (pointer = 3, content.substr(selected.start - pointer, pointer) === '###')) {
1140 | e.setSelection(selected.start - pointer, selected.end);
1141 | e.replaceSelection(chunk);
1142 | cursor = selected.start - pointer;
1143 | } else if (selected.start > 0 && (prevChar = content.substr(selected.start - 1, 1), !!prevChar && prevChar != '\n')) {
1144 | e.replaceSelection('\n\n### ' + chunk);
1145 | cursor = selected.start + 6;
1146 | } else {
1147 | // Empty string before element
1148 | e.replaceSelection('### ' + chunk);
1149 | cursor = selected.start + 4;
1150 | }
1151 |
1152 | // Set the cursor
1153 | e.setSelection(cursor, cursor + chunk.length);
1154 | }
1155 | }]
1156 | }, {
1157 | name: 'groupLink',
1158 | data: [{
1159 | name: 'cmdUrl',
1160 | title: 'URL/Link',
1161 | hotkey: 'Ctrl+L',
1162 | icon: {
1163 | glyph: 'glyphicon glyphicon-link',
1164 | fa: 'fa fa-link',
1165 | 'fa-3': 'icon-link',
1166 | 'fa-5': 'fas fa-link',
1167 | octicons: 'octicon octicon-link'
1168 | },
1169 | callback: function(e) {
1170 | // Give [] surround the selection and prepend the link
1171 | var chunk, cursor, selected = e.getSelection(),
1172 | content = e.getContent(),
1173 | link;
1174 |
1175 | if (selected.length === 0) {
1176 | // Give extra word
1177 | chunk = e.__localize('enter link description here');
1178 | } else {
1179 | chunk = selected.text;
1180 | }
1181 |
1182 | link = prompt(e.__localize('Insert Hyperlink'), 'http://');
1183 |
1184 | var urlRegex = new RegExp('^((http|https)://|(mailto:)|(//))[a-z0-9]', 'i');
1185 | if (link !== null && link !== '' && link !== 'http://' && urlRegex.test(link)) {
1186 | var sanitizedLink = $('' + link + '
').text();
1187 |
1188 | // transform selection and set the cursor into chunked text
1189 | e.replaceSelection('[' + chunk + '](' + sanitizedLink + ')');
1190 | cursor = selected.start + 1;
1191 |
1192 | // Set the cursor
1193 | e.setSelection(cursor, cursor + chunk.length);
1194 | }
1195 | }
1196 | }, {
1197 | name: 'cmdImage',
1198 | title: 'Image',
1199 | hotkey: 'Ctrl+G',
1200 | icon: {
1201 | glyph: 'glyphicon glyphicon-picture',
1202 | fa: 'fa fa-picture-o',
1203 | 'fa-3': 'icon-picture',
1204 | 'fa-5': 'far fa-image',
1205 | octicons: 'octicon octicon-file-media'
1206 | },
1207 | callback: function(e) {
1208 | // Give ![] surround the selection and prepend the image link
1209 | var chunk, cursor, selected = e.getSelection(),
1210 | content = e.getContent(),
1211 | link;
1212 |
1213 | if (selected.length === 0) {
1214 | // Give extra word
1215 | chunk = e.__localize('enter image description here');
1216 | } else {
1217 | chunk = selected.text;
1218 | }
1219 |
1220 | link = prompt(e.__localize('Insert Image Hyperlink'), 'http://');
1221 |
1222 | var urlRegex = new RegExp('^((http|https)://|(//))[a-z0-9]', 'i');
1223 | if (link !== null && link !== '' && link !== 'http://' && urlRegex.test(link)) {
1224 | var sanitizedLink = $('' + link + '
').text();
1225 |
1226 | // transform selection and set the cursor into chunked text
1227 | e.replaceSelection(' + '")');
1228 | cursor = selected.start + 2;
1229 |
1230 | // Set the next tab
1231 | e.setNextTab(e.__localize('enter image title here'));
1232 |
1233 | // Set the cursor
1234 | e.setSelection(cursor, cursor + chunk.length);
1235 | }
1236 | }
1237 | }]
1238 | }, {
1239 | name: 'groupMisc',
1240 | data: [{
1241 | name: 'cmdList',
1242 | hotkey: 'Ctrl+U',
1243 | title: 'Unordered List',
1244 | icon: {
1245 | glyph: 'glyphicon glyphicon-list',
1246 | fa: 'fa fa-list',
1247 | 'fa-3': 'icon-list-ul',
1248 | 'fa-5': 'fas fa-list-ul',
1249 | octicons: 'octicon octicon-list-unordered'
1250 | },
1251 | callback: function(e) {
1252 | // Prepend/Give - surround the selection
1253 | var chunk, cursor, selected = e.getSelection(),
1254 | content = e.getContent();
1255 |
1256 | // transform selection and set the cursor into chunked text
1257 | if (selected.length === 0) {
1258 | // Give extra word
1259 | chunk = e.__localize('list text here');
1260 |
1261 | e.replaceSelection('- ' + chunk);
1262 | // Set the cursor
1263 | cursor = selected.start + 2;
1264 | } else {
1265 | if (selected.text.indexOf('\n') < 0) {
1266 | chunk = selected.text;
1267 |
1268 | e.replaceSelection('- ' + chunk);
1269 |
1270 | // Set the cursor
1271 | cursor = selected.start + 2;
1272 | } else {
1273 | var list = [];
1274 |
1275 | list = selected.text.split('\n');
1276 | chunk = list[0];
1277 |
1278 | $.each(list, function(k, v) {
1279 | list[k] = '- ' + v;
1280 | });
1281 |
1282 | e.replaceSelection('\n\n' + list.join('\n'));
1283 |
1284 | // Set the cursor
1285 | cursor = selected.start + 4;
1286 | }
1287 | }
1288 |
1289 | // Set the cursor
1290 | e.setSelection(cursor, cursor + chunk.length);
1291 | }
1292 | }, {
1293 | name: 'cmdListO',
1294 | hotkey: 'Ctrl+O',
1295 | title: 'Ordered List',
1296 | icon: {
1297 | glyph: 'glyphicon glyphicon-th-list',
1298 | fa: 'fa fa-list-ol',
1299 | 'fa-3': 'icon-list-ol',
1300 | 'fa-5': 'fas fa-list-ol',
1301 | octicons: 'octicon octicon-list-ordered'
1302 | },
1303 | callback: function(e) {
1304 |
1305 | // Prepend/Give - surround the selection
1306 | var chunk, cursor, selected = e.getSelection(),
1307 | content = e.getContent();
1308 |
1309 | // transform selection and set the cursor into chunked text
1310 | if (selected.length === 0) {
1311 | // Give extra word
1312 | chunk = e.__localize('list text here');
1313 | e.replaceSelection('1. ' + chunk);
1314 | // Set the cursor
1315 | cursor = selected.start + 3;
1316 | } else {
1317 | if (selected.text.indexOf('\n') < 0) {
1318 | chunk = selected.text;
1319 |
1320 | e.replaceSelection('1. ' + chunk);
1321 |
1322 | // Set the cursor
1323 | cursor = selected.start + 3;
1324 | } else {
1325 | var i = 1;
1326 | var list = [];
1327 |
1328 | list = selected.text.split('\n');
1329 | chunk = list[0];
1330 |
1331 | $.each(list, function(k, v) {
1332 | list[k] = i + '. ' + v;
1333 | i++;
1334 | });
1335 |
1336 | e.replaceSelection('\n\n' + list.join('\n'));
1337 |
1338 | // Set the cursor
1339 | cursor = selected.start + 5;
1340 | }
1341 | }
1342 |
1343 | // Set the cursor
1344 | e.setSelection(cursor, cursor + chunk.length);
1345 | }
1346 | }, {
1347 | name: 'cmdCode',
1348 | hotkey: 'Ctrl+K',
1349 | title: 'Code',
1350 | icon: {
1351 | glyph: 'glyphicon glyphicon-console',
1352 | fa: 'fa fa-code',
1353 | 'fa-3': 'icon-code',
1354 | 'fa-5': 'fas fa-code',
1355 | octicons: 'octicon octicon-code'
1356 | },
1357 | callback: function(e) {
1358 | // Give/remove ** surround the selection
1359 | var chunk, cursor, selected = e.getSelection(),
1360 | content = e.getContent();
1361 |
1362 | if (selected.length === 0) {
1363 | // Give extra word
1364 | chunk = e.__localize('code text here');
1365 | } else {
1366 | chunk = selected.text;
1367 | }
1368 |
1369 | // transform selection and set the cursor into chunked text
1370 | if (content.substr(selected.start - 4, 4) === '```\n' &&
1371 | content.substr(selected.end, 4) === '\n```') {
1372 | e.setSelection(selected.start - 4, selected.end + 4);
1373 | e.replaceSelection(chunk);
1374 | cursor = selected.start - 4;
1375 | } else if (content.substr(selected.start - 1, 1) === '`' &&
1376 | content.substr(selected.end, 1) === '`') {
1377 | e.setSelection(selected.start - 1, selected.end + 1);
1378 | e.replaceSelection(chunk);
1379 | cursor = selected.start - 1;
1380 | } else if (content.indexOf('\n') > -1) {
1381 | e.replaceSelection('```\n' + chunk + '\n```');
1382 | cursor = selected.start + 4;
1383 | } else {
1384 | e.replaceSelection('`' + chunk + '`');
1385 | cursor = selected.start + 1;
1386 | }
1387 |
1388 | // Set the cursor
1389 | e.setSelection(cursor, cursor + chunk.length);
1390 | }
1391 | }, {
1392 | name: 'cmdQuote',
1393 | hotkey: 'Ctrl+Q',
1394 | title: 'Quote',
1395 | icon: {
1396 | glyph: 'glyphicon glyphicon-comment',
1397 | fa: 'fa fa-quote-left',
1398 | 'fa-3': 'icon-quote-left',
1399 | 'fa-5': 'fas fa-quote-left',
1400 | octicons: 'octicon octicon-quote'
1401 | },
1402 | callback: function(e) {
1403 | // Prepend/Give - surround the selection
1404 | var chunk, cursor, selected = e.getSelection(),
1405 | content = e.getContent();
1406 |
1407 | // transform selection and set the cursor into chunked text
1408 | if (selected.length === 0) {
1409 | // Give extra word
1410 | chunk = e.__localize('quote here');
1411 |
1412 | e.replaceSelection('> ' + chunk);
1413 |
1414 | // Set the cursor
1415 | cursor = selected.start + 2;
1416 | } else {
1417 | if (selected.text.indexOf('\n') < 0) {
1418 | chunk = selected.text;
1419 |
1420 | e.replaceSelection('> ' + chunk);
1421 |
1422 | // Set the cursor
1423 | cursor = selected.start + 2;
1424 | } else {
1425 | var list = [];
1426 |
1427 | list = selected.text.split('\n');
1428 | chunk = list[0];
1429 |
1430 | $.each(list, function(k, v) {
1431 | list[k] = '> ' + v;
1432 | });
1433 |
1434 | e.replaceSelection('\n\n' + list.join('\n'));
1435 |
1436 | // Set the cursor
1437 | cursor = selected.start + 4;
1438 | }
1439 | }
1440 |
1441 | // Set the cursor
1442 | e.setSelection(cursor, cursor + chunk.length);
1443 | }
1444 | }]
1445 | }, {
1446 | name: 'groupUtil',
1447 | data: [{
1448 | name: 'cmdPreview',
1449 | toggle: true,
1450 | hotkey: 'Ctrl+P',
1451 | title: 'Preview',
1452 | btnText: 'Preview',
1453 | btnClass: 'btn btn-primary btn-sm',
1454 | icon: {
1455 | glyph: 'glyphicon glyphicon-search',
1456 | fa: 'fa fa-search',
1457 | 'fa-3': 'icon-search',
1458 | 'fa-5': 'fas fa-search',
1459 | octicons: 'octicon octicon-search'
1460 | },
1461 | callback: function(e) {
1462 | // Check the preview mode and toggle based on this flag
1463 | var isPreview = e.$isPreview,
1464 | content;
1465 |
1466 | if (isPreview === false) {
1467 | // Give flag that tells the editor to enter preview mode
1468 | e.showPreview();
1469 | } else {
1470 | e.hidePreview();
1471 | }
1472 | }
1473 | }]
1474 | }]
1475 | ],
1476 | customIcons: {},
1477 | additionalButtons: [], // Place to hook more buttons by code
1478 | reorderButtonGroups: [],
1479 | hiddenButtons: [], // Default hidden buttons
1480 | disabledButtons: [], // Default disabled buttons
1481 | footer: '',
1482 | fullscreen: {
1483 | enable: true,
1484 | icons: {
1485 | fullscreenOn: {
1486 | name: "fullscreenOn",
1487 | icon: {
1488 | fa: 'fa fa-expand',
1489 | glyph: 'glyphicon glyphicon-fullscreen',
1490 | 'fa-3': 'icon-resize-full',
1491 | 'fa-5': 'fas fa-expand-arrows-alt',
1492 | octicons: 'octicon octicon-link-external'
1493 | }
1494 | },
1495 | fullscreenOff: {
1496 | name: "fullscreenOff",
1497 | icon: {
1498 | fa: 'fa fa-compress',
1499 | glyph: 'glyphicon glyphicon-fullscreen',
1500 | 'fa-3': 'icon-resize-small',
1501 | 'fa-5': 'fas fa-compress',
1502 | octicons: 'octicon octicon-browser'
1503 | }
1504 | }
1505 | }
1506 | },
1507 |
1508 | /* Events hook */
1509 | onShow: function(e) {},
1510 | onPreview: function(e) {},
1511 | onPreviewEnd: function(e) {},
1512 | onSave: function(e) {},
1513 | onBlur: function(e) {},
1514 | onFocus: function(e) {},
1515 | onChange: function(e) {},
1516 | onFullscreen: function(e) {},
1517 | onFullscreenExit: function(e) {},
1518 | onSelect: function(e) {}
1519 | };
1520 |
1521 | $.fn.markdown.Constructor = Markdown;
1522 |
1523 |
1524 | /* MARKDOWN NO CONFLICT
1525 | * ==================== */
1526 |
1527 | $.fn.markdown.noConflict = function() {
1528 | $.fn.markdown = old;
1529 | return this;
1530 | };
1531 |
1532 | /* MARKDOWN GLOBAL FUNCTION & DATA-API
1533 | * ==================================== */
1534 | var initMarkdown = function(el) {
1535 | var $this = el;
1536 |
1537 | if ($this.data('markdown')) {
1538 | $this.data('markdown').showEditor();
1539 | return;
1540 | }
1541 |
1542 | $this.markdown();
1543 | };
1544 |
1545 | var blurNonFocused = function(e) {
1546 | var $activeElement = $(document.activeElement);
1547 |
1548 | // Blur event
1549 | $(document).find('.md-editor').each(function() {
1550 | var $this = $(this),
1551 | focused = $activeElement.closest('.md-editor')[0] === this,
1552 | attachedMarkdown = $this.find('textarea').data('markdown') ||
1553 | $this.find('div[data-provider="markdown-preview"]').data('markdown');
1554 |
1555 | if (attachedMarkdown && !focused) {
1556 | attachedMarkdown.blur();
1557 | }
1558 | });
1559 | };
1560 |
1561 | $(document)
1562 | .on('click.markdown.data-api', '[data-provide="markdown-editable"]', function(e) {
1563 | initMarkdown($(this));
1564 | e.preventDefault();
1565 | })
1566 | .on('click focusin', function(e) {
1567 | blurNonFocused(e);
1568 | })
1569 | .ready(function() {
1570 | $('textarea[data-provide="markdown"]').each(function() {
1571 | initMarkdown($(this));
1572 | });
1573 | });
1574 |
1575 | }));
1576 |
--------------------------------------------------------------------------------
/less/bootstrap-markdown.less:
--------------------------------------------------------------------------------
1 | /**
2 | * Bootstrap-Markdown.less
3 | *
4 | * @author Taufan Aditya @taufanaditya
5 | * @copyright 2013-2016 Taufan Aditya
6 | */
7 |
8 | @table-border-color: #ddd;
9 | @panel-default-heading-bg: #f5f5f5;
10 | @panel-bg: #fff;
11 | @font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
12 | @font-size-base: 14px;
13 | @input-bg-disabled: #eeeeee;
14 | @input-bg: #fff;
15 | @input-border-focus: #66afe9;
16 |
17 | .md-editor {
18 | display: block;
19 | border: 1px solid @table-border-color;
20 |
21 | > .md-header, .md-footer {
22 | display: block;
23 | padding: 6px 4px;
24 | background: @panel-default-heading-bg;
25 | }
26 |
27 | > .md-header {
28 | margin: 0;
29 | }
30 |
31 | > .md-preview {
32 | background: @panel-bg;
33 | border-top: 1px dashed @table-border-color;
34 | border-bottom: 1px dashed @table-border-color;
35 | min-height: 10px;
36 | overflow: auto;
37 | }
38 |
39 | > textarea {
40 | font-family: @font-family-monospace;
41 | font-size: @font-size-base;
42 | outline: 0;
43 | outline: thin dotted \9; /* IE6-9 */
44 | margin: 0;
45 | display: block;
46 | padding: 0;
47 | width: 100%;
48 | border: 0;
49 | border-top: 1px dashed @table-border-color;
50 | border-bottom: 1px dashed @table-border-color;
51 | border-radius: 0;
52 | box-shadow: none;
53 | background: @input-bg-disabled;
54 | &:focus {
55 | box-shadow: none;
56 | background: @input-bg;
57 | }
58 | }
59 |
60 | // Hover state
61 | @color: @input-border-focus;
62 | @color-rgba: rgba(red(@color), green(@color), blue(@color), .6);
63 | &.active {
64 | border-color: @color;
65 | outline: 0;
66 | .box-shadow(~"inset 0 1px 1px rgba(0,0,0,.075), 0 0 8px @{color-rgba}");
67 | }
68 |
69 | .md-controls {
70 | float: right;
71 | padding: 3px;
72 |
73 | .md-control {
74 | right: 5px;
75 | color: #bebebe;
76 | padding: 3px 3px 3px 10px;
77 | &:hover {
78 | color: #333;
79 | }
80 | }
81 | }
82 |
83 | // fullscreen mode styles
84 | &.md-fullscreen-mode {
85 | width: 100%;
86 | height: 100%;
87 | position: fixed;
88 | top: 0;
89 | left: 0;
90 | z-index: 99999;
91 | padding: 60px 30px 15px;
92 | background: #fff !important;
93 | border: 0 !important;
94 |
95 | .md-footer {
96 | display: none;
97 | }
98 |
99 | .md-input,
100 | .md-preview {
101 | margin: 0 auto !important;
102 | height: 100% !important;
103 | font-size: 20px !important;
104 | padding: 20px !important;
105 | color: #999;
106 | line-height: 1.6em !important;
107 | resize: none !important;
108 | box-shadow: none !important;
109 | background: #fff !important;
110 | border: 0 !important;
111 | }
112 |
113 | .md-preview {
114 | color: #333;
115 | overflow: auto;
116 | }
117 |
118 | .md-input {
119 | &:hover,
120 | &:focus {
121 | color: #333;
122 | background: #fff !important;
123 | }
124 | }
125 |
126 | .md-header {
127 | background: none;
128 | text-align: center;
129 | position: fixed;
130 | width: 100%;
131 | top: 20px;
132 | }
133 |
134 | .btn-group {
135 | float: none;
136 | }
137 |
138 | .btn {
139 | border: 0;
140 | background: none;
141 | color: #b3b3b3;
142 |
143 | &:hover,
144 | &:focus,
145 | &.active,
146 | &:active {
147 | box-shadow: none;
148 | color: #333;
149 | }
150 | }
151 |
152 | .md-fullscreen-controls {
153 | position: absolute;
154 | top: 20px;
155 | right: 20px;
156 | text-align: right;
157 | z-index: 1002;
158 | display: block;
159 | a {
160 | color: #b3b3b3;
161 | clear: right;
162 | margin: 10px;
163 | width: 30px;
164 | height: 30px;
165 | text-align: center;
166 |
167 | &:hover {
168 | color: #333;
169 | text-decoration: none;
170 | }
171 | }
172 | }
173 |
174 | .md-editor {
175 | height: 100% !important;
176 | position: relative;
177 | }
178 | }
179 |
180 | .md-fullscreen-controls {
181 | display: none;
182 | }
183 | }
184 |
185 | .md-nooverflow {
186 | overflow: hidden;
187 | position: fixed;
188 | width: 100%;
189 | }
190 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.ar.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Arabic translation for bootstrap-markdown
3 | * George Ajam
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.nl = {
7 | 'Bold': "غامق",
8 | 'Italic': "مائل",
9 | 'Heading': "عنوان",
10 | 'URL/Link': "URL/رابط",
11 | 'Image': "صورة",
12 | 'List': "قائمة",
13 | 'Preview': "استعراض",
14 | 'strong text': "نص غامق",
15 | 'emphasized text': "نص هام",
16 | 'heading text': "العنوان",
17 | 'enter link description here': "ادخل وصف الرابط هنا",
18 | 'Insert Hyperlink': "ادخل الرابط هنا",
19 | 'enter image description here': "ادخل وصف الصورة هنا",
20 | 'Insert Image Hyperlink': "ادخل رابط الصورة هنا",
21 | 'enter image title here': "ادخل عنوان الصورة هنا",
22 | 'list text here': "اكتب النص هنا"
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.cs.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Czech translation for bootstrap-markdown
3 | * Vít Kabele
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.cs = {
7 | 'Bold': "Tučně",
8 | 'Italic': "Kurzíva",
9 | 'Heading': "Nadpis",
10 | 'URL/Link': "URL/Odkaz",
11 | 'Image': "Obrázek",
12 | 'Unordered List': "Seznam",
13 | 'Ordered List': "Seřazený seznam",
14 | 'Code': "Úsek kódu",
15 | 'Quote': "Citace",
16 | 'Preview': "Náhled",
17 | 'strong text': "tučný text",
18 | 'emphasized text': "zdůrazněný text",
19 | 'heading text': "text nadpisu",
20 | 'enter link description here': "sem vlož popis odkazu",
21 | 'Insert Hyperlink': "Vložit Hyperlink",
22 | 'enter image description here': "sem vlož popis obrázku",
23 | 'Insert Image Hyperlink': "Vlož adresu obrázku",
24 | 'enter image title here': "sem vlož popis obrázku",
25 | 'list text here': "položka seznamu"
26 | };
27 | }(jQuery));
28 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.da.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Danish translation for bootstrap-markdown
3 | * Dan Storm
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.da = {
7 | 'Bold': 'Fed',
8 | 'Italic': 'Kursiv',
9 | 'Heading': 'Overskrift',
10 | 'URL/Link': 'URL/Link',
11 | 'Image': 'Billede',
12 | 'List': 'Liste',
13 | 'Preview': 'Forhåndsvisning',
14 | 'strong text': 'stærk tekst',
15 | 'emphasized text': 'fremhævet tekst',
16 | 'heading text': 'overskrift tekst',
17 | 'enter link description here': 'Skriv link beskrivelse her',
18 | 'Insert Hyperlink': 'Indsæt link',
19 | 'enter image description here': 'Indsæt billede beskrivelse her',
20 | 'Insert Image Hyperlink': 'Indsæt billede link',
21 | 'enter image title here': 'Indsæt billede titel',
22 | 'list text here': 'Indsæt liste tekst her',
23 | 'quote here': 'Indsæt citat her',
24 | 'code text here': 'Indsæt kode her'
25 | };
26 | }(jQuery));
27 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.de.js:
--------------------------------------------------------------------------------
1 | /**
2 | * German translation for bootstrap-markdown
3 | * Tobias Nitsche
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.de = {
7 | 'Bold': "Fett",
8 | 'Italic': "Kursiv",
9 | 'Heading': "Überschrift",
10 | 'URL/Link': "Link hinzufügen",
11 | 'Image': "Bild hinzufügen",
12 | 'Unordered List': "Unnummerierte Liste",
13 | 'Ordered List': "Nummerierte Liste",
14 | 'Code': "Quelltext",
15 | 'code text here': "Quelltext hier einfügen",
16 | 'Quote': "Zitat",
17 | 'quote here': "Zitat hier einfügen",
18 | 'Preview': "Vorschau",
19 | 'Save': "Speichern",
20 | 'strong text': "Sehr betonter Text",
21 | 'emphasized text': "Betonter Text",
22 | 'heading text': "Überschrift Text",
23 | 'enter link description here': "Linkbeschreibung",
24 | 'Insert Hyperlink': "URL",
25 | 'enter image description here': "Bildbeschreibung",
26 | 'Insert Image Hyperlink': "Bild-URL",
27 | 'enter image title here': "Titel des Bildes",
28 | 'list text here': "Aufzählungs-Text"
29 | };
30 | }(jQuery));
31 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.es.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Spanish translation for bootstrap-markdown
3 | * by Leandro Poblet
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.es = {
7 | 'Bold': "Negrita",
8 | 'Italic': "Itálica",
9 | 'Heading': "Título",
10 | 'URL/Link': "Inserte un link",
11 | 'Image': "Inserte una imagen",
12 | 'List': "Lista de items",
13 | 'Unordered List': "Lista desordenada",
14 | 'Ordered List': "Lista ordenada",
15 | 'Code': "Código",
16 | 'Quote': "Cita",
17 | 'Preview': "Previsualizar",
18 | 'strong text': "Texto importante",
19 | 'emphasized text': "Texto con énfasis",
20 | 'heading text': "Texto de título",
21 | 'enter link description here': "Descripción del link",
22 | 'Insert Hyperlink': "Inserte un hipervínculo",
23 | 'enter image description here': "Descripción de la imagen",
24 | 'Insert Image Hyperlink': "Inserte una imagen con un hipervínculo",
25 | 'enter image title here': "Inserte una imagen con título",
26 | 'list text here': "Texto de lista aquí",
27 | 'code text here': "Código aquí",
28 | 'quote here': "Cita aquí",
29 | 'Save': "Guardar"
30 | };
31 | }(jQuery));
32 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.fa.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Persian(Farsi) translation for bootstrap-markdown
3 | * Sajad Dehshiri
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.fa = {
7 | 'Bold': "توپر",
8 | 'Italic': "مورب",
9 | 'Heading': "عنوان",
10 | 'URL/Link': "پیوند",
11 | 'Image': "تصویر",
12 | 'List': "فهرست",
13 | 'Preview': "پیش نمایش",
14 | 'strong text': "متن ضخیم",
15 | 'emphasized text': "نوشته تاکیدی",
16 | 'heading text': "عنوان",
17 | 'enter link description here': "توضیحات پیوند را بنویسید.",
18 | 'Insert Hyperlink': "پیوند را درج نمایید:",
19 | 'enter image description here': "توضیحی برای تصوی بنویسید.",
20 | 'Insert Image Hyperlink': "آدرس تصویر را بنویسید.",
21 | 'enter image title here': "عنوان تصویر را اینجا بنویسید",
22 | 'list text here': "محل متن فهرست"
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.fr.js:
--------------------------------------------------------------------------------
1 | /**
2 | * French translation for bootstrap-markdown
3 | * Benoît Bourgeois
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.fr = {
7 | 'Bold': "Gras",
8 | 'Italic': "Italique",
9 | 'Heading': "Titre",
10 | 'URL/Link': "Insérer un lien HTTP",
11 | 'Image': "Insérer une image",
12 | 'List': "Liste à puces",
13 | 'Preview': "Prévisualiser",
14 | 'strong text': "texte important",
15 | 'emphasized text': "texte en italique",
16 | 'heading text': "texte d'entête",
17 | 'enter link description here': "entrez la description du lien ici",
18 | 'Insert Hyperlink': "Insérez le lien hypertexte",
19 | 'enter image description here': "entrez la description de l'image ici",
20 | 'Insert Image Hyperlink': "Insérez le lien hypertexte de l'image",
21 | 'enter image title here': "entrez le titre de l'image ici",
22 | 'list text here': "texte à puce ici",
23 | 'Save': "Sauvegarder",
24 | 'Ordered List': "Liste ordonnée",
25 | 'Unordered List': "Liste désordonnée",
26 | 'Quote': "Citation",
27 | 'quote here': "Votre citation",
28 | 'Code': "Code",
29 | 'code text here': "écrire du code ici"
30 | };
31 | }(jQuery));
32 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.hu.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Hungarian translation for bootstrap-markdown
3 | * T1k3
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.hu = {
7 | 'Bold': 'Félkövér',
8 | 'Italic': 'Dőlt',
9 | 'Heading': 'Címsor',
10 | 'URL/Link': 'URL/Link',
11 | 'Image': 'Kép',
12 | 'List': 'Lista',
13 | 'Preview': 'Előnézet',
14 | 'strong text': 'Félkövér',
15 | 'emphasized text': 'Kiemelt szöveg',
16 | 'heading text': 'Címszöveg',
17 | 'enter link description here': 'Adja meg a link leírását',
18 | 'Insert Hyperlink': 'URL beszúrása',
19 | 'enter image description here': 'Adja meg a kép leírását',
20 | 'Insert Image Hyperlink': 'Kép URL beszúrása',
21 | 'enter image title here': 'Adja meg a kép címét',
22 | 'list text here': 'Lista szövege',
23 | 'quote here': 'Idézet',
24 | 'code text here': 'Kód'
25 | };
26 | }(jQuery));
27 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.it.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Italian translation for bootstrap-markdown
3 | * Michele Virgilio
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.it = {
7 | 'Bold': "Grassetto",
8 | 'Italic': "Corsivo",
9 | 'Heading': "Titolo",
10 | 'URL/Link': "URL/Collegamento",
11 | 'Image': "Inserisci un'immagine",
12 | 'List': "Lista",
13 | 'Preview': "Anteprima",
14 | 'strong text': "Testo grassetto",
15 | 'emphasized text': "Testo corsivo",
16 | 'heading text': "Titolo",
17 | 'enter link description here': "Inserisci la descrizione del link",
18 | 'Insert Hyperlink': "Inserisci Hyperlink",
19 | 'enter image description here': "Inserisci la descrizione dell'immagine",
20 | 'Insert Image Hyperlink': "Inserisci link per l'immagine",
21 | 'enter image title here': "Inserisci il titolo dell'immagine",
22 | 'list text here': "Testo della lista"
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.ja.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Japanese translation for bootstrap-markdown
3 | * Kenta Murakami
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.ja = {
7 | 'Bold': "太字",
8 | 'Italic': "斜体",
9 | 'Heading': "見出し",
10 | 'URL/Link': "リンク",
11 | 'Image': "画像",
12 | 'Unordered List': "リスト",
13 | 'Ordered List': "数字リスト",
14 | 'Code': "コード",
15 | 'Quote': "引用",
16 | 'Preview': "プレビュー",
17 | 'strong text': "太字",
18 | 'emphasized text': "強調",
19 | 'heading text': "見出し",
20 | 'enter link description here': "リンク説明",
21 | 'Insert Hyperlink': "リンク挿入",
22 | 'enter image description here': "画像説明",
23 | 'Insert Image Hyperlink': "画像挿入",
24 | 'enter image title here': "画像タイトル",
25 | 'list text here': "リスト挿入",
26 | 'code text here': "コード",
27 | 'quote here': "引用挿入"
28 | };
29 | }(jQuery));
30 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.kr.js:
--------------------------------------------------------------------------------
1 | /**
2 | + * Korean translation for bootstrap-markdown
3 | + * WoongBi Kim
4 | + */
5 | (function ($) {
6 | $.fn.markdown.messages.kr = {
7 | 'Bold': "진하게",
8 | 'Italic': "이탤릭체",
9 | 'Heading': "머리글",
10 | 'URL/Link': "링크주소",
11 | 'Image': "이미지",
12 | 'List': "리스트",
13 | 'Preview': "미리보기",
14 | 'strong text': "강한 강조 텍스트",
15 | 'emphasized text': "강조 텍스트",
16 | 'heading text': "머리글 텍스트",
17 | 'enter link description here': "여기에 링크의 설명을 적으세요",
18 | 'Insert Hyperlink': "하이퍼링크 삽입",
19 | 'enter image description here': "여기세 이미지 설명을 적으세요",
20 | 'Insert Image Hyperlink': "이미지 링크 삽입",
21 | 'enter image title here': "여기에 이미지 제목을 적으세요",
22 | 'list text here': "리스트 텍스트"
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.nb.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Norwegian bokmål translation for bootstrap-markdown
3 | * Tobias Bohwalli
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.nb = {
7 | 'Bold': 'Fet',
8 | 'Italic': 'Kursiv',
9 | 'Heading': 'Overskrift',
10 | 'URL/Link': 'URL/Lenke',
11 | 'Image': 'Bilde',
12 | 'List': 'Liste',
13 | 'Preview': 'Forhåndsvisning',
14 | 'strong text': 'sterk tekst',
15 | 'emphasized text': 'streket tekst',
16 | 'heading text': 'overskriften tekst',
17 | 'enter link description here': 'Skriv linken beskrivelse her',
18 | 'Insert Hyperlink': 'Sett inn lenke',
19 | 'enter image description here': 'Angi bildebeskrivelse her',
20 | 'Insert Image Hyperlink': 'Sett inn lenke for bilde',
21 | 'enter image title here': 'Angi bildetittel her',
22 | 'list text here': 'liste tekst her'
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.nl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Dutch translation for bootstrap-markdown
3 | * Jeroen Thora
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.nl = {
7 | 'Bold': "Vet",
8 | 'Italic': "Cursief",
9 | 'Heading': "Titel",
10 | 'URL/Link': "URL/Link",
11 | 'Image': "Afbeelding",
12 | 'List': "Lijst",
13 | 'Preview': "Voorbeeld",
14 | 'strong text': "vet gedrukte tekst",
15 | 'emphasized text': "schuin gedrukte tekst",
16 | 'heading text': "Titel",
17 | 'enter link description here': "Voer een link beschrijving in",
18 | 'Insert Hyperlink': "Voer een http link in",
19 | 'enter image description here': "Voer een afbeelding beschrijving in",
20 | 'Insert Image Hyperlink': "Voer een afbeelding link in",
21 | 'enter image title here': "Voer de afbeelding titel in",
22 | 'list text here': "lijst item"
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.pl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Polish translation for bootstrap-markdown
3 | * Marek Kaput
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.pl = {
7 | 'Bold': "Pogrubienie",
8 | 'Italic': "Kursywa",
9 | 'Heading': "Nagłówek",
10 | 'URL/Link': "Wstaw link",
11 | 'Image': "Wstaw obrazek",
12 | 'Unordered List': "Lista punktowana",
13 | 'Ordered List': "Lista numerowana",
14 | 'Code': "Kod źródłowy",
15 | 'Quote': "Cytat",
16 | 'Preview': "Podgląd",
17 | 'strong text': "pogrubiony tekst",
18 | 'emphasized text': "pochylony tekst",
19 | 'heading text': "nagłówek",
20 | 'enter link description here': "opis linka",
21 | 'Insert Hyperlink': "Wstaw link",
22 | 'enter image description here': "opis obrazka",
23 | 'Insert Image Hyperlink': "Wstaw obrazek",
24 | 'enter image title here': "tytuł obrazka",
25 | 'list text here': "lista"
26 | };
27 | }(jQuery));
28 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.ptBR.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Brazilian Portuguese translation for bootstrap-markdown
3 | * Gabriel Anderson
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.ptBR = {
7 | 'Bold': "Negrito",
8 | 'Italic': "Itálico",
9 | 'Heading': "Título",
10 | 'URL/Link': "Inserir link",
11 | 'Image': "Inserir uma imagem",
12 | 'List': "Lista",
13 | 'Preview': "Visualizar",
14 | 'strong text': "Texto importante",
15 | 'emphasized text': "Texto em itálico",
16 | 'heading text': "Texto de título",
17 | 'enter link description here': "Insira a descrição do link aqui",
18 | 'Insert Hyperlink': "Inserir um hyperlink",
19 | 'enter image description here': "Insira a descrição da imagem aqui",
20 | 'Insert Image Hyperlink': "Insira o link da imagem aqui",
21 | 'enter image title here': "Insira o título da imagem aqui",
22 | 'list text here': "Texto da lista aqui",
23 | 'Save': "Salvar",
24 | 'Ordered List': "Lista ordenada",
25 | 'Unordered List': "Lista",
26 | 'Quote': "Citação",
27 | 'quote here': "Escreva a citação",
28 | 'Code': "Código",
29 | 'code text here': "Escreva o código aqui"
30 | };
31 | }(jQuery));
32 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.ru.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Russian translation for bootstrap-markdown
3 | * by Oleg Vivtash
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.ru = {
7 | 'Bold': "Жирный",
8 | 'strong text': "выделенный текст",
9 | 'Italic': "Курсив",
10 | 'emphasized text': "наклонный текст",
11 | 'Heading': "Заголовок",
12 | 'heading text': "текст заголовка",
13 | 'URL/Link': "Вставьте ссылку",
14 | 'Insert Hyperlink': "Введите гиперссылку",
15 | 'enter link description here': "введите описание ссылки",
16 | 'Image': "Изображение",
17 | 'enter image description here': "Введите описание изображения",
18 | 'Insert Image Hyperlink': "Вставьте ссылку на изображение",
19 | 'enter image title here': "Введите название изображения",
20 | 'List': "Список",
21 | 'Unordered List': "Неупорядоченный список",
22 | 'Ordered List': "Упорядоченный список",
23 | 'list text here': "текст списка",
24 | 'Code': "Код",
25 | 'code text here': "программный код",
26 | 'Quote': "Цитата",
27 | 'quote here': "цитируемый текст",
28 | 'Save': "Сохранить",
29 | 'Preview': "Предпросмотр"
30 | };
31 | }(jQuery));
32 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.sl.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Slovenian translation for bootstrap-markdown
3 | * Davor Padovan
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.sl = {
7 | 'Bold': "Odebeljeno",
8 | 'Italic': "Poševno",
9 | 'Heading': "Naslov",
10 | 'URL/Link': "Povezava",
11 | 'Image': "Slika",
12 | 'Unordered List': "Neurejen seznam",
13 | 'Ordered List': "Urejen seznam",
14 | 'Code': "Koda",
15 | 'Quote': "Citat",
16 | 'Preview': "Predogled",
17 | 'strong text': "odebeljeno besedilo",
18 | 'emphasized text': "poševno besedilo",
19 | 'heading text': "naslov",
20 | 'enter link description here': "opis povezave",
21 | 'Insert Hyperlink': "Vstavi povezavo",
22 | 'enter image description here': "opis slike",
23 | 'Insert Image Hyperlink': "Vstavi povezavo do slike",
24 | 'enter image title here': "naslov slike",
25 | 'list text here': "seznam"
26 | };
27 | }(jQuery));
28 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.sv.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Swedish translation for bootstrap-markdown
3 | * Tobias Bohwalli
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.sv = {
7 | 'Bold': 'Fet',
8 | 'Italic': 'Kursiv',
9 | 'Heading': 'Rubrik',
10 | 'URL/Link': 'URL/Länk',
11 | 'Image': 'Bild',
12 | 'List': 'Lista',
13 | 'Preview': 'Förhandsgranska',
14 | 'strong text': 'fet text',
15 | 'emphasized text': 'överstruken text',
16 | 'heading text': 'Rubrik',
17 | 'enter link description here': 'Ange länk beskrivning här',
18 | 'Insert Hyperlink': 'Sätt in länk',
19 | 'enter image description here': 'Ange bild beskrivning här',
20 | 'Insert Image Hyperlink': 'Sätt in länk för bild',
21 | 'enter image title here': 'Ange bild rubrik här',
22 | 'list text here': 'list text'
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.tr.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Turkish translation for bootstrap-markdown
3 | * Serkan Algur
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.tr = {
7 | 'Bold': "Kalın",
8 | 'Italic': "İtalik",
9 | 'Heading': "Başlık",
10 | 'URL/Link': "Link ekle",
11 | 'Image': "Resim ekle",
12 | 'List': "Liste Oluşturun",
13 | 'Preview': "Önizleme",
14 | 'strong text': "kalın yazı",
15 | 'emphasized text': "italik yazı",
16 | 'heading text': "Başlık Yazısı",
17 | 'enter link description here': "Link açıklamasını buraya girin",
18 | 'Insert Hyperlink': "İnternet adresi girin",
19 | 'enter image description here': "resim açıklamasını buraya ekleyin",
20 | 'Insert Image Hyperlink': "Resim linkini ekleyin",
21 | 'enter image title here': "resim başlığını buraya ekleyin",
22 | 'list text here': "liste yazısı",
23 | 'Save' : "Kaydet",
24 | 'Ordered List' : "Numaralı Liste",
25 | 'Unordered List' : "Madde imli liste",
26 | 'Quote' : "Alıntı",
27 | 'quote here' : "alıntıyı buraya ekleyin",
28 | 'Code' : "Kod",
29 | 'code text here' : "kodu buraya ekleyin"
30 | };
31 | }(jQuery));
32 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.ua.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Ukrainian translation for bootstrap-markdown
3 | * by Oleg Vivtash
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.ua = {
7 | 'Bold': "Жирний",
8 | 'Italic': "Курсів",
9 | 'Heading': "Заголовок",
10 | 'URL/Link': "Вставте посилання",
11 | 'Image': "Зображення",
12 | 'List': "Список",
13 | 'Preview': "Попередній перегляд",
14 | 'strong text': "виділений текст",
15 | 'emphasized text': "нахилений текст",
16 | 'heading text': "текст заголовку",
17 | 'enter link description here': "введіть опис посилання",
18 | 'Insert Hyperlink': "Введіть гіперпосилання",
19 | 'enter image description here': "Введіть опис зображення",
20 | 'Insert Image Hyperlink': "Вставте посилання на зображення",
21 | 'enter image title here': "Введіть назву зображення",
22 | 'list text here': "текст списку"
23 | };
24 | }(jQuery));
25 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.zh-tw.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Traditional Chinese translation for bootstrap-markdown
3 | * TheoKlein
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.zh = {
7 | 'Bold': "粗體",
8 | 'Italic': "斜體",
9 | 'Heading': "標題",
10 | 'URL/Link': "超連結",
11 | 'Image': "圖片",
12 | 'List': "列表",
13 | 'Unordered List': "無序列表",
14 | 'Ordered List': "有序列表",
15 | 'Code': "程式碼",
16 | 'Quote': "引用",
17 | 'Preview': "預覽",
18 | 'strong text': "粗體",
19 | 'emphasized text': "強調",
20 | 'heading text': "標題",
21 | 'enter link description here': "輸入超連結說明",
22 | 'Insert Hyperlink': "超連結網址",
23 | 'enter image description here': "輸入圖片說明",
24 | 'Insert Image Hyperlink': "圖片網址",
25 | 'enter image title here': "輸入圖片標題",
26 | 'list text here': "在這裡輸入列表文字",
27 | 'code text here': "在這裡輸入程式碼",
28 | 'quote here': "在這裡輸入引用"
29 | };
30 | }(jQuery));
31 |
--------------------------------------------------------------------------------
/locale/bootstrap-markdown.zh.js:
--------------------------------------------------------------------------------
1 | /**
2 | * Chinese translation for bootstrap-markdown
3 | * benhaile
4 | */
5 | (function ($) {
6 | $.fn.markdown.messages.zh = {
7 | 'Bold': "粗体",
8 | 'Italic': "斜体",
9 | 'Heading': "标题",
10 | 'URL/Link': "链接",
11 | 'Image': "图片",
12 | 'List': "列表",
13 | 'Unordered List': "无序列表",
14 | 'Ordered List': "有序列表",
15 | 'Code': "代码",
16 | 'Quote': "引用",
17 | 'Preview': "预览",
18 | 'strong text': "粗体",
19 | 'emphasized text': "强调",
20 | 'heading text': "标题",
21 | 'enter link description here': "输入链接说明",
22 | 'Insert Hyperlink': "URL地址",
23 | 'enter image description here': "输入图片说明",
24 | 'Insert Image Hyperlink': "图片URL地址",
25 | 'enter image title here': "在这里输入图片标题",
26 | 'list text here': "这里是列表文本",
27 | 'code text here': "这里输入代码",
28 | 'quote here': "这里输入引用文本"
29 | };
30 | }(jQuery));
31 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "bootstrap-markdown",
3 | "main": "js/bootstrap-markdown.js",
4 | "version": "2.10.0",
5 | "description": "A bootstrap plugin for markdown editing",
6 | "license" : "Apache-2.0",
7 | "homepage": "https://github.com/toopay/bootstrap-markdown",
8 | "keywords": [
9 | "twitter",
10 | "bootstrap",
11 | "markdown",
12 | "editor"
13 | ],
14 | "maintainers": [{
15 | "name": "Taufan Aditya",
16 | "web": "https://github.com/toopay"
17 | }],
18 | "repository": {
19 | "type": "git",
20 | "url": "https://github.com/toopay/bootstrap-markdown.git"
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/scss/bootstrap-markdown.scss:
--------------------------------------------------------------------------------
1 | /**
2 | * Bootstrap-Markdown.less
3 | *
4 | * @author Taufan Aditya @taufanaditya
5 | * @copyright 2013-2016 Taufan Aditya
6 | */
7 |
8 | $table-border-color: #ddd;
9 | $panel-default-heading-bg: #f5f5f5;
10 | $panel-bg: #fff;
11 | $font-family-monospace: Menlo, Monaco, Consolas, "Courier New", monospace;
12 | $font-size-base: 14px;
13 | $input-bg-disabled: #eeeeee;
14 | $input-bg: #fff;
15 | $input-border-focus: #66afe9;
16 |
17 | .md-editor {
18 | display: block;
19 | border: 1px solid $table-border-color;
20 |
21 | > .md-header, .md-footer {
22 | display: block;
23 | padding: 6px 4px;
24 | background: $panel-default-heading-bg;
25 | }
26 |
27 | > .md-header {
28 | margin: 0;
29 | }
30 |
31 | > .md-preview {
32 | background: $panel-bg;
33 | border-top: 1px dashed $table-border-color;
34 | border-bottom: 1px dashed $table-border-color;
35 | min-height: 10px;
36 | overflow: auto;
37 | }
38 |
39 | > textarea {
40 | font-family: $font-family-monospace;
41 | font-size: $font-size-base;
42 | outline: 0;
43 | outline: thin dotted \9; /* IE6-9 */
44 | margin: 0;
45 | display: block;
46 | padding: 0;
47 | width: 100%;
48 | border: 0;
49 | border-top: 1px dashed $table-border-color;
50 | border-bottom: 1px dashed $table-border-color;
51 | border-radius: 0;
52 | box-shadow: none;
53 | background: $input-bg-disabled;
54 | &:focus {
55 | box-shadow: none;
56 | background: $input-bg;
57 | }
58 | }
59 |
60 | // Hover state
61 | $color: $input-border-focus;
62 | $color-rgba: rgba(red($color), green($color), blue($color), .6);
63 | &.active {
64 | border-color: $color;
65 | outline: 0;
66 | @include box-shadow(inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px $color-rgba);
67 | }
68 |
69 | .md-controls {
70 | float: right;
71 | padding: 3px;
72 |
73 | .md-control {
74 | right: 5px;
75 | color: #bebebe;
76 | padding: 3px 3px 3px 10px;
77 | &:hover {
78 | color: #333;
79 | }
80 | }
81 | }
82 |
83 | // fullscreen mode styles
84 | &.md-fullscreen-mode {
85 | width: 100%;
86 | height: 100%;
87 | position: fixed;
88 | top: 0;
89 | left: 0;
90 | z-index: 99999;
91 | padding: 60px 30px 15px;
92 | background: #fff !important;
93 | border: 0 !important;
94 |
95 | .md-footer {
96 | display: none;
97 | }
98 |
99 | .md-input,
100 | .md-preview {
101 | margin: 0 auto !important;
102 | height: 100% !important;
103 | font-size: 20px !important;
104 | padding: 20px !important;
105 | color: #999;
106 | line-height: 1.6em !important;
107 | resize: none !important;
108 | box-shadow: none !important;
109 | background: #fff !important;
110 | border: 0 !important;
111 | }
112 |
113 | .md-preview {
114 | color: #333;
115 | overflow: auto;
116 | }
117 |
118 | .md-input {
119 | &:hover,
120 | &:focus {
121 | color: #333;
122 | background: #fff !important;
123 | }
124 | }
125 |
126 | .md-header {
127 | background: none;
128 | text-align: center;
129 | position: fixed;
130 | width: 100%;
131 | top: 20px;
132 | }
133 |
134 | .btn-group {
135 | float: none;
136 | }
137 |
138 | .btn {
139 | border: 0;
140 | background: none;
141 | color: #b3b3b3;
142 |
143 | &:hover,
144 | &:focus,
145 | &.active,
146 | &:active {
147 | box-shadow: none;
148 | color: #333;
149 | }
150 | }
151 |
152 | .md-fullscreen-controls {
153 | position: absolute;
154 | top: 20px;
155 | right: 20px;
156 | text-align: right;
157 | z-index: 1002;
158 | display: block;
159 | a {
160 | color: #b3b3b3;
161 | clear: right;
162 | margin: 10px;
163 | width: 30px;
164 | height: 30px;
165 | text-align: center;
166 |
167 | &:hover {
168 | color: #333;
169 | text-decoration: none;
170 | }
171 | }
172 | }
173 |
174 | .md-editor {
175 | height: 100% !important;
176 | position: relative;
177 | }
178 | }
179 |
180 | .md-fullscreen-controls {
181 | display: none;
182 | }
183 | }
184 |
185 | .md-nooverflow {
186 | overflow: hidden;
187 | position: fixed;
188 | width: 100%;
189 | }
190 |
--------------------------------------------------------------------------------