Skip to content
Code-Schnipsel Gruppen Projekte
Commit c29a4a17 erstellt von Florian Bogner's avatar Florian Bogner
Dateien durchsuchen

Merge branch 'dev'

Übergeordnete 34605f8d 0baf7484
Keine zugehörigen Branchen gefunden
Keine zugehörigen Tags gefunden
1 Merge Request!8fix: display CKE notifications on the center of the page
......@@ -122,7 +122,6 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
Textarea = false,
size = Container.getSize();
if (!Container.getElement('textarea')) {
Textarea = new Element('textarea', {
id : self.getId(),
......@@ -233,15 +232,20 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
var pluginPath = config.pluginPath;
var extraPlugins = plugins.join(",");
var i, len, pluginName;
for (i = 0, len = plugins.length; i < len; i++) {
pluginName = plugins[i];
for (var i = 0, len = plugins.length; i < len; i++) {
var pluginName = plugins[i];
if (!window.CKEDITOR.plugins.get(pluginName)) {
window.CKEDITOR.plugins.addExternal(pluginName, pluginPath + "/bin/" + pluginName + "/", "");
window.CKEDITOR.plugins.addExternal(
pluginName,
pluginPath + "/bin/" + pluginName + "/",
""
);
}
}
window.CKEDITOR.replace(instance, {
skinName : 'moono-lisa',
customConfig : '',
......@@ -252,7 +256,8 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
width : width,
toolbar : toolbar,
allowedContent : true,
extraAllowedContent : 'div(*)[*]{*}; iframe(*)[*]{*}; img(*)[*]{*}; script(*)[*]{*}',
extraAllowedContent : 'div(*)[*]{*}; iframe(*)[*]{*}; img(*)[*]{*}; script(*)[*]{*}; ins(*)[*]{*}',
protectedSource : [/<ins[\s|\S]+?<\/ins>/g],
stylesSet : styles,
contentsCss : data.cssFiles || [],
bodyClass : data.bodyClass,
......@@ -260,10 +265,10 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
baseFloatZIndex : zIndex,
extraPlugins : extraPlugins,
//removePlugins : 'scayt',
disableNativeSpellChecker: config.disableNativeSpellChecker
disableNativeSpellChecker: config.disableNativeSpellChecker,
autoGrow_onStartup : false,
resize_enabled : false
});
});
},
......@@ -561,7 +566,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
extra.push('codetag');
break;
case 'Image':
extra.push('image2');
extra.push('image');
break;
case 'Zoom':
extra.push('zoom');
......@@ -650,11 +655,10 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
dialogName = ev.data.name,
dialogDefinition = ev.data.definition;
/**
* Image dialog
*/
if (dialogName != 'image') {
if (dialogName !== 'image') {
return ev;
}
......@@ -669,20 +673,24 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
// image button
var UrlGroup = this.getContentElement('info', 'txtUrl')
.getElement()
.$;
.getElement().$;
var UrlInput = UrlGroup.getElement('input[type="text"]');
var HeightInput = this.getContentElement('info', 'txtHeight')
.getElement().$
.getElement('input[type="text"]');
.getElement().$
.getElement('input[type="text"]');
var WidthInput = this.getContentElement('info', 'txtWidth')
.getElement().$
.getElement('input[type="text"]');
.getElement().$
.getElement('input[type="text"]');
UrlGroup.getElement('label').setStyles({
'float': 'left',
'width': '100%'
});
if (!UrlGroup.getElement('.qui-button')) {
Button = new Element('button', {
'class': 'qui-button',
......@@ -737,7 +745,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
// link button
var LinkGroup = this.getContentElement('Link', 'txtUrl')
.getElement()
.getElement()
.$;
......@@ -806,10 +814,10 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
orgCommit.call(this, data);
Protokoll = dialogDefinition.dialog
.getContentElement('info', 'protocol')
.getElement()
.$
.getElement('select');
.getContentElement('info', 'protocol')
.getElement()
.$
.getElement('select');
data.url = {
protocol: Protokoll.value,
......@@ -826,7 +834,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
oldOnShow.bind(this)();
var UrlGroup = this.getContentElement('info', 'url')
.getElement()
.getElement()
.$;
if (UrlGroup.getElement('.qui-button')) {
......@@ -836,9 +844,9 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
var UrlInput = UrlGroup.getElement('input[type="text"]');
Protokoll = this.getContentElement('info', 'protocol')
.getElement()
.$
.getElement('select');
.getElement()
.$
.getElement('select');
UrlInput.setStyles({
'float': 'left',
......@@ -903,7 +911,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
var self = this;
var oldOnShow = dialogDefinition.onShow || function () {
};
};
dialogDefinition.onShow = function () {
oldOnShow.bind(this)();
......@@ -967,7 +975,7 @@ define('package/quiqqer/ckeditor4/bin/Editor', [
var self = this;
var oldOnShow = dialogDefinition.onShow || function () {
};
};
dialogDefinition.onShow = function () {
oldOnShow.bind(this)();
......
......@@ -2,36 +2,25 @@
"about",
"ajax",
"autoembed",
"autogrow",
"autolink",
"balloonpanel",
"base64image",
"ckawesome",
"clipboard",
"codesnippet",
"codesnippetgeshi",
"codeTag",
"code",
"colorbutton",
"colordialog",
"crossreference",
"dialog",
"dialogadvtab",
"div",
"docprops",
"embed",
"embedbase",
"embedsemantic",
"enhancedcolorbutton",
"find",
"fixed",
"font",
"footnotes",
"html5audio",
"html5video",
"iframe",
"iframedialog",
"image",
"image2",
"indentblock",
"justify",
"language",
......@@ -40,36 +29,24 @@
"link",
"liststyle",
"magicline",
"newpage",
"notification",
"notificationaggregator",
"pagebreak",
"panelbutton",
"pastebase64",
"pastefromword",
"placeholder",
"pre",
"preview",
"print",
"save",
"qui-font-awesome",
"scayt",
"selectall",
"selectallcontextmenu",
"sharedspace",
"showblocks",
"smallerselection",
"smiley",
"sourcedialog",
"specialchar",
"stylesheetparser",
"symbol",
"table",
"tableresize",
"tabletools",
"templates",
"textselection",
"texttransform",
"uicolor",
"widget",
"widgetselection",
"wordcount",
......
Code tag in CKEditor
==============
![](http://imgur.com/LN0MAEZ.png)
Install by placing in ckeditor/plugins/ and add the following to ckeditor/config.js
config.extraPlugins = 'codeTag';
\ No newline at end of file
plugins/ckeditor4/code/icons/code.png

557 B

CKEDITOR.plugins.add( 'codeTag', {
icons: 'code',
init: function( editor ) {
editor.addCommand( 'wrapCode', {
exec: function( editor ) {
editor.insertHtml( '<code>' + editor.getSelection().getSelectedText() + '</code>' );
}
});
editor.ui.addButton( 'Code', {
label: 'Wrap code',
command: 'wrapCode',
toolbar: 'insert'
});
}
});
\ No newline at end of file
(function () {
"use strict";
console.log(CKEDITOR);
CKEDITOR.plugins.add('qui-font-awesome', {
icons: "icon",
lang : ['en', 'de'],
init : function (editor) {
console.log("Init");
this.$Editor = editor;
var self = this;
......@@ -27,11 +25,9 @@
var window = new FontAwesomeDialog({});
window.addEvent("submit", function (dialog, selected) {
console.log("Submit");
if (selected.length === 0) {
return;
}
console.log("Insert");
self.insertIcon(selected[0]);
});
......
<?php
/**
* This file contains QUI\Ckeditor\EventHandler
*/
namespace QUI\Ckeditor;
use QUI\Ckeditor\Plugins\Manager;
use QUI\Package\Package;
use QUI\System\Log;
/**
* Class EventHandler
*
* @package QUI\Ckeditor
*/
class EventHandler
{
/**
* @param Package $Package
*/
......@@ -19,7 +26,6 @@ class EventHandler
}
$PluginManager = new Manager();
$PluginManager->installPluginsFromSource();
}
......@@ -33,7 +39,6 @@ class EventHandler
}
$PluginManager = new Manager();
$PluginManager->updatePlugins();
}
}
<?php
/**
* This file contains QUI\Ckeditor\Plugins\Manager
*/
namespace QUI\Ckeditor\Plugins;
use QUI\Archiver\Zip;
use QUI;
use QUI\Exception;
use QUI\System\Log;
use QUI\Utils\Security\Orthos;
......@@ -16,13 +19,21 @@ use QUI\Utils\System\File;
*/
class Manager
{
/**
* @var string
*/
protected $activePluginDir;
/**
* @var string
*/
protected $installedPluginDir;
/**
* @var
*/
protected $dependencies;
/**
* List of plugins which should not be installed
*
......@@ -39,15 +50,15 @@ class Manager
"textselection"
);
/**
* Manager constructor.
*/
public function __construct()
{
$this->activePluginDir = \QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "/plugins/bin";
$this->installedPluginDir = \QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "/plugins/installed";
$Package = QUI::getPackage("quiqqer/ckeditor4");
$this->activePluginDir = $Package->getVarDir()."/plugins/bin";
$this->installedPluginDir = $Package->getVarDir()."/plugins/installed";
if (!is_dir($this->activePluginDir)) {
mkdir($this->activePluginDir, 0755, true);
......@@ -68,10 +79,9 @@ class Manager
public function updatePlugins()
{
$srcDirs = array(
OPT_DIR . "ckeditor/ckeditor/plugins",
OPT_DIR . "quiqqer/ckeditor4/plugins/quiqqer",
OPT_DIR . "quiqqer/ckeditor4/plugins/ckeditor4",
OPT_DIR."ckeditor/ckeditor/plugins",
OPT_DIR."quiqqer/ckeditor4/plugins/quiqqer",
OPT_DIR."quiqqer/ckeditor4/plugins/ckeditor4"
);
foreach ($srcDirs as $srcDir) {
......@@ -79,29 +89,34 @@ class Manager
return;
}
foreach (scandir($srcDir) as $entry) {
if ($entry == "." || $entry == "..") {
continue;
}
if (!is_dir($srcDir . "/" . $entry)) {
if (!is_dir($srcDir."/".$entry)) {
continue;
}
$pluginName = $entry;
// Special case, because gitlab gets confused with the dirctory named "codeTag"
if ($entry == "code") {
$pluginName = "codeTag";
}
# Check if/where the plugin is installed
$targetDir = $this->installedPluginDir . "/" . $entry;
if (is_dir($this->activePluginDir . "/" . $entry)) {
$targetDir = $this->activePluginDir . "/" . $entry;
$targetDir = $this->installedPluginDir."/".$pluginName;
if (is_dir($this->activePluginDir."/".$pluginName)) {
$targetDir = $this->activePluginDir."/".$pluginName;
}
if (is_dir($targetDir)) {
File::deleteDir($targetDir);
}
File::dircopy(
$srcDir . "/" . $entry,
$srcDir."/".$entry,
$targetDir
);
}
......@@ -115,44 +130,50 @@ class Manager
public function installPluginsFromSource()
{
$srcDirs = array(
OPT_DIR . "ckeditor/ckeditor/plugins",
OPT_DIR . "quiqqer/ckeditor4/plugins/quiqqer",
OPT_DIR . "quiqqer/ckeditor4/plugins/ckeditor4"
OPT_DIR."ckeditor/ckeditor/plugins",
OPT_DIR."quiqqer/ckeditor4/plugins/quiqqer",
OPT_DIR."quiqqer/ckeditor4/plugins/ckeditor4"
);
$activePlugins = array();
$defaultStateFile = dirname(dirname(dirname(dirname(dirname(__FILE__))))) . "/plugins/activePlugins.json";
$defaultStateFile = dirname(dirname(dirname(dirname(dirname(__FILE__)))))."/plugins/activePlugins.json";
if (file_exists($defaultStateFile)) {
$json = file_get_contents($defaultStateFile);
$activePlugins = json_decode($json, true);
}
foreach ($srcDirs as $srcDir) {
if (!is_dir($srcDir)) {
return;
}
foreach (scandir($srcDir) as $entry) {
if ($entry == "." || $entry == "..") {
continue;
}
$pluginName = $entry;
// Special case, because gitlab gets confused with the directory named "codeTag"
if ($entry == "code") {
$pluginName = "codeTag";
}
$targetDir = $this->installedPluginDir;
if (in_array($entry, $activePlugins)) {
$targetDir = $this->activePluginDir;
}
if ($entry == "." || $entry == "..") {
continue;
}
if (!is_dir($srcDir . "/" . $entry)) {
if (!is_dir($srcDir."/".$entry)) {
continue;
}
if (is_dir($this->installedPluginDir . "/" . $entry)) {
if (is_dir($this->installedPluginDir."/".$pluginName)) {
continue;
}
if (is_dir($this->activePluginDir . "/" . $entry)) {
if (is_dir($this->activePluginDir."/".$pluginName)) {
continue;
}
......@@ -160,17 +181,18 @@ class Manager
continue;
}
$this->copyDir(
$srcDir . "/" . $entry,
$targetDir . "/" . $entry
$srcDir."/".$entry,
$targetDir."/".$pluginName
);
}
}
if (file_exists(OPT_DIR . "quiqqer/ckeditor4/plugins/dependencies.json")) {
if (file_exists(OPT_DIR."quiqqer/ckeditor4/plugins/dependencies.json")) {
copy(
OPT_DIR . "quiqqer/ckeditor4/plugins/dependencies.json",
$this->getPluginDir() . "/dependencies.json"
OPT_DIR."quiqqer/ckeditor4/plugins/dependencies.json",
$this->getPluginDir()."/dependencies.json"
);
}
......@@ -187,6 +209,7 @@ class Manager
$result = array();
$content = scandir($this->installedPluginDir);
if ($content === false) {
return array();
}
......@@ -195,14 +218,13 @@ class Manager
if ($entry == "." || $entry == "..") {
continue;
}
$fullpath = $this->installedPluginDir . "/" . $entry;
$fullpath = $this->installedPluginDir."/".$entry;
if (!is_dir($fullpath)) {
continue;
}
$result[] = $entry;
}
......@@ -223,26 +245,26 @@ class Manager
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.not.found"));
}
$tmpDir = \QUI::getTemp()->createFolder();
$tmpDir = QUI::getTemp()->createFolder();
copy(
$pluginpath,
$tmpDir . "/archive.zip"
$tmpDir."/archive.zip"
);
$Zip = new \ZipArchive();
if ($Zip->open($tmpDir . "/archive.zip") === false) {
if ($Zip->open($tmpDir."/archive.zip") === false) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.invalid.format"));
}
if ($Zip->extractTo($tmpDir . "/content") === false) {
if ($Zip->extractTo($tmpDir."/content") === false) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.extract.failed"));
}
// Scan dir and remove '.' and '..'
$contents = scandir($tmpDir . "/content");
$contents = scandir($tmpDir."/content");
foreach (array_keys($contents, ".", true) as $key) {
unset($contents[$key]);
}
......@@ -267,25 +289,24 @@ class Manager
continue;
}
if (is_dir($this->installedPluginDir . "/" . $entry)) {
if (is_dir($this->installedPluginDir."/".$entry)) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.exists"));
}
if (is_dir($this->activePluginDir . "/" . $entry)) {
if (is_dir($this->activePluginDir."/".$entry)) {
throw new Exception(array("quiqqer/ckeditor4", "exception.install.file.exists"));
}
rename(
$tmpDir . "/content/" . $entry,
$this->installedPluginDir . "/" . $entry
$tmpDir."/content/".$entry,
$this->installedPluginDir."/".$entry
);
}
File::deleteDir($tmpDir);
\QUI::getMessagesHandler()->addSuccess(
\QUI::getLocale()->get(
QUI::getMessagesHandler()->addSuccess(
QUI::getLocale()->get(
"quiqqer/ckeditor4",
"message.plugin.install.success"
)
......@@ -315,15 +336,22 @@ class Manager
));
}
if (!is_dir($this->installedPluginDir . "/" . $pluginName)) {
throw new Exception(array("quiqqer/ckeditor4", "exception.plugin.activate.plugin.not.found"));
if (!is_dir($this->installedPluginDir."/".$pluginName)) {
throw new Exception(array(
"quiqqer/ckeditor4",
"exception.plugin.activate.plugin.not.found"
));
}
if (is_dir($this->activePluginDir . "/" . $pluginName)) {
throw new Exception(array("quiqqer/ckeditor4", "exception.plugin.already.active"));
if (is_dir($this->activePluginDir."/".$pluginName)) {
throw new Exception(array(
"quiqqer/ckeditor4",
"exception.plugin.already.active"
));
}
$deps = $this->getDependencies($pluginName);
foreach ($deps as $dep) {
try {
$this->activate($dep);
......@@ -331,10 +359,12 @@ class Manager
}
}
rename($this->installedPluginDir . "/" . $pluginName, $this->activePluginDir . "/" . $pluginName);
rename(
$this->installedPluginDir."/".$pluginName,
$this->activePluginDir."/".$pluginName
);
\QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data");
QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data");
}
/**
......@@ -349,12 +379,15 @@ class Manager
$pluginName = Orthos::clearPath($pluginName);
$pluginName = str_replace("/", "", $pluginName);
if (!is_dir($this->activePluginDir . "/" . $pluginName)) {
throw new Exception(array("quiqqer/ckeditor4", "exception.plugin.activate.plugin.not.active"));
if (!is_dir($this->activePluginDir."/".$pluginName)) {
throw new Exception(array(
"quiqqer/ckeditor4",
"exception.plugin.activate.plugin.not.active"
));
}
if (is_dir($this->installedPluginDir . "/" . $pluginName)) {
File::deleteDir($this->activePluginDir . "/" . $pluginName);
if (is_dir($this->installedPluginDir."/".$pluginName)) {
File::deleteDir($this->activePluginDir."/".$pluginName);
return;
}
......@@ -366,9 +399,12 @@ class Manager
}
}
rename($this->activePluginDir . "/" . $pluginName, $this->installedPluginDir . "/" . $pluginName);
rename(
$this->activePluginDir."/".$pluginName,
$this->installedPluginDir."/".$pluginName
);
\QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data");
QUI\Cache\Manager::clear("quiqqer/ckeditor/plugins/data");
}
/**
......@@ -378,9 +414,9 @@ class Manager
*/
public function getActivePlugins()
{
$result = array();
$result = array();
$content = scandir($this->activePluginDir);
if ($content === false) {
return array();
}
......@@ -389,7 +425,8 @@ class Manager
if ($entry == "." || $entry == "..") {
continue;
}
$fullpath = $this->activePluginDir . "/" . $entry;
$fullpath = $this->activePluginDir."/".$entry;
if (!is_dir($fullpath)) {
continue;
......@@ -429,12 +466,12 @@ class Manager
}
$deps = $this->dependencies[$pluginName];
foreach ($deps as $dep) {
$result[] = $dep;
$subDeps = $this->getDependencies($dep);
$result = array_merge($result, $subDeps);
$result = array_merge($result, $subDeps);
}
$result = array_unique($result);
......@@ -460,7 +497,6 @@ class Manager
return false;
}
foreach ($this->dependencies as $pkg => $deps) {
if (in_array($pluginName, $deps)) {
$result[] = $pkg;
......@@ -483,13 +519,13 @@ class Manager
return;
}
if (!file_exists($this->getPluginDir() . "/dependencies.json")) {
Log::addWarning("Missing dependency file: " . $this->getPluginDir() . "/dependencies.json");
if (!file_exists($this->getPluginDir()."/dependencies.json")) {
Log::addWarning("Missing dependency file: ".$this->getPluginDir()."/dependencies.json");
throw new Exception("missing.dependency.file");
}
$json = file_get_contents($this->getPluginDir() . "/dependencies.json");
$json = file_get_contents($this->getPluginDir()."/dependencies.json");
$deps = json_decode($json, true);
if (json_last_error() !== JSON_ERROR_NONE) {
......@@ -543,7 +579,7 @@ class Manager
*/
public function getPluginDir()
{
return \QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "/plugins";
return QUI::getPackage("quiqqer/ckeditor4")->getVarDir()."/plugins";
}
/**
......@@ -565,14 +601,14 @@ class Manager
continue;
}
$fullpath = $src . "/" . $entry;
$fullpath = $src."/".$entry;
if (is_dir($fullpath)) {
$this->copyDir($fullpath, $target . "/" . $entry);
$this->copyDir($fullpath, $target."/".$entry);
continue;
}
copy($fullpath, $target . "/" . $entry);
copy($fullpath, $target."/".$entry);
}
}
......@@ -584,7 +620,7 @@ class Manager
public function getPluginUrlPath()
{
// Build the web reachable path for the plugin directory
$pluginPath = \QUI::getPackage("quiqqer/ckeditor4")->getVarDir() . "plugins";
$pluginPath = QUI::getPackage("quiqqer/ckeditor4")->getVarDir()."plugins";
$varParent = dirname(VAR_DIR);
# Parse the URL directory
......
0% Lade oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren