punkweb-bb 0.2.3__py3-none-any.whl → 0.4.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- punkweb_bb/__pycache__/admin.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/admin_forms.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/bbcode.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/forms.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/middleware.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/mixins.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/models.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/pagination.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/parsers.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/response.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/settings.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/signals.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/tags.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/tests.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/urls.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/utils.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/views.cpython-311.pyc +0 -0
- punkweb_bb/__pycache__/widgets.cpython-311.pyc +0 -0
- punkweb_bb/admin.py +0 -5
- punkweb_bb/admin_forms.py +6 -5
- punkweb_bb/bbcode.py +155 -0
- punkweb_bb/forms.py +13 -5
- punkweb_bb/migrations/0005_alter_thread_options.py +24 -0
- punkweb_bb/migrations/0006_remove_boardprofile__signature_rendered_and_more.py +60 -0
- punkweb_bb/migrations/__pycache__/0005_alter_thread_options.cpython-311.pyc +0 -0
- punkweb_bb/migrations/__pycache__/0006_remove_boardprofile__signature_rendered_and_more.cpython-311.pyc +0 -0
- punkweb_bb/models.py +6 -6
- punkweb_bb/settings.py +1 -0
- punkweb_bb/static/punkweb_bb/css/defaults.css +2 -2
- punkweb_bb/static/punkweb_bb/css/punkweb-modal.css +2 -0
- punkweb_bb/static/punkweb_bb/css/punkweb.css +2 -2
- punkweb_bb/static/punkweb_bb/css/subcategory.css +4 -0
- punkweb_bb/static/punkweb_bb/css/thread.css +24 -0
- punkweb_bb/static/punkweb_bb/editor/bbcode-editor-content.css +4 -5
- punkweb_bb/static/punkweb_bb/editor/bbcode-editor.js +0 -5
- punkweb_bb/static/punkweb_bb/editor/markdown-editor.js +49 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.eslintrc.json +15 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.gitignore +108 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/.prettierrc.json +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/LICENSE +21 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/README.md +240 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/babel.config.json +14 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/blank.html +18 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/demo.html +126 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.css +231 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.js +3086 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.min.css +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.min.js +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/dist/tiny-mde.tiny.js +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/_config.yml +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/_layouts/default.html +50 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/docs/index.md +174 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/globals.d.ts +172 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/gulpfile.mjs +226 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/block.test.js +696 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/commandbar.test.js +84 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/inline.test.js +486 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/interaction.test.js +31 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/setup.test.js +164 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/config.js +2 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/server.js +9 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/setup.js +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest/util/test-helpers.js +98 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest-puppeteer.config.js +8 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/jest.config.js +13 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/package-lock.json +16295 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/package.json +72 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/TinyMDE.js +1926 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/TinyMDECommandBar.js +256 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/commandbar.css +72 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/editor.css +157 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/css/index.css +3 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/grammar.js +300 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/html/blank.html +18 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/html/demo.html +126 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/index.js +4 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/blockquote.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/bold.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/clear_formatting.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/code.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/h1.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/h2.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/hr.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/image.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/italic.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/link.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/ol.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/strikethrough.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/svg.js +17 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/svg/ul.svg +1 -0
- punkweb_bb/static/punkweb_bb/vendor/tiny-markdown-editor/src/tiny.js +3 -0
- punkweb_bb/templates/punkweb_bb/base_delete_modal.html +13 -0
- punkweb_bb/templates/punkweb_bb/bbcode.html +2 -3
- punkweb_bb/templates/punkweb_bb/index.html +2 -2
- punkweb_bb/templates/punkweb_bb/partials/category_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/post_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/shout_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/subcategory_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/thread_delete.html +4 -8
- punkweb_bb/templates/punkweb_bb/partials/thread_move.html +24 -0
- punkweb_bb/templates/punkweb_bb/profile.html +2 -2
- punkweb_bb/templates/punkweb_bb/shoutbox/shout_list.html +2 -2
- punkweb_bb/templates/punkweb_bb/subcategory.html +1 -1
- punkweb_bb/templates/punkweb_bb/thread.html +24 -14
- punkweb_bb/templates/punkweb_bb/widgets/markdown-editor.html +4 -0
- punkweb_bb/templatetags/__pycache__/markdown.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/render.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/shoutbox_bbcode.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/__pycache__/shoutbox_render.cpython-311.pyc +0 -0
- punkweb_bb/templatetags/render.py +35 -0
- punkweb_bb/tests.py +3 -3
- punkweb_bb/urls.py +1 -0
- punkweb_bb/utils.py +24 -10
- punkweb_bb/views.py +45 -23
- punkweb_bb/widgets.py +20 -0
- {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/METADATA +58 -51
- {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/RECORD +120 -53
- punkweb_bb/bbcode_tags.py +0 -167
- punkweb_bb/parsers.py +0 -70
- punkweb_bb/templatetags/shoutbox_bbcode.py +0 -14
- {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/LICENSE +0 -0
- {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/WHEEL +0 -0
- {punkweb_bb-0.2.3.dist-info → punkweb_bb-0.4.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"browser": true,
|
|
4
|
+
"es2020": true
|
|
5
|
+
},
|
|
6
|
+
"extends": ["eslint:recommended"],
|
|
7
|
+
"parserOptions": {
|
|
8
|
+
"ecmaVersion": 2019,
|
|
9
|
+
"sourceType": "module"
|
|
10
|
+
},
|
|
11
|
+
"ignorePatterns": ["gulpfile.js", "jest*.config.js", "jest/**/*.js", "node_modules/"],
|
|
12
|
+
"rules": {
|
|
13
|
+
"no-fallthrough": "off"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
# Logs
|
|
2
|
+
logs
|
|
3
|
+
*.log
|
|
4
|
+
npm-debug.log*
|
|
5
|
+
yarn-debug.log*
|
|
6
|
+
yarn-error.log*
|
|
7
|
+
lerna-debug.log*
|
|
8
|
+
|
|
9
|
+
# Diagnostic reports (https://nodejs.org/api/report.html)
|
|
10
|
+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
|
|
11
|
+
|
|
12
|
+
# Runtime data
|
|
13
|
+
pids
|
|
14
|
+
*.pid
|
|
15
|
+
*.seed
|
|
16
|
+
*.pid.lock
|
|
17
|
+
|
|
18
|
+
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
19
|
+
lib-cov
|
|
20
|
+
|
|
21
|
+
# Coverage directory used by tools like istanbul
|
|
22
|
+
coverage
|
|
23
|
+
*.lcov
|
|
24
|
+
|
|
25
|
+
# nyc test coverage
|
|
26
|
+
.nyc_output
|
|
27
|
+
|
|
28
|
+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
29
|
+
.grunt
|
|
30
|
+
|
|
31
|
+
# Bower dependency directory (https://bower.io/)
|
|
32
|
+
bower_components
|
|
33
|
+
|
|
34
|
+
# node-waf configuration
|
|
35
|
+
.lock-wscript
|
|
36
|
+
|
|
37
|
+
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
38
|
+
build/Release
|
|
39
|
+
|
|
40
|
+
# Dependency directories
|
|
41
|
+
node_modules/
|
|
42
|
+
jspm_packages/
|
|
43
|
+
|
|
44
|
+
# TypeScript v1 declaration files
|
|
45
|
+
typings/
|
|
46
|
+
|
|
47
|
+
# TypeScript cache
|
|
48
|
+
*.tsbuildinfo
|
|
49
|
+
|
|
50
|
+
# Optional npm cache directory
|
|
51
|
+
.npm
|
|
52
|
+
|
|
53
|
+
# Optional eslint cache
|
|
54
|
+
.eslintcache
|
|
55
|
+
|
|
56
|
+
# Microbundle cache
|
|
57
|
+
.rpt2_cache/
|
|
58
|
+
.rts2_cache_cjs/
|
|
59
|
+
.rts2_cache_es/
|
|
60
|
+
.rts2_cache_umd/
|
|
61
|
+
|
|
62
|
+
# Optional REPL history
|
|
63
|
+
.node_repl_history
|
|
64
|
+
|
|
65
|
+
# Output of 'npm pack'
|
|
66
|
+
*.tgz
|
|
67
|
+
|
|
68
|
+
# Yarn Integrity file
|
|
69
|
+
.yarn-integrity
|
|
70
|
+
|
|
71
|
+
# dotenv environment variables file
|
|
72
|
+
.env
|
|
73
|
+
.env.test
|
|
74
|
+
|
|
75
|
+
# parcel-bundler cache (https://parceljs.org/)
|
|
76
|
+
.cache
|
|
77
|
+
|
|
78
|
+
# Next.js build output
|
|
79
|
+
.next
|
|
80
|
+
|
|
81
|
+
# Nuxt.js build / generate output
|
|
82
|
+
.nuxt
|
|
83
|
+
dist
|
|
84
|
+
|
|
85
|
+
# Gatsby files
|
|
86
|
+
.cache/
|
|
87
|
+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
|
|
88
|
+
# https://nextjs.org/blog/next-9-1#public-directory-support
|
|
89
|
+
# public
|
|
90
|
+
|
|
91
|
+
# vuepress build output
|
|
92
|
+
.vuepress/dist
|
|
93
|
+
|
|
94
|
+
# Serverless directories
|
|
95
|
+
.serverless/
|
|
96
|
+
|
|
97
|
+
# FuseBox cache
|
|
98
|
+
.fusebox/
|
|
99
|
+
|
|
100
|
+
# DynamoDB Local files
|
|
101
|
+
.dynamodb/
|
|
102
|
+
|
|
103
|
+
# TernJS port file
|
|
104
|
+
.tern-port
|
|
105
|
+
|
|
106
|
+
.DS_Store
|
|
107
|
+
|
|
108
|
+
lib
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Jens-Fabian Goetzmann
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
# tiny-markdown-editor
|
|
2
|
+
|
|
3
|
+
TinyMDE: A tiny, low-dependency<sup>(1)</sup> embeddable HTML/JavaScript Markdown editor.
|
|
4
|
+
|
|
5
|
+
<sup>(1)</sup>: TinyMDE's runtime only depends on `core-js` for polyfills to support older browsers.
|
|
6
|
+
|
|
7
|
+
Visit the [demo page](https://jefago.github.io/tiny-markdown-editor/) to see TinyMDE in action.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
TinyMDE is an in-browser markdown editor that allows editing Markdown files with in-line formatting previews (bold, italic, headings, code etc.) as well as a toolbar with familiar point-and-click or keyboard shortcut interaction.
|
|
12
|
+
|
|
13
|
+
TinyMDE can be used as a drop-in text area replacement.
|
|
14
|
+
|
|
15
|
+
## Motivation
|
|
16
|
+
|
|
17
|
+
TinyMDE was motivated by wanting to improve on [EasyMDE](https://github.com/Ionaru/easy-markdown-editor) which is extremely flexible but had two shortcomings:
|
|
18
|
+
|
|
19
|
+
- EasyMDE depends on [Code Mirror](https://codemirror.net/) for editing and formatting. CodeMirror is a full fledged and customizable in-browser code editor, and has a price: EasyMDE's JS file is 280kb in size. TinyMDE is less than 70kb (less than a quarter of EasyMDE's size), the "tiny" version without the toolbar even below 60kb!
|
|
20
|
+
- CodeMirror doesn't work well on mobile, at least not for writing prose: mobile phone OS auto-correction functionality, which many people rely on to quickly type on mobile, is not supported by CodeMirror.
|
|
21
|
+
|
|
22
|
+
## Install TinyMDE
|
|
23
|
+
|
|
24
|
+
You can install TinyMDE from NPM (e.g., if you want to use it in a bundled JS application using Webpack or Rollup), use a hosted version, or self-host the JavaScript and CSS files.
|
|
25
|
+
|
|
26
|
+
### Install TinyMDE from NPM
|
|
27
|
+
|
|
28
|
+
Install the `tiny-markdown-editor` package from NPM:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --save tiny-markdown-editor
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Then, in your JavaScript file, simply import the package like this:
|
|
35
|
+
|
|
36
|
+
```JavaScript
|
|
37
|
+
const TinyMDE = require('tiny-markdown-editor');
|
|
38
|
+
var tinyMDE = new TinyMDE.Editor({element: 'editor'});
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Bundle the JavaScript with your favorite bundler like Webpack or Rollup to ensure the TinyMDE code gets included in the shipped JavaScript file.
|
|
42
|
+
|
|
43
|
+
**Please note:** If you go down the NPM package route, you will also need to make sure to [style the components](#styling-tinymde). After installing TinyMDE from NPM, you will find a CSS file `tiny-mde.css` you can use as a base in the directory `node_modules/tiny-markdown-editor/dist`.
|
|
44
|
+
|
|
45
|
+
### Hosted version
|
|
46
|
+
|
|
47
|
+
You can simply include the JavaScript and CSS files from Unpkg on your website, using the following code:
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<script src="https://unpkg.com/tiny-markdown-editor/dist/tiny-mde.min.js"></script>
|
|
51
|
+
<link
|
|
52
|
+
rel="stylesheet"
|
|
53
|
+
type="text/css"
|
|
54
|
+
href="https://unpkg.com/tiny-markdown-editor/dist/tiny-mde.min.css"
|
|
55
|
+
/>
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Self-host
|
|
59
|
+
|
|
60
|
+
To self-host TinyMDE, follow these steps:
|
|
61
|
+
|
|
62
|
+
- [Download and build TinyMDE](#build-tinymde). Alternatively, download the newest [release](https://github.com/jefago/tiny-markdown-editor/releases) and unpack the archive.
|
|
63
|
+
- Copy the output JS and CSS files `tiny-mde.min.js` and `tiny-mde.min.css` from the `dist` directory to your website's directory.
|
|
64
|
+
- Include these files on your website:
|
|
65
|
+
```html
|
|
66
|
+
<script src="tiny-mde.min.js"></script>
|
|
67
|
+
<link rel="stylesheet" type="text/css" href="tiny-mde.min.css" />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Creating an editor and toolbar on your page
|
|
71
|
+
|
|
72
|
+
### Simple creation
|
|
73
|
+
|
|
74
|
+
To create a simple editor as child of an HTML `div` element with the ID `editor`, use the following HTML / JS code:
|
|
75
|
+
|
|
76
|
+
```html
|
|
77
|
+
<div id="editor"></div>
|
|
78
|
+
<script type="text/javascript">
|
|
79
|
+
var tinyMDE = new TinyMDE.Editor({ element: "editor" });
|
|
80
|
+
</script>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Command bar creation
|
|
84
|
+
|
|
85
|
+
To create a toolbar (command bar) along with the editor, create another container div (here called `toolbar`), and instantiate editor and toolbar as follows:
|
|
86
|
+
|
|
87
|
+
```html
|
|
88
|
+
<div id="toolbar"></div>
|
|
89
|
+
<div id="editor"></div>
|
|
90
|
+
<script type="text/javascript">
|
|
91
|
+
var tinyMDE = new TinyMDE.Editor({ element: "editor" });
|
|
92
|
+
var commandBar = new TinyMDE.CommandBar({
|
|
93
|
+
element: "toolbar",
|
|
94
|
+
editor: tinyMDE,
|
|
95
|
+
});
|
|
96
|
+
</script>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Creation from a textarea
|
|
100
|
+
|
|
101
|
+
TinyMDE can be used as a drop-in textarea replacement. This means that when TinyMDE is passed a textarea, the editor will act as if the user is directly editing the textarea: The editor is initialized with the content of the textarea, and changing text in the editor changes the textarea's content. The easiest code to do so is as follows:
|
|
102
|
+
|
|
103
|
+
```html
|
|
104
|
+
<div class="txtcontainer">
|
|
105
|
+
<textarea id="txt">This is some **Markdown** formatted text</textarea>
|
|
106
|
+
</div>
|
|
107
|
+
<script type="text/javascript">
|
|
108
|
+
var tinyMDE = new TinyMDE.Editor({ textarea: "txt" });
|
|
109
|
+
</script>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Please note:
|
|
113
|
+
|
|
114
|
+
- The editor doesn't quite _replace_ the textarea. The textarea just gets hidden, and the editor content is mirrored in the textarea. If you programmatically change the contents of the textarea, the editor would get out of sync.
|
|
115
|
+
- The editor element will be inserted in the DOM as a sibling of the textarea element. In order to size and format the editor element properly, apply styles to the parent element of the textarea (in the example above, `div.txtcontainer`).
|
|
116
|
+
|
|
117
|
+
## Configure TinyMDE
|
|
118
|
+
|
|
119
|
+
### Editor constructor parameters
|
|
120
|
+
|
|
121
|
+
`TinyMDE.Editor` takes as argument a key-value object with the following possible attributes:
|
|
122
|
+
|
|
123
|
+
| Attribute | Description |
|
|
124
|
+
| ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
125
|
+
| `element` | The DOM element under which the TinyMDE DOM element will be created. The `element` attribute can be given as either an ID or the DOM element itself (i.e., the result of a call to `document.getElementById()`). |
|
|
126
|
+
| `content` | The initial content of the editor, given as a string. May contain newlines. |
|
|
127
|
+
| `textarea` | The textarea that will be linked to the editor. The textarea can be given as an ID or as the DOM element itself (i.e., the result of a call to `document.getElementById()`). The content of the editor will be reflected in the value of the textarea at any given point in time. If `textarea` is given and `content` isn't, then the editor content will be initialized to the textarea's value. If `textarea` is given and `element` isn't, then the editor element will be created as the next sibling of the textarea element. |
|
|
128
|
+
|
|
129
|
+
If neither `element` not `textarea` are given, the editor element will be created as the last child element of the `body` element (probably not what you want in most cases, so you probably want to pass at least one of `element` or `textarea`).
|
|
130
|
+
|
|
131
|
+
If neither `content` nor `textarea` are given, the content of the editor is initialized with a placeholder text (`# Hello TinyMDE!\nEdit **here**`). This is probably not what you want, so you probably want to pass at least one of `content` or `textarea`.
|
|
132
|
+
|
|
133
|
+
### CommandBar constructor parameters
|
|
134
|
+
|
|
135
|
+
`TinyMDE.Editor` takes as argument a key-value object with the following possible attributes:
|
|
136
|
+
|
|
137
|
+
| Attribute | Description |
|
|
138
|
+
| ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
139
|
+
| `element` | The DOM element under which the command bar DOM element will be created. The `element` attribute can be given as either an ID or the DOM element itself (i.e., the result of a call to `document.getElementById()`). If `element` is not given, the commandbar will be created as the last child of the `body` element (probably not what you want in most cases). |
|
|
140
|
+
| `editor` | The editor object that this command bar will be linked to (i.e., the return value of `new TinyMDE.Editor()`). |
|
|
141
|
+
| `commands` | The list of commands to show. See [below](#customizing-commands). |
|
|
142
|
+
|
|
143
|
+
### Customizing commands
|
|
144
|
+
|
|
145
|
+
In order to customize the commands shown on the command bar, pass an array to the `commands` attribute. Each of the entries of the array defines one command bar element (button or separator), left to right. Each of the entries of the `commands` array can be one of the following:
|
|
146
|
+
|
|
147
|
+
- A string with the content `|` (vertical pipe), which will create a separator line.
|
|
148
|
+
- A string with one of the command identifiers `bold`, `italic`, `strikethrough`, `code`, `h1`, `h2`, `ul`, `ol`, `blockquote`, `hr`, `insertLink`, or `insertImage`, which will create the default button for that command
|
|
149
|
+
- A key-value object to create a customized or custom button.
|
|
150
|
+
|
|
151
|
+
If an entry of the `commands` array is an object, you can either customize one of the existing commands (e.g., use a different icon or keyboard shortcut for the `bold` command), or use a completely custom command. An object entry of the `commands` array can contain the following attributes:
|
|
152
|
+
|
|
153
|
+
| Attribute | Description |
|
|
154
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
155
|
+
| `name` _mandatory_ | A string that is unique within the scope of this CommandBar instance that identifies the command. If one of the default commands (`bold`, `italic`, `strikethrough`, `code`, `h1`, `h2`, `ul`, `ol`, `blockquote`, `hr`, `insertLink`, or `insertImage`) is given as the `name` attribute, then the command is initialized with all the default values of the default commands and they can be overridden by specifying additional attributes. In other words, `{ name: 'bold' }` as a command array entry behaves the same as `'bold'`. If the `name` attribute is set to a string other than one of the default command, a custom command can be defined. |
|
|
156
|
+
| `title` | The title of the command, shown as a tooltip on hover. Defaults to be the same as `name`. |
|
|
157
|
+
| `innerHTML` | The HTML content of the command button. In the default styling, the content will have a space of 18x18 CSS pixels. |
|
|
158
|
+
| `action` | For custom commands, you need to set the `action` attribute to a function taking the Editor object as a parameter, for example: `action: editor => { editor.setContent('Test')}`. |
|
|
159
|
+
| `hotkey` | A keyboard shortcut for the command. The keyboard shortcut needs to be a string containing a key (e.g., 'A' or '1'), preceded by one or more modifier keys (`Ctrl`, `Shift`, `Alt`, `Cmd`, `Win`, `Option`), each separated with `-`. Examples: `Alt-I`, `Ctrl-Shift-3`. There are two convenience modifier keys that are recognized for easy cross-platform development: `Mod` is set to `Cmd` on macOS / iOS / iPadOS and `Ctrl` elsewhere (e.g., `Mod-B` as a shortcut for the `bold` command ends up as either `Ctrl` + `B` or `⌘` + `B`); `Mod2` is set to `Option` on macOS / iOS / iPadOS and `Alt` elsewhere. |
|
|
160
|
+
|
|
161
|
+
The default array of commands is as follows: `['bold', 'italic', 'strikethrough', '|', 'code', '|', 'h1', 'h2', '|', 'ul', 'ol', '|', 'blockquote', 'hr', '|', 'insertLink', 'insertImage']`.
|
|
162
|
+
|
|
163
|
+
### Editor methods
|
|
164
|
+
|
|
165
|
+
Here are some methods of the Editor object that might be useful in general interaction or custom CommandBar commands:
|
|
166
|
+
|
|
167
|
+
| Method | Description |
|
|
168
|
+
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
169
|
+
| `getContent()` | Returns the content of the editor as a string. |
|
|
170
|
+
| `setContent(content)` | Sets the content of the editor to the string `content`. |
|
|
171
|
+
| `getSelection(getAnchor)` | Gets the current selection / cursor position inside the editor. The parameter `getAnchor` (defaults to false) determines if the anchor (starting point) of the selection should be returned—if `getAnchor` is false (or omitted), the focus (end point) is returned, otherwise the starting point. If the selection is not inside the editor, `null` is returned. The method returns an object with the attributes `row` and `col` which contain the zero-based row (line) and column number of the selection position. |
|
|
172
|
+
| `setSelection(focus, anchor)` | Sets the selection within the editor. The parameters `focus` and `offset` are both of the format returned by `getSelection()` (containing attributes `row` and `col`). If `anchor` is `null` or omitted, a single-point selection (cursor position) will be set. |
|
|
173
|
+
| `paste(text, anchor, focus)` | Pastes / inserts text over either the current selection (if `anchor` and `focus` are null or omitted) or a specific range (if `anchor` and `focus` are passed in in the format as returned by `getSelection()`). |
|
|
174
|
+
| `wrapSelection(pre, post, anchor, focus)` | Wraps the current selection (if `anchor` and `focus` are `null` or omitted) or a specific selection (if `anchor` and `focus` are given) in the strings `pre` and `post`. For example, `wrapSelection('[', '](https://www.github.com)')` will wrap the selection with a link to GitHub. |
|
|
175
|
+
| `addEventListener(type, listener`) | Adds an [event listener](#event-listeners) to the editor. `type` is a string denoting the type (`change` or `selection`), and `listener` is a function which takes one parameter, the event. |
|
|
176
|
+
|
|
177
|
+
### Event listeners
|
|
178
|
+
|
|
179
|
+
There are two event listener types that can be registered on the editor: `change` and `selection`.
|
|
180
|
+
|
|
181
|
+
#### `change` event
|
|
182
|
+
|
|
183
|
+
A `change` event is fired any time the content of the editor changes. The event object passed to the listener function contains the following properties:
|
|
184
|
+
|
|
185
|
+
| Attribute | Description |
|
|
186
|
+
| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
187
|
+
| `content` | The current content as a string. |
|
|
188
|
+
| `linesDirty` | An array of booleans, which for each line contains `true` if the line might have changed in terms of either its content or its block type since the last change, and `false` if the line is guaranteed to not have changed. |
|
|
189
|
+
|
|
190
|
+
#### `selection` event
|
|
191
|
+
|
|
192
|
+
A `selection` event is fired any time the selection within the editor changes. The event object passed to the listener function contains the following properties:
|
|
193
|
+
|
|
194
|
+
| Attribute | Description |
|
|
195
|
+
| -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
196
|
+
| `focus` | The focus (end point) of the current selection, in the format as returned by `getSelection()` (two attributes `row` and `col` denoting the zero based row and column). |
|
|
197
|
+
| `anchor` | The anchor (start point) of the current selection, in the format as returned by `getSelection()` (two attributes `row` and `col` denoting the zero based row and column). |
|
|
198
|
+
| `commandState` | An array which contains an attribute for every default command name `bold`, `italic`, `strikethrough`, `code`, `h1`, `h2`, `ul`, `ol`, `blockquote`, `hr`, `insertLink`, and `insertImage`). The value of each attribute is one of `true`, `false`, or `null`. The value is `true` if the command is currently active (e.g., if the cursor is within a bold stretch of text, then the state for `bold` will be `true`). The value is `false` if the command is currently inactive but could be activated (e.g., if the selection encompasses a stretch of text that could be bolded, then the state for `bold` will be `false`). The value is `null` if the command is currently not applicable (e.g., if the cursor is within a code block where inline formatting is not available, the state will be `null` for `bold`). |
|
|
199
|
+
|
|
200
|
+
### Styling TinyMDE
|
|
201
|
+
|
|
202
|
+
In order to style TinyMDE, edit the CSS file. You can see the classes that can be assigned styles within the file. For a bit more detail about the classes, read on.
|
|
203
|
+
|
|
204
|
+
#### Editor styling
|
|
205
|
+
|
|
206
|
+
There are some generally interesting CSS classes that can be formatted. Most of them start with `TM`, short for `TinyMDE`.
|
|
207
|
+
|
|
208
|
+
- `TinyMDE` is the editor element.
|
|
209
|
+
- `TMMark` is any markup. Any element with the class `TMMark` will also have another class called `TMMark_*`, where `*` is replaced by the class name of the respective block or inline style. For example, in a H1 line with the content `# Heading 1`, the `#` is contained in an element with the classes `TMMark TMMark_TMH1`.
|
|
210
|
+
- `TMInlineFormatted` contains text that is inline formatted.
|
|
211
|
+
|
|
212
|
+
The following classes denote Markdown blocks: `TMPara`, `TMBlankLine`, `TMH1`, `TMH2`, `TMH3`, `TMH4`, `TMH5`, `TMH6`, `TMBlockquote`, `TMCodeFenceBacktickOpen`, `TMFencedCodeBacktick`, `TMCodeFenceBacktickClose`, `TMCodeFenceTildeOpen`, `TMFencedCodeTilde`, `TMCodeFenceTildeClose`, `TMSetextH1`, `TMSetextH1Marker`, `TMSetextH2`, `TMSetextH2Marker`, `TMHR`, `TMUL`, `TMOL`, `TMIndentedCode`, `TMLinkReferenceDefinition`, `TMHTMLBlock`.
|
|
213
|
+
|
|
214
|
+
The following classes denote Markdown inline formatted stretches of text: `TMCode`, `TMAutolink`, `TMHTML`, `TMStrong`, `TMEm`, `TMStrikethrough`, `TMImage`, `TMLink`, (`TMLinkLabel` (also marked as `TMLinkLabel_Valid` or `TMLinkLabel_Invalid` depending on whether or not the label references a valid reference), `TMLinkDestination`, `TMLinkTitle`, `TMImageDestination`, `TMImageTitle`.
|
|
215
|
+
|
|
216
|
+
Each line of a code fenced blocks (ie. starting and ending with ` ``` ` or `~~~`) will also be wrapped in an element with the class `TMFencedCode`. Each line of an HTML block (ie. starting with an HTML element) will also be wrapped in an element with the class `TMHTMLContent`.
|
|
217
|
+
|
|
218
|
+
#### CommandBar styling
|
|
219
|
+
|
|
220
|
+
The main toolbar element has the class `TMCommandBar`. Buttons have the class `TMCommandButton`, with an additional class of `TMCommandButton_Active`, `TMCommandButton_Inactive`, or `TMCommandButton_Disabled`, depending on the state of the respective command. Divider elements have the class `TMCommandDivider`.
|
|
221
|
+
|
|
222
|
+
## Build TinyMDE
|
|
223
|
+
|
|
224
|
+
Building TinyMDE is pretty straight forward:
|
|
225
|
+
|
|
226
|
+
1. Clone this repository:
|
|
227
|
+
```bash
|
|
228
|
+
git clone git@github.com:jefago/tiny-markdown-editor.git
|
|
229
|
+
```
|
|
230
|
+
2. In the repository directory, run the build script:
|
|
231
|
+
```bash
|
|
232
|
+
npm run build
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
The build output is in the `dist` directory. You will find the following files there:
|
|
236
|
+
|
|
237
|
+
- `tiny-mde.css` and `tiny-mde.min.css`: CSS files to style the editor. These can be edited at will to make the editor look like you want to. `tiny-mde.min.css` has the same content as `tiny-mde.css`, it's just minified. You will only need to use one of the files on your page. If you want to edit the CSS file, it's easier to edit `tiny-mde.css` and then minify the edited version.
|
|
238
|
+
- `tiny-mde.js`: Debug version of the editor. The JS file is not minified and contains a sourcemap. It is not recommended to use this in production settings, since the file is large.
|
|
239
|
+
- `tiny-mde.min.js`: Minified JS file for most use cases. Simply copy this to your project to use it.
|
|
240
|
+
- `tiny-mde.tiny.js`: Minified and stripped-down JS file. Contains only the editor itself, not the toolbar.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>TinyMDE demo</title>
|
|
5
|
+
<script src="./tiny-mde.js"></script>
|
|
6
|
+
<link rel="stylesheet" type="text/css" href="./tiny-mde.min.css" />
|
|
7
|
+
<meta name="viewport" content="initial-scale=1.0">
|
|
8
|
+
<style type="text/css">
|
|
9
|
+
html, body, div {
|
|
10
|
+
margin: 0px;
|
|
11
|
+
padding: 0px;
|
|
12
|
+
}</style>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<div id="tinymde_commandbar"></div>
|
|
16
|
+
<div id="tinymde" style="height:300px; overflow-y:scroll; border:1px solid #c0c0c0"></div>
|
|
17
|
+
</body>
|
|
18
|
+
</html>
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>TinyMDE demo</title>
|
|
5
|
+
<script src="./tiny-mde.js"></script>
|
|
6
|
+
<link rel="stylesheet" type="text/css" href="./tiny-mde.min.css" />
|
|
7
|
+
<meta name="viewport" content="initial-scale=1.0">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<h1>TinyMDE demo</h1>
|
|
11
|
+
|
|
12
|
+
<div id="tinymde_commandbar"></div>
|
|
13
|
+
<div id="tinymde" style="height:300px; overflow-y:scroll; border:1px solid #c0c0c0">
|
|
14
|
+
<textarea id="txt"># Hello TinyMDE
|
|
15
|
+
[ref]: https://www.jefago.com
|
|
16
|
+
[ref link]: </this has spaces> "and a title"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Some <html> </tags> right here
|
|
20
|
+
<html a="b" >
|
|
21
|
+
|
|
22
|
+
More <html a="b c" d = 'e f' h = i j /> here
|
|
23
|
+
Comment <!-- here --> and <!-- not -- a --> comment and neither here <!---->
|
|
24
|
+
Test <a foo="bar" bam = 'baz <em>"</em>' _boolean zoop:33=zoop:33 /> case
|
|
25
|
+
Illegal HTML <__> <33> <a h*ref="hi"> <a href="hi'> <a href=hi'> < a> <a/ > <foo bar=baz bim!bop /> <a href='a'title=title>
|
|
26
|
+
Processing instructions <?here?> and <? h e r e ?> and <?a?> here and <??> here and <? here ? here > here ?> yup
|
|
27
|
+
Declarations <!DOCTYPE html> and <!DECLARE > and <!DO the OK@#( fwekof'230-2= πππ> here but <!NOT> here
|
|
28
|
+
A <![CDATA[section right ] freak > ing ]] here]]> but not anymore
|
|
29
|
+
Autolink, not inline link: [this <https://]()>
|
|
30
|
+
HTML, not inline link: [this <html a="]()">
|
|
31
|
+
More `complex` line with *one **style** within* another.
|
|
32
|
+
Code `ends here\` not here`
|
|
33
|
+
More ``difficult `code`` spans \`not code` \\"
|
|
34
|
+
Code `` `that starts `` with a backtick
|
|
35
|
+
This is [not `a ](link) right` here.
|
|
36
|
+
|
|
37
|
+
[ref]: https://www.jefago.com
|
|
38
|
+
[ref link]: </this has spaces> "and a title"
|
|
39
|
+
[ link label ]: "Only title, spaces in the label"
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Autolinks
|
|
43
|
+
---------
|
|
44
|
+
<mail@jefago.com> <https://www.jefago.com/> <a+b:>
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
[invalid]
|
|
48
|
+
[invalid][]
|
|
49
|
+
[in-valid][invalid]
|
|
50
|
+
This foo-_(bar)_ should
|
|
51
|
+
THis _(also)_ should
|
|
52
|
+
Only _underscores_ in this line
|
|
53
|
+
There's <html><like><tags><over><here>
|
|
54
|
+
A [ref link] in here.
|
|
55
|
+
And another [ref link][].
|
|
56
|
+
A valid [link to a ref][ref] here.
|
|
57
|
+
An invalid [ref link][nope].
|
|
58
|
+
An [inline link](/inline) here.
|
|
59
|
+
Some [inline](<links>) [inline](<link link> "title title") [inline](<link link> (title title)) [inline]( <link link> 'title \\' title') ss
|
|
60
|
+
[Inline]( /with invalid title text ) here.
|
|
61
|
+
[Inline]( </with (complex) dest> (and title text) ) here.
|
|
62
|
+
[Inline](<> "") link with empty delimiters
|
|
63
|
+
[Inline]() link completely empty
|
|
64
|
+
[Valid link](")))") here
|
|
65
|
+
[Valid link](<)))>) here
|
|
66
|
+
[Invalid]( ( ) here
|
|
67
|
+
This one [is *a](link) over* here, but not an emphasis.
|
|
68
|
+
Here [the [inner](one) is] the valid link.
|
|
69
|
+
An  a](link) inside it.
|
|
70
|
+
This **is** a test.
|
|
71
|
+
|
|
72
|
+
*Full line emphasized*
|
|
73
|
+
Open ***without* close
|
|
74
|
+
Both __types__ of *delimiters*
|
|
75
|
+
__*Mixed* and matched__
|
|
76
|
+
__mixed*_ and *unmatched_
|
|
77
|
+
Close **without* open** test
|
|
78
|
+
ab**cd*e*f*g*h**i*j*k
|
|
79
|
+
Several *em* phasized *words and* some *phrases*.
|
|
80
|
+
Triple ***emphasis***.
|
|
81
|
+
One *emphasis *within* another*.
|
|
82
|
+
|
|
83
|
+
H1
|
|
84
|
+
==
|
|
85
|
+
Hello *there*.
|
|
86
|
+
~~~
|
|
87
|
+
Code
|
|
88
|
+
block
|
|
89
|
+
~~~
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
> Quote and
|
|
93
|
+
Indented code block
|
|
94
|
+
|
|
95
|
+
* * *
|
|
96
|
+
|
|
97
|
+
- UL
|
|
98
|
+
- UL (and an empty one below)
|
|
99
|
+
-
|
|
100
|
+
|
|
101
|
+
1) OL
|
|
102
|
+
2) OL</textarea>
|
|
103
|
+
</div>
|
|
104
|
+
<div id="status" style="text-align:right">- : -</div>
|
|
105
|
+
<script>
|
|
106
|
+
// Create editor element, initialized to a textarea
|
|
107
|
+
tinyMDE = new TinyMDE.Editor({textarea: 'txt'});
|
|
108
|
+
|
|
109
|
+
// Create a command bar for that editor
|
|
110
|
+
cmdBar = new TinyMDE.CommandBar({
|
|
111
|
+
element: 'tinymde_commandbar',
|
|
112
|
+
editor: tinyMDE,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
// Add a custom selection event listener
|
|
116
|
+
tinyMDE.addEventListener('selection', (e) => {
|
|
117
|
+
let st = `${e.focus ? e.focus.row : '–'} : ${e.focus ? e.focus.col : '–'}`;
|
|
118
|
+
for (let command in e.commandState) {
|
|
119
|
+
if (e.commandState[command]) st = command.concat(' ', st);
|
|
120
|
+
}
|
|
121
|
+
document.getElementById('status').innerHTML = st;
|
|
122
|
+
});
|
|
123
|
+
</script>
|
|
124
|
+
|
|
125
|
+
</body>
|
|
126
|
+
</html>
|