From 96c334e7303f15c7402c96531574a438f4ff8ad0 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 12 Oct 2021 11:27:36 +0000 Subject: bbcode for notes app --- Zotlabs/Module/Notes.php | 11 ++++- Zotlabs/Widget/Notes.php | 1 + view/css/conversation.css | 2 +- view/css/widgets.css | 18 ++++++-- view/tpl/notes.tpl | 103 ++++++++++++++++++++++++++++++++++++++++++---- 5 files changed, 120 insertions(+), 15 deletions(-) diff --git a/Zotlabs/Module/Notes.php b/Zotlabs/Module/Notes.php index 6e8e03f20..57b8f30db 100644 --- a/Zotlabs/Module/Notes.php +++ b/Zotlabs/Module/Notes.php @@ -19,7 +19,12 @@ class Notes extends Controller { if(! Apps::system_app_installed(local_channel(), 'Notes')) return EMPTY_STR; - $ret = array('success' => true); + $ret = [ + 'success' => false, + 'html' => '' + ]; + + if(array_key_exists('note_text',$_REQUEST)) { $body = escape_tags($_REQUEST['note_text']); @@ -33,6 +38,10 @@ class Notes extends Controller { set_pconfig(local_channel(),'notes','text.bak',$old_text); } set_pconfig(local_channel(),'notes','text',$body); + + $ret['html'] = bbcode($body); + $ret['success'] = true; + } // push updates to channel clones diff --git a/Zotlabs/Widget/Notes.php b/Zotlabs/Widget/Notes.php index 05c1a0292..66c90ef7d 100644 --- a/Zotlabs/Widget/Notes.php +++ b/Zotlabs/Widget/Notes.php @@ -20,6 +20,7 @@ class Notes { $o = replace_macros($tpl, array( '$banner' => t('Notes'), '$text' => $text, + '$html' => bbcode($text), '$save' => t('Save'), '$app' => ((isset($arr['app'])) ? true : false), '$hidden' => ((isset($arr['hidden'])) ? true : false) diff --git a/view/css/conversation.css b/view/css/conversation.css index dbb930fc7..88081c2c6 100644 --- a/view/css/conversation.css +++ b/view/css/conversation.css @@ -313,7 +313,7 @@ code { } code.inline-code { - padding: 0px 4px; + padding: 0.2em; display: inline; } diff --git a/view/css/widgets.css b/view/css/widgets.css index a67c10ed2..b78725919 100644 --- a/view/css/widgets.css +++ b/view/css/widgets.css @@ -41,13 +41,23 @@ li:hover .widget-nav-pills-icons { /* notes */ #note-text { - border: 1px solid rgba(0,0,0,.125); - padding: 5px; + padding: 7px 10px; width: 100%; resize: vertical; min-height: 250px; - overflow: auto; - outline: none; + overflow-y: auto; + overflow-x: hidden; +} + +#note-text-html { + padding: 7px 10px; + height: 250px; + width: 100%; + resize: vertical; + min-height: 250px; + overflow-y: auto; + overflow-x: hidden; + } /* saved searches */ diff --git a/view/tpl/notes.tpl b/view/tpl/notes.tpl index 0ae0604ef..22a249fd9 100644 --- a/view/tpl/notes.tpl +++ b/view/tpl/notes.tpl @@ -1,37 +1,122 @@ {{if $app}}
-
+
+
Read mode

{{$banner}}

-
+
{{else}}
-

{{$banner}}

+
Read mode
+

{{$banner}}

{{/if}} - + +
{{$html}}
{{if $app}}
-- cgit v1.2.3