Skip to content

Commit 9a69636

Browse files
committed
added bootstrap template
1 parent 54aed6d commit 9a69636

File tree

16 files changed

+526
-6
lines changed

16 files changed

+526
-6
lines changed

martor/settings.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
from django.conf import settings
22

3+
MARTOR_THEME = getattr(settings, 'MARTOR_THEME', 'bootstrap')
4+
35
# Global martor settings
46
# Input: string boolean, `true/false`
57
MARTOR_ENABLE_CONFIGS = getattr(
68
settings, 'MARTOR_ENABLE_CONFIGS', {
9+
'theme': 'bootstrap', # to select theme
710
'emoji': 'true', # to enable/disable emoji icons.
811
'imgur': 'true', # to enable/disable imgur/custom uploader.
912
'mention': 'false', # to enable/disable mention
1013
'jquery': 'true', # to include/revoke jquery (require for admin default django)
1114
'living': 'false', # to enable/disable live updates in preview
1215
'spellcheck': 'false', # to enable/disable spellcheck in form textareas
1316
'hljs': 'true', # to enable/disable hljs highlighting in preview
14-
'semantic': 'true', # to enable/disable using packaged semantic version
1517
}
1618
)
1719

@@ -91,10 +93,13 @@
9193
MARTOR_MARKDOWN_BASE_EMOJI_URL = getattr(
9294
settings, 'MARTOR_MARKDOWN_BASE_EMOJI_URL', 'https://github.githubassets.com/images/icons/emoji/'
9395
)
96+
9497
# to use static and keep backward compatibility
9598
# set to true if using bucket like storage engine
9699
MARTOR_MARKDOWN_BASE_EMOJI_USE_STATIC = getattr(
97-
settings, 'MARTOR_MARKDOWN_BASE_EMOJI_USE_STATIC', False)
100+
settings, 'MARTOR_MARKDOWN_BASE_EMOJI_USE_STATIC', False
101+
)
102+
98103
MARTOR_MARKDOWN_BASE_MENTION_URL = getattr(
99104
settings, 'MARTOR_MARKDOWN_BASE_MENTION_URL', 'https://python.web.id/author/'
100105
)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
body.overflow {
2+
overflow: hidden!important;
3+
}
4+
5+
.main-martor .modal-header {
6+
padding: 10px 1rem;
7+
}
8+
.main-martor .modal-header h5 {
9+
font-size: 16px;
10+
}
11+
12+
.martor-toolbar {
13+
position: absolute;
14+
right: 0;
15+
top: 0;
16+
}
17+
18+
.table.markdown-reference {
19+
font-size: 12px;
20+
}
21+
.table.markdown-reference h1 {
22+
font-size: 2em;
23+
}
24+
.table.markdown-reference h2 {
25+
font-size: 1.5em;
26+
}
27+
.table.markdown-reference ul,
28+
.table.markdown-reference ol {
29+
padding-left: 1rem!important;
30+
}

martor/static/martor/js/martor.bootstrap.js

Whitespace-only changes.

martor/static/plugins/css/bootstrap.min.css

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/plugins/js/bootstrap.min.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/plugins/js/jquery.min.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

martor/static/plugins/js/jquery.slim.min.js

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

martor/static/plugins/js/popper.min.js

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{% load i18n %}
2+
3+
4+
<div class="main-martor main-martor-{{ field_name }}" data-field-name="{{ field_name }}">
5+
<nav style="position:relative">
6+
<div class="nav nav-tabs" id="nav-tab" role="tablist">
7+
<a class="nav-link active" id="nav-editor-tab" data-toggle="tab" href="#nav-editor" role="tab" aria-controls="nav-editor" aria-selected="true">
8+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-pencil-square" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
9+
<path d="M15.502 1.94a.5.5 0 0 1 0 .706L14.459 3.69l-2-2L13.502.646a.5.5 0 0 1 .707 0l1.293 1.293zm-1.75 2.456l-2-2L4.939 9.21a.5.5 0 0 0-.121.196l-.805 2.414a.25.25 0 0 0 .316.316l2.414-.805a.5.5 0 0 0 .196-.12l6.813-6.814z"/>
10+
<path fill-rule="evenodd" d="M1 13.5A1.5 1.5 0 0 0 2.5 15h11a1.5 1.5 0 0 0 1.5-1.5v-6a.5.5 0 0 0-1 0v6a.5.5 0 0 1-.5.5h-11a.5.5 0 0 1-.5-.5v-11a.5.5 0 0 1 .5-.5H9a.5.5 0 0 0 0-1H2.5A1.5 1.5 0 0 0 1 2.5v11z"/>
11+
</svg>
12+
<span>{% trans "Editor" %}</span>
13+
</a>
14+
<a class="nav-link" id="nav-preview-tab" data-toggle="tab" href="#nav-preview" role="tab" aria-controls="nav-preview" aria-selected="false">
15+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-eye-fill" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
16+
<path d="M10.5 8a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0z"/>
17+
<path fill-rule="evenodd" d="M0 8s3-5.5 8-5.5S16 8 16 8s-3 5.5-8 5.5S0 8 0 8zm8 3.5a3.5 3.5 0 1 0 0-7 3.5 3.5 0 0 0 0 7z"/>
18+
</svg>
19+
<span>{% trans "Preview" %}</span>
20+
</a>
21+
22+
{% include "martor/bootstrap/toolbar.html" %}
23+
</div>
24+
</nav>
25+
26+
<div class="tab-content" id="nav-tabContent">
27+
<div class="tab-pane fade show active" id="nav-editor" role="tabpanel" aria-labelledby="nav-editor-tab">...</div>
28+
<div class="tab-pane fade" id="nav-preview" role="tabpanel" aria-labelledby="nav-preview-tab">...</div>
29+
</div>
30+
31+
{% include 'martor/bootstrap/guide.html' %}
32+
{% include 'martor/bootstrap/emoji.html' %}
33+
</div>
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{% load i18n %}
2+
3+
<div class="modal fade modal-emoji" id="modalInsertEmoji" tabindex="-1" aria-labelledby="modalInsertEmojiTitle" aria-hidden="true">
4+
<div class="modal-dialog modal-lg modal-dialog-scrollable">
5+
<div class="modal-content emoji-content-base">
6+
<div class="modal-header">
7+
<h5 class="modal-title" id="modalInsertEmojiTitle">
8+
<svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-info-circle" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
9+
<path fill-rule="evenodd" d="M8 15A7 7 0 1 0 8 1a7 7 0 0 0 0 14zm0 1A8 8 0 1 0 8 0a8 8 0 0 0 0 16z"/>
10+
<path d="M8.93 6.588l-2.29.287-.082.38.45.083c.294.07.352.176.288.469l-.738 3.468c-.194.897.105 1.319.808 1.319.545 0 1.178-.252 1.465-.598l.088-.416c-.2.176-.492.246-.686.246-.275 0-.375-.193-.304-.533L8.93 6.588z"/>
11+
<circle cx="8" cy="4.5" r="1"/>
12+
</svg>
13+
<span>{% trans "Select Emoji to Insert" %}</span>
14+
</h5>
15+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
16+
<span aria-hidden="true">&times;</span>
17+
</button>
18+
</div>
19+
<div class="modal-body emoji-content-body">
20+
<div class="text-center emoji-loader-init">
21+
<div class="spinner-border" role="status">
22+
<span class="sr-only">Loading...</span>
23+
</div>
24+
<div>{% trans "Preparing emojis..." %}</div>
25+
</div>
26+
</div>
27+
</div>
28+
</div>
29+
</div>

0 commit comments

Comments
 (0)