Skip to content

Commit

Permalink
Merge pull request #47 from Offerel/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Offerel authored Feb 3, 2021
2 parents c2518bb + 76904be commit f548189
Show file tree
Hide file tree
Showing 11 changed files with 92 additions and 50 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### v2.0.1
- Remove ToC button in edit mode
- Fix for creating new notes

### v2.0.0
- Added loader animation
- Added option to remove media
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"homepage": "https://github.com/Offerel/roundcube_primitivenotes",
"type": "roundcube-plugin",
"license": "AGPL-3.0",
"version": "2.0.0",
"version": "2.0.1",
"authors": [
{
"name": "Offerel",
Expand Down
31 changes: 26 additions & 5 deletions js/notes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Roundcube Notes Plugin
*
* @version 2.0.0
* @version 2.0.1
* @author Offerel
* @copyright Copyright (c) 2021, Offerel
* @license GNU General Public License, version 3
Expand Down Expand Up @@ -83,9 +83,32 @@ $(document).ready(function(){
if(estate.value == 's') {
mde.togglePreview();
estate.value = 'e';
document.querySelector('#main_area .editor-toolbar').style.display = 'block';
}
mde.value("");
mde.value("");
document.getElementById('fname').value = '';
let editor1 = document.getElementById('editor1');
editor1.value = '';

if(e.data.format == 'md') {
document.querySelector('#main_area .editor-toolbar').style.display = 'block';
document.querySelector('.EasyMDEContainer').style = 'display: block';
mde.value('');
} else {
let toolbar = document.createElement('div');
toolbar.id = 'atoolbar';
let bSave = document.createElement('li');
bSave.id = 'bSave';
bSave.classList.add("fa", "fa-floppy-o");
bSave.addEventListener('click', sbfile, false);
toolbar.appendChild(bSave);
let bSeperator = document.createElement('i');
bSeperator.classList.add("separator");
toolbar.appendChild(bSeperator);

editor1.parentNode.insertBefore(toolbar, editor1);
document.querySelector('.EasyMDEContainer').style = 'display: none';
editor1.style = 'display: block';
}
}
if('editor' in e.data && e.data.editor == 'edit') {
if(estate.value == 's') {
Expand All @@ -107,13 +130,11 @@ $(document).ready(function(){
let toolbar = document.createElement('div');
let editor = document.getElementById('editor1');
toolbar.id = 'atoolbar';

let bSave = document.createElement('li');
bSave.id = 'bSave';
bSave.classList.add("fa", "fa-floppy-o");
bSave.addEventListener('click', sbfile, false);
toolbar.appendChild(bSave);

let bSeperator = document.createElement('i');
bSeperator.classList.add("separator");
toolbar.appendChild(bSeperator);
Expand Down
4 changes: 2 additions & 2 deletions js/notes.min.js

Large diffs are not rendered by default.

31 changes: 26 additions & 5 deletions js/primitivenotes.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* Roundcube Notes Plugin
*
* @version 2.0.0
* @version 2.0.1
* @author Offerel
* @copyright Copyright (c) 2021, Offerel
* @license GNU General Public License, version 3
Expand All @@ -13,7 +13,8 @@ window.rcmail && rcmail.addEventListener("init", function(a) {
rcmail.register_command("sendnote", send_note, !0);
rcmail.register_command("addnote", add_note, !0);
rcmail.register_command("mdnote", new_note, !0);
rcmail.register_command("txtnote", new_note, !0);
rcmail.register_command("txtnote", new_note, !0);
document.getElementById('upl').addEventListener('change', sform, false );
});

function add_note() {
Expand All @@ -32,18 +33,24 @@ function new_note(a) {
$("#notescontentframe").contents().find("#headerTitle").replaceWith(nname);
$("#notescontentframe").contents().find("#note_name").replaceWith(nname);
$("#notescontentframe").contents().find("tags").addClass('edit');
$("#notescontentframe").contents().find("#tbutton").remove();

let tstate = {
tstate:false,
ttags:'',
editor:'new',
editor:'new',
format:format,
};
document.getElementById('notescontentframe').contentWindow.postMessage(tstate, location.href);
$("#notescontentframe").contents().find("#note_name")[0].placeholder = rcmail.gettext("note_title", "primitivenotes");
$("#notescontentframe").contents().find("#note_name")[0].placeholder = rcmail.gettext("note_title", "primitivenotes");
document.getElementById('editnote').classList.add('disabled');
document.getElementById('deletenote').classList.add('disabled');
document.getElementById('sendnote').classList.add('disabled');
}

function edit_note() {
let nTitel = $("#notescontentframe").contents().find("#headerTitle");
$("#notescontentframe").contents().find("#tbutton").remove();
let nname = document.createElement('input');
nname.id = 'note_name';
nname.name = nname.id;
Expand Down Expand Up @@ -102,4 +109,18 @@ function send_note() {
_note_type: b,
_note_filename: a
}, !0) : alert(rcmail.gettext("note_inv_format", "primitivenotes"))
};
};

function sform() {
fileName = this.value;
var allowed_extensions = new Array('html', 'pdf', 'jpg', 'png', 'md', 'txt');
var file_extension = fileName.split('.').pop().toLowerCase();
for(var i = 0; i <= allowed_extensions.length; i++) {
if(allowed_extensions[i]==file_extension) {
document.getElementById("upl_form").submit();
return true;
}
}
alert('<roundcube:label name=\"primitivenotes.note_inv_format\" />');
return false;
}
4 changes: 2 additions & 2 deletions js/primitivenotes.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion notes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Roundcube Notes Plugin
*
* @version 2.0.0
* @version 2.0.1
* @author Offerel
* @copyright Copyright (c) 2021, Offerel
* @license GNU General Public License, version 3
Expand Down
4 changes: 2 additions & 2 deletions primitivenotes.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/**
* Roundcube Notes Plugin
*
* @version 2.0.0
* @version 2.0.1
* @author Offerel
* @copyright Copyright (c) 2021, Offerel
* @license GNU General Public License, version 3
Expand Down Expand Up @@ -160,7 +160,7 @@ function action() {

function content($attrib) {
$rcmail = rcmail::get_instance();
$this->include_script('js/primitivenotes.js');
$this->include_script('js/primitivenotes.min.js');
$attrib['src'] = 'plugins/primitivenotes/notes.php';
if (empty($attrib['id'])) $attrib['id'] = 'rcmailnotescontent';
$attrib['name'] = $attrib['id'];
Expand Down
6 changes: 5 additions & 1 deletion skins/elastic/plugin.css
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,11 @@
text-align: center;
text-overflow: ellipsis;
overflow-x: hidden;
line-height: 2.5;
line-height: 2.5;
outline: 0;
}
#newmenulink:before {
line-height: 40px;
}
.toolbar a.button::before {
display: block;
Expand Down
2 changes: 1 addition & 1 deletion skins/elastic/plugin.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f548189

Please sign in to comment.