added a new item content type: markdown

- emacs editor has an option to select markdown, now it has two planes: one for content editing and the other to show preview
- CodeMirror editor updated to 5.64.0
- to convert markdown to html we use showdown https://github.com/showdownjs/showdown (conversion is done on the client side)
This commit is contained in:
2021-11-26 21:49:21 +01:00
parent 119497bb01
commit 35cb54324f
8 changed files with 355 additions and 73 deletions

View File

@@ -1,6 +1,7 @@
<div class="uk-margin">
[if false]
[if winix_function_is "upload"]
<label class="uk-form-label" for="winix_content_id">{upload_content}</label>
[else]
@@ -8,10 +9,56 @@
[if mount_type_is "thread"]<label class="uk-form-label" for="winix_content_id">{form_emacs_content_thread}</label>[end]
[if mount_type_is "ticket"]<label class="uk-form-label" for="winix_content_id">{form_emacs_content_ticket}</label>[end]
[end]
[end]
<div class="uk-form-controls">
[# CodeMirror doesn't work correctly inside fieldset tag -- horizontal scroll is broken]
<textarea class="uk-textarea" [if request.is_item]autofocus [end]id="winix_content_id" rows="[if winix_function_is "upload"]7[else][if mount_type_is "cms"]30[else]10[end][end]" cols="60" name="itemcontent">[item.content.content_raw]</textarea>
<div class="uk-flex uk-child-width-1-2">
<textarea
style="height: 1000px"
class="uk-textareaa"
[if request.is_item]autofocus [end]
id="winix_content_id"
rows="[if winix_function_is "upload"]7[else][if mount_type_is "cms"]300[else]300[end][end]"
cols="60" name="itemcontent">[item.content.content_raw]</textarea>
<div class="uk-margin-left" id="winix_output_preview">
</div>
</div>
[if false]
<ul uk-tab>
<li><a href="#">{upload_content_edit}</a></li>
<li><a href="#">{upload_content_preview}</a></li>
</ul>
<ul class="uk-switcher">
<li>
<textarea
style="height: 1000px"
class="uk-textarea"
[if request.is_item]autofocus [end]
id="winix_content_id"
rows="[if winix_function_is "upload"]7[else][if mount_type_is "cms"]300[else]300[end][end]"
cols="60" name="itemcontent">[item.content.content_raw]</textarea>
</li>
<li>
<div class="uk-margin-left" id="winix_output_preview">
</div>
</li>
</ul>
[end]
<input type="hidden" id="winix_content_parsed_id" value="" name="itemcontent_parsed">
</div>
</div>
@@ -22,9 +69,16 @@
<option[if item.content.type_is "text"] selected[end] value="0">{form_emacs_content_type_text}</option>
<option[if item.content.type_is "formatted text"] selected[end] value="1">{form_emacs_content_type_formatted_text}</option>
[if user_can_use_html]<option[if item.content.type_is "html"] selected[end] value="2">{form_emacs_content_type_html}</option>[end]
[if user_can_use_bbcode]<option[if item.content.type_is "bbcode"] selected[end] value="3">{form_emacs_content_type_bbcode}</option>[end]
[if user_can_use_html]<option[if item.content.type_is "markdown"] selected[end] value="5">{form_emacs_content_type_markdown}</option>[end]
[if user_can_use_other]<option[if item.content.type_is "other"] selected[end] value="4">{form_emacs_content_type_other}</option>[end]
</select>
[if false]
[if user_can_use_bbcode]<option[if item.content.type_is "bbcode"] selected[end] value="3">{form_emacs_content_type_bbcode}</option>[end]
[end]
</div>