Skip to content

Commit edfab7b

Browse files
author
Dennis Suitters
authored
Merge pull request #57 from DiemenDesign/master
Add Documentation for using Markup Elements and Classes in Modals for Plugins.
2 parents 0f025aa + 8c48894 commit edfab7b

File tree

1 file changed

+65
-8
lines changed

1 file changed

+65
-8
lines changed

03-plugins.md

Lines changed: 65 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ Most scripts are added in the head area of the typical HTML page.
2828
<head>
2929
<!-- include libraries(jQuery, bootstrap) -->
3030
<link href="{{ site.bootstrap_css }}" rel="stylesheet">
31-
<script src="{{ site.jquery_js }}"></script>
32-
<script src="{{ site.bootstrap_js }}"></script>
31+
<script src="{{ site.jquery_js }}"></script>
32+
<script src="{{ site.bootstrap_js }}"></script>
3333

3434
<!-- include summernote css/js -->
3535
<link href="{{ site.summernote_css }}" rel="stylesheet">
3636
<script src="{{ site.summernote_js }}"></script>
37-
37+
3838
<!-- include plugin -->
3939
<script src="[folder where script is located]/[plugin script].js"></script>
4040
</head>
@@ -89,11 +89,11 @@ For those uninitiated with script styling, we'd like to point out that comments
8989

9090
{% highlight javascript %}
9191
/**
92-
*
92+
*
9393
* copyright [year] [your Business Name and/or Your Name].
9494
9595
* license: Your chosen license, or link to a license file.
96-
*
96+
*
9797
*/
9898
(function (factory) {
9999
/* Global define */
@@ -171,10 +171,10 @@ The vars below are not all needed, what you need depends on what your trying acc
171171
$editor = context.layoutInfo.editor,
172172
$editable = context.layoutInfo.editable,
173173
$toolbar = context.layoutInfo.toolbar,
174-
174+
175175
// options holds the Options Information from Summernote and what we extended above.
176176
options = context.options,
177-
177+
178178
// lang holds the Language Information from Summernote and what we extended above.
179179
lang = options.langInfo;
180180

@@ -213,7 +213,11 @@ This section performs functions when the Plugin is first initialised. Note, this
213213
// Build the Body HTML of the Dialog.
214214
var body = '<div class="form-group">' +
215215
'</div>';
216+
{% endhighlight %}
216217

218+
See the section "Modal Markup" for element markup options inside Modals.
219+
220+
{% highlight javascript %}
217221
// Build the Footer HTML of the Dialog.
218222
var footer = '<button href="#" class="btn btn-primary note-examplePlugin-btn">' + lang.examplePlugin.okButton + '</button>'
219223
}
@@ -228,7 +232,7 @@ This section performs functions when the Plugin is first initialised. Note, this
228232

229233
// Set the Footer of the Dialog.
230234
footer: footer
231-
235+
232236
// This adds the Modal to the DOM.
233237
}).render().appendTo($container);
234238
};
@@ -281,3 +285,56 @@ This section performs functions when the Plugin is first initialised. Note, this
281285
}
282286
})));
283287
{% endhighlight %}
288+
289+
### Modal Markup
290+
This section explains and shows example of the elements and classes that can be used inside Modals.
291+
292+
Note: You can mix the classes from BS3, BS4 (which are similar) and Lite versions so plugins can be version controlled to Bootstrap or not be Bootstrap specific, or they can be made compatible to work with all (the preferred method).
293+
294+
The main problem with using markup elements in Summernote Modals becomes evident when trying to work with elements so they are compatible with all versions of Bootstrap or the Lite version of Summernote. To try and aleviate this, there is a settings variable that can be checked `interface`, checking this setting within the plugin will return `BS3`, `BS4` or `Lite` which will allow adding logic control to determine which markup or behaviour the plugin needs use for compatibility, or you can just use a standard layout for the elements and add the appropriate classes to cover all versions (preferred).
295+
296+
Generally, the elements and classes for the version of Bootstrap you want to make a plugin for can use that version of Bootstraps elements, and we have tried, even with the Lite version to keep those as close as we can.
297+
298+
We've included some examples below to facilitate constructing Modals a bit quicker for you.
299+
300+
Any classes with `note-` at their start are primarily the Summernote classes to minimise interfering with other DOM classes that you may be using for other purposes, however, most of the modals use the Bootstrap classes as their primary styling, except for in the Lite version of Summernote, it relies on the `note-*` classes to style elements.
301+
302+
#### Form Layout
303+
{% highlight javascript %}
304+
var body = '<div class="form-group note-form-group">' +
305+
'<div class="help-block note-help-block">Helpful text block</div>' +
306+
'</div>' +
307+
'<div class="form-group note-form-group">' +
308+
'<label for="note-input-1" class="control-label note-form-label">Input Label 1</label>' +
309+
'<div class="input-group note-input-group">' +
310+
'<input type="text" id="note-input-1" class="form-contro note-input">' +
311+
'</div>' +
312+
'</div>';
313+
{% endhighlight %}
314+
315+
#### Tabbed Panes Layout
316+
{% highlight javascript %}
317+
var body = '<ul class="nav note-nav nav-tabs note-nav-tabs">' +
318+
'<li class="nav-item note-nav-item active">' +
319+
'<a class="nav-link note-nav-link active" href="#note-pane-1" data-toggle="tab">Pane 1</a>' +
320+
'</li>' +
321+
'<li class="nav-item note-nav-item active">' +
322+
'<a class="nav-link note-nav-link active" href="#note-pane-2" data-toggle="tab">Pane 2</a>' +
323+
'</li>' +
324+
'<li class="nav-item note-nav-item active">' +
325+
'<a class="nav-link note-nav-link active" href="#note-pane-3" data-toggle="tab">Pane 3</a>' +
326+
'</li>' +
327+
'</ul>' +
328+
329+
// Pane 2
330+
'<div class="tab-content note-tabe-content" id="note-pane-2">' +
331+
'</div>';
332+
333+
// Pane 3
334+
'<div class="tab-content note-tabe-content" id="note-pane-3">' +
335+
'</div>';
336+
337+
// Pane 1, is added last due to how the Styling works to make this Panel active and visible.
338+
'<div class="tab-content note-tabe-content active" id="note-pane-1">' +
339+
'</div>';
340+
{% endhighlight %}

0 commit comments

Comments
 (0)