Commit Graph

35 Commits

Author SHA1 Message Date
Sujit Kumar
16d5cc11e3 Add toolbar support for admin panel (#36) 2022-03-09 19:53:33 -05:00
David Wheatley
1738957af7 feat: make markdown toolbar extensible (#33) 2021-12-30 22:02:25 +01:00
David Wheatley
ac83e9b667 fix: re-use of texteditor with markdown ext breaks markdown toolbar items (#34)
* fix: re-use of texteditor with markdown ext breaks markdown toolbar items

* code review
2021-12-29 20:41:19 +00:00
David Wheatley
81b27ede28 feat: add prettier formatting 2021-12-29 13:17:02 +01:00
David Wheatley
1adb9ca553 Revert "feat: encapsulate markdown buttons in itemlist"
This reverts commit d4aecfc9e3.
2021-10-25 19:58:28 +02:00
David Wheatley
d4aecfc9e3 feat: encapsulate markdown buttons in itemlist 2021-10-25 19:56:35 +02:00
David Sevilla Martin
8111b5a56c Prevent browser/system shortcuts from triggering when applying editor style from shortcut (#32) 2021-09-20 18:06:47 -04:00
Hasan Özbey
e376358e64 Add spoiler and strikethrough buttons (#30)
Co-authored-by: Sami Mazouz <sychocouldy@gmail.com>
2021-09-20 10:18:48 -04:00
David Wheatley
fd3300d7e5 Add missing link button to Markdown toolbar (#29) 2021-05-31 14:26:44 +01:00
Alexander Skvortsov
7f37e36241 Avoid submitting forms with MarkdownButton
Add type="button" to the component so that it won't submit if placed inside a form.

Fixes https://github.com/flarum/core/issues/2875
2021-05-18 01:19:52 -04:00
David Wheatley
f076329636 Fix tooltip deprecation warning 2021-05-17 14:43:35 +01:00
David Wheatley
c9af88e721 Use namespaced JS imports 2021-05-17 14:43:21 +01:00
Alexander Skvortsov
7ea9db7426 Editor Consolidation (#28)
- Move insertText to core
- Move styles and apply to core
- Simplify shortcut and button system
- Drop mdarea for now. In the future, we could implement the features we use (list continue, indent) in core.
- Remove admin dist (only admin setting was mdarea)
- Move inline style to css
2021-05-10 17:35:22 -04:00
Alexander Skvortsov
61e61f5e8c Allow disabling mdarea via admin setting (#27) 2021-03-25 13:51:21 -04:00
Alexander Skvortsov
ae6a652a72 Fix typo 2021-03-11 13:11:56 -05:00
Alexander Skvortsov
752c43376e Run oninput and input listeners on timeout
This is necessary for the setTimeout callback to be run after the new value has been applied; otherwise, mobile iOS doesn't respect the timeout.

Fixes https://github.com/flarum/core/issues/2681
2021-03-10 19:23:27 -05:00
Alexander Skvortsov
50da5ffd45 Handle editor-driven input events.
The mdarea extension's handleKey method only applies when input is accompanied by an actual key press, and won't register programmatic inputs via `app.composer.editor` methods. We add an additional listener for custom events, which are dispatched in `setValue`.
2021-03-08 16:09:18 -05:00
Alexander Skvortsov
09b14b980a Attach oninput, inputListeners, onsubmit via mdarea extension
Recent versions of mdarea are quite powerful, and have internal state data structures. As a result, updating current editor value via `oninput` event listeners isn't reliable. Instead, we can use the mdarea extension API to handle keypresses exactly when markdownarea wants us to.

This also removes the `super` call from `build`, and directly creates/configures the applicable DOM elements. Since the mdarea editor driver's initialization is already quite different from BasicEditorDriver, it should fully own this step.
2021-02-27 16:05:25 -05:00
Alexander Skvortsov
aa62e69dab MarkdownEditorDriver should be its own driver.
Splitting it out instead of hacking it onto BasicEditorDriver gives us more flexibility in customizing it for markdown area.
2021-02-27 15:37:19 -05:00
Alexander Skvortsov
3bdfbf9349 Editor driver support 2021-02-26 22:18:54 -05:00
Alexander Skvortsov
14adb2bed1 mdarea: disable inlines
This was accidentially introduced when updating for v1.0.0 of the mdarea library, and causes user inconvenience.

Fixes https://github.com/flarum/core/issues/2569
2021-01-25 19:57:43 -05:00
Alexander Skvortsov
ab63a55d60 Mithril 2 Update (#19)
Update for Mithril 2
2020-09-23 22:51:50 -04:00
Alexander Skvortsov
c0aa73f01a Update mdarea to v1.0.1 (#20)
* Update mdarea to v1.0.1
2020-08-16 20:43:45 -04:00
Alexander Skvortsov
a232d8bcfc Remove polyfills: we don't support IE anymore (#18)
* Remove polyfills: we don't support IE anymore
2020-08-16 16:32:19 -04:00
Matteo Contrini
8d84d1dea6 Change default URL value in link/image markdown button (#11)
* Change default URL value in link/image markdown button
2020-05-20 17:07:10 -04:00
David Sevilla Martin
db3a037c97 Add license code to index.js, and line to LICENSE 2019-09-09 20:21:58 -04:00
David Sevilla Martin
b04b82b3a5 Add copyright notice for markdown toolbar code taken from GitHub
Refs #8
2019-09-09 20:06:18 -04:00
David Sevilla Martin
8277b54651 Add image button (flarum/core#1679) 2019-08-11 16:06:30 -04:00
David Sevilla Martin
eb561e6343 Fix 'polyfills' incorrect spelling, add LICENSE text for startsWith polyfill 2019-08-03 09:14:24 -04:00
David Sevilla Martín
f4e250f514 Simplify some code in MarkdownButton component 2019-07-10 12:41:05 -04:00
David Sevilla Martín
50a4530cfc Use custom JSX implementation of GitHub's markdown toolbar that works in IE 11 2019-07-10 12:30:35 -04:00
David Sevilla Martín
3726307f16 Add custom-elements pollyfill & markdown bar if Reflect API is present
Ref #1702
2019-04-10 18:13:09 -04:00
David Sevilla Martín
8f8714134b Add harmony-reflect to fix issues with markdown bar in IE (#6) 2019-03-20 20:51:23 +01:00
Toby Zerner
f75f2214a6 Add custom elements polyfill 2018-11-14 06:43:45 +10:30
Toby Zerner
40438fd0a6 Add markdown toolbar buttons and textarea helper 2018-11-12 21:02:50 +10:30