Skip to content

Commit dc3f0bb

Browse files
committed
New plugin "markdown_editor": compose in markdown, send as HTML
This adds a markdown editor that sends HTML to the server. It uses codemirror and some custom code to show a syntax highlighted textarea and some buttons to help editing (including a preview). Drafts get marked via an internal email header that causes the markdown editor to automatically start if a message composition is continued that was started using the markdown editor.
1 parent 9a2606d commit dc3f0bb

File tree

21 files changed

+2845
-3
lines changed

21 files changed

+2845
-3
lines changed

.ci/config-test.inc.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
'archive',
3535
'attachment_reminder',
3636
'markasjunk',
37+
'markdown_editor',
3738
'zipdownload',
3839
];
3940

.ci/run_browser_tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ bin/install-jsdeps.sh
4747
# Compile Elastic's styles
4848
make css-elastic
4949

50+
# Build JS and CSS for plugins
51+
make plugins-build
52+
5053
# Use minified javascript files
5154
bin/jsshrink.sh
5255

.tx/config

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,12 @@ file_filter = plugins/zipdownload/localization/<lang>.inc
9292
source_file = plugins/zipdownload/localization/en_US.inc
9393
source_lang = en_US
9494

95+
[o:roundcube:p:roundcube-webmail:r:plugin-markdown_editor]
96+
file_filter = plugins/markdown_editor/localization/<lang>.inc
97+
source_file = plugins/markdown_editor/localization/en_US.inc
98+
source_lang = en_US
99+
95100
[o:roundcube:p:roundcube-webmail:r:timezones]
96101
file_filter = program/localization/<lang>/timezones.inc
97102
source_file = program/localization/en_US/timezones.inc
98103
source_lang = en_US
99-

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ This file includes only changes we consider noteworthy for users, admins and plu
1111
- Add ability to chose from all available contact fields on CSV import (#9419)
1212
- Password: Removed the (insecure) virtualmin driver (#8007)
1313
- Fix jqueryui plugin's minicolors.css issue with custom skins (#9967)
14+
- Add a new plugin called `markdown_editor` that provides an alternative editor to compose emails with in Markdown syntax, which gets converted into HTML before sending.
1415

1516
## Release 1.7-beta2
1617

Makefile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ verify:
6161
shasum:
6262
shasum -a 256 roundcubemail-$(VERSION).tar.gz roundcubemail-$(VERSION)-complete.tar.gz roundcube-framework-$(VERSION).tar.gz
6363

64-
roundcubemail-git: buildtools
64+
roundcubemail-git: buildtools plugin-markdown_editor-prepare-for-release
6565
git clone --branch=$(GITBRANCH) --depth=1 $(GITREMOTE) roundcubemail-git
6666
(cd roundcubemail-git; bin/jsshrink.sh; bin/updatecss.sh; bin/cssshrink.sh)
6767
(cd roundcubemail-git/skins/elastic && make css)
@@ -119,4 +119,18 @@ composer-update: /tmp/composer.phar
119119
install-jsdeps: npm-install
120120
./bin/install-jsdeps.sh
121121

122-
build: composer-update install-jsdeps css-elastic
122+
build: composer-update install-jsdeps css-elastic plugins-build
123+
124+
plugins-build: plugin-markdown_editor-build
125+
126+
plugin-markdown_editor-build: plugin-markdown_editor-clean
127+
cd plugins/markdown_editor && \
128+
npm clean-install && \
129+
npm run build && \
130+
rm -rf node_module
131+
132+
plugin-markdown_editor-clean:
133+
cd plugins/markdown_editor && npm run clean
134+
135+
plugin-markdown_editor-prepare-for-release: plugin-markdown_editor-build
136+
(cd roundcubemail-git/plugins/markdown_editor; rm -rf node_modules package*.json rollup.config.*js build.sh javascript *.less tests)

plugins/markdown_editor/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
node_modules
2+
/bundle-stats.html
3+
/skins/elastic/styles/markdown_editor.*css
4+
/skins/elastic/styles/iframe.*css
5+
/markdown_editor.*js

plugins/markdown_editor/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
MarkdownEditor
2+
==============
3+
4+
A markdown editor (duh!).
5+
6+
This plugins adds an alternative editor to compose emails with in Markdown syntax, which gets converted into HTML before sending.
7+
8+
It provides syntax highlighting and a toolbar (including a preview button) to help writing markdown. Drafts are saved as-is, and are automatically re-opened in this editor on re-editing. On sending the written markdown text gets converted into HTML.
9+
10+
(Roundcubemail automatically produces a multipart/alternative email from the given HTML, including a text/plain part consisting of re-converted HTML-to-text. Using our original text as text/plain part would be preferable but is left for a future version of this plugin.)
11+
12+
13+
Installation
14+
------------
15+
16+
Run `npm clean-install && npm run build` to produce the minified Javascript and CSS files required to run.
17+
18+
To enable this editor, add `'markdown_editor'` to the list of plugins in your `config.inc.php`.
19+
20+
There is no configuration.

plugins/markdown_editor/build.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
3+
set -ex
4+
5+
exec npm run build
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"name": "roundcube/markdown_editor",
3+
"type": "roundcube-plugin",
4+
"description": "An editor to compose emails in Markdown syntax, which gets converted into HTML before sending.",
5+
"license": "GPL-3.0-or-later",
6+
"version": "0.1",
7+
"authors": [
8+
{
9+
"name": "Pablo Zimdahl",
10+
"homepage": "https://github.com/pabzm"
11+
}
12+
],
13+
"require": {
14+
"php": ">=8.1.0",
15+
"roundcube/plugin-installer": "~0.3.5"
16+
},
17+
"autoload": {
18+
"classmap": [
19+
"markdown_editor.php"
20+
]
21+
}
22+
}

0 commit comments

Comments
 (0)