Browse Source

[WIP] Per-notice markdown setting

master
Chimo 2 years ago
parent
commit
e8c34e3fc0
5 changed files with 39 additions and 1 deletions
  1. 9
    1
      MarkdownPlugin.php
  2. 21
    0
      css/markdown.css
  3. BIN
      images/markdown-disabled.png
  4. BIN
      images/markdown-enabled.png
  5. 9
    0
      js/gs-markdown.js

+ 9
- 1
MarkdownPlugin.php View File

@@ -6,7 +6,7 @@ if (!defined('GNUSOCIAL')) {

class MarkdownPlugin extends Plugin
{
const VERSION = '0.0.9';
const VERSION = '0.0.10';
const NAME_SPACE = 'markdown'; // 'namespace' is a reserved keyword

function initialize()
@@ -173,6 +173,14 @@ class MarkdownPlugin extends Plugin
return true;
}

function onEndShowNoticeFormData($action)
{
$action->elementStart('div', array('class' => 'notice_data-markdown_wrap'));
$action->element('input', array('class' => 'checkbox', 'id' => 'markdown', 'type' => 'checkbox'));
$action->element('label', array('class' => 'notice_data-markdown', 'for' => 'markdown'), 'Parse this notice as markdown');
$action->elementEnd('div');
}

function onEndShowStyles($action)
{
$action->cssLink($this->path('css/markdown.css'));

+ 21
- 0
css/markdown.css View File

@@ -1,3 +1,24 @@
#notices_primary .e-content h2 {
display: block;
}

.notice_data-markdown {
background: url("../images/markdown-disabled.png") no-repeat top left;
cursor: pointer;
display: block;
height: 16px;
position: absolute;
right: 0;
text-indent: -9999px;
top: 52px;
width: 16px;
z-index: 99;
}

.notice_data-markdown_wrap input {
visibility: hidden;
}

.notice_data-markdown_wrap .checkbox:checked + .notice_data-markdown {
background: url("../images/markdown-enabled.png") no-repeat top left;
}

BIN
images/markdown-disabled.png View File


BIN
images/markdown-enabled.png View File


+ 9
- 0
js/gs-markdown.js View File

@@ -0,0 +1,9 @@
( function() {
/*
* TODO:
* Check the state of the checkbox (checked = markdown-enabled)
* Save the opposite setting
* Change the state of the button
*/
}() );


Loading…
Cancel
Save