Updated edit extension, added status button to toolbar
This commit is contained in:
parent
2b85a6d09f
commit
a66a3ee0fe
4 changed files with 33 additions and 22 deletions
|
@ -4,8 +4,6 @@
|
|||
|
||||
.yellow-bar {
|
||||
position: relative;
|
||||
line-height: 2em;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
.yellow-bar-left {
|
||||
display: block;
|
||||
|
@ -554,7 +552,7 @@
|
|||
.yellow-icon-fontawesome:before {
|
||||
content: "\f113";
|
||||
}
|
||||
.yellow-icon-draft:before {
|
||||
.yellow-icon-status:before {
|
||||
content: "\f114";
|
||||
}
|
||||
.yellow-icon-undo:before {
|
||||
|
|
|
@ -92,6 +92,8 @@ yellow.edit = {
|
|||
this.getRawDataPaneAction("menu", yellow.system.userName, true)+
|
||||
"</div>"+
|
||||
"<div class=\"yellow-bar-banner\"></div>";
|
||||
} else {
|
||||
elementDiv.innerHTML = " ";
|
||||
}
|
||||
elementBar.appendChild(elementDiv);
|
||||
yellow.toolbox.insertBefore(elementBar, document.getElementsByTagName("body")[0].firstChild);
|
||||
|
@ -587,7 +589,7 @@ yellow.edit = {
|
|||
case "tl": yellow.editor.setMarkdown(elementText, "- [ ] ", "insert-multiline-block", true); break;
|
||||
case "link": yellow.editor.setMarkdown(elementText, "[link](url)", "insert", false, yellow.editor.getMarkdownLink); break;
|
||||
case "text": yellow.editor.setMarkdown(elementText, args, "insert"); break;
|
||||
case "draft": yellow.editor.setMetaData(elementText, "status", "draft", true); break;
|
||||
case "status": yellow.editor.setMetaData(elementText, "status", true); break;
|
||||
case "file": this.showFileDialog(); break;
|
||||
case "undo": yellow.editor.undo(); break;
|
||||
case "redo": yellow.editor.redo(); break;
|
||||
|
@ -1161,9 +1163,15 @@ yellow.editor = {
|
|||
},
|
||||
|
||||
// Set meta data
|
||||
setMetaData: function(element, key, value, toggle) {
|
||||
setMetaData: function(element, key, toggle) {
|
||||
var information = this.getMetaDataInformation(element, key);
|
||||
if (information.bottom!=0) {
|
||||
var value = "";
|
||||
if (key=="status") {
|
||||
var tokens = yellow.system.editStatusValues.split(/\s*,\s*/);
|
||||
var index = tokens.indexOf(information.value);
|
||||
value = tokens[index+1<tokens.length ? index+1 : index];
|
||||
}
|
||||
var selectionStart = information.found ? information.start : information.bottom;
|
||||
var selectionEnd = information.found ? information.end : information.bottom;
|
||||
var text = information.text;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// This file may be used and distributed under the terms of the public license.
|
||||
|
||||
class YellowEdit {
|
||||
const VERSION = "0.8.20";
|
||||
const VERSION = "0.8.21";
|
||||
const TYPE = "feature";
|
||||
public $yellow; //access to API
|
||||
public $response; //web response
|
||||
|
@ -1183,9 +1183,10 @@ class YellowEditResponse {
|
|||
$data["editSettingsActions"] = $this->getSettingsActions();
|
||||
$data["editUploadExtensions"] = $this->yellow->system->get("editUploadExtensions");
|
||||
$data["editKeyboardShortcuts"] = $this->yellow->system->get("editKeyboardShortcuts");
|
||||
$data["editToolbarButtons"] = $this->getToolbarButtons("edit");
|
||||
$data["emojiawesomeToolbarButtons"] = $this->getToolbarButtons("emojiawesome");
|
||||
$data["fontawesomeToolbarButtons"] = $this->getToolbarButtons("fontawesome");
|
||||
$data["editToolbarButtons"] = $this->getToolbarButtons();
|
||||
$data["editStatusValues"] = $this->getStatusValues();
|
||||
$data["emojiawesomeToolbarButtons"] = $this->yellow->system->get("emojiawesomeToolbarButtons");
|
||||
$data["fontawesomeToolbarButtons"] = $this->yellow->system->get("fontawesomeToolbarButtons");
|
||||
if ($this->isUserAccess("system")) {
|
||||
$data["sitename"] = $this->yellow->system->get("sitename");
|
||||
$data["author"] = $this->yellow->system->get("author");
|
||||
|
@ -1226,23 +1227,27 @@ class YellowEditResponse {
|
|||
}
|
||||
|
||||
// Return toolbar buttons
|
||||
public function getToolbarButtons($name) {
|
||||
if ($name=="edit") {
|
||||
$toolbarButtons = $this->yellow->system->get("editToolbarButtons");
|
||||
if ($toolbarButtons=="auto") {
|
||||
$toolbarButtons = "";
|
||||
if ($this->yellow->extensions->isExisting("markdown")) $toolbarButtons = "format, bold, italic, strikethrough, code, separator, list, link, file";
|
||||
if ($this->yellow->extensions->isExisting("emojiawesome")) $toolbarButtons .= ", emojiawesome";
|
||||
if ($this->yellow->extensions->isExisting("fontawesome")) $toolbarButtons .= ", fontawesome";
|
||||
if ($this->yellow->extensions->isExisting("draft")) $toolbarButtons .= ", draft";
|
||||
$toolbarButtons .= ", preview";
|
||||
}
|
||||
} else {
|
||||
$toolbarButtons = $this->yellow->system->get("{$name}ToolbarButtons");
|
||||
public function getToolbarButtons() {
|
||||
$toolbarButtons = $this->yellow->system->get("editToolbarButtons");
|
||||
if ($toolbarButtons=="auto") {
|
||||
$toolbarButtons = "";
|
||||
if ($this->yellow->extensions->isExisting("markdown")) $toolbarButtons = "format, bold, italic, strikethrough, code, separator, list, link, file";
|
||||
if ($this->yellow->extensions->isExisting("emojiawesome")) $toolbarButtons .= ", emojiawesome";
|
||||
if ($this->yellow->extensions->isExisting("fontawesome")) $toolbarButtons .= ", fontawesome";
|
||||
$toolbarButtons .= ", status, preview";
|
||||
}
|
||||
return $toolbarButtons;
|
||||
}
|
||||
|
||||
// Return status values
|
||||
public function getStatusValues() {
|
||||
$statusValues = "";
|
||||
if ($this->yellow->extensions->isExisting("private")) $statusValues .= ", private";
|
||||
if ($this->yellow->extensions->isExisting("draft")) $statusValues .= ", draft";
|
||||
$statusValues .= ", unlisted";
|
||||
return ltrim($statusValues, ", ");
|
||||
}
|
||||
|
||||
// Return end of line format
|
||||
public function getEndOfLine($rawData = "") {
|
||||
$endOfLine = $this->yellow->system->get("editEndOfLine");
|
||||
|
|
Binary file not shown.
Loading…
Add table
Reference in a new issue