mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-20 17:15:51 +02:00
Removed unnecessary files from old CK4 plugin.
This commit is contained in:
parent
62c2d98abd
commit
45db4314f7
24 changed files with 0 additions and 784 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,158 +0,0 @@
|
|||
/**
|
||||
* A markdown output plugin for CKEDITOR.
|
||||
* Uses showdown.js for conversion and DOMPurifier for HTML filtering.
|
||||
*
|
||||
* This software is licensed under MIT License.
|
||||
*
|
||||
* Copyright (c) 2019 Jan Böhmer
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
function overrideDataProcessor(editor)
|
||||
{
|
||||
//Both showdown and DOMPurify must be loaded
|
||||
if(typeof(showdown) == 'undefined') return;
|
||||
if (typeof(DOMPurify) == 'undefined') return;
|
||||
|
||||
//If the dataprocessor were already be overriden do nothing
|
||||
if(editor.dataProcessor.markdown) return;
|
||||
|
||||
var converter = new showdown.Converter();
|
||||
//Set some useful options on Showdown
|
||||
converter.setFlavor('github');
|
||||
converter.setOption('tables', true);
|
||||
converter.setOption('strikethrough', true);
|
||||
converter.setOption('parseImgDimensions', true);
|
||||
converter.setOption('smartIndentationFix', true);
|
||||
|
||||
editor.dataProcessor = {
|
||||
toDataFormat: function(html, fixForBody) {
|
||||
//html = html.replace(/(\r\n|\n|\r)/gm,"");
|
||||
html = html.replace('<br>', '\n');
|
||||
//Support for strikethrough in markdown
|
||||
html = html.replace('<s>', '<del>').replace('</s>', '</del>');
|
||||
return converter.makeMarkdown(html);
|
||||
},
|
||||
toHtml: function(data){
|
||||
//Convert markdown to HTML and remove unsafe things from it.
|
||||
var unsafe = converter.makeHtml(data);
|
||||
return DOMPurify.sanitize(unsafe);
|
||||
},
|
||||
//Mark this dataprocessor
|
||||
markdown: true
|
||||
};
|
||||
|
||||
//Set the original data
|
||||
if(editor.markdown_unchangedData) {
|
||||
editor.setData(editor.markdown_unchangedData);
|
||||
editor.markdown_unchangedData = null;
|
||||
}
|
||||
}
|
||||
|
||||
CKEDITOR.plugins.add( 'markdown', {
|
||||
//requires: 'entities',
|
||||
|
||||
onLoad: function() {
|
||||
|
||||
CKEDITOR.addCss(
|
||||
//Show borders on tables generated by Showdown
|
||||
'table {\n' +
|
||||
' border-width: 1px 0 0 1px;\n' +
|
||||
' border-color: #bbb;\n' +
|
||||
' border-style: solid;\n' +
|
||||
' }\n' +
|
||||
'\n' +
|
||||
'table td, table th {\n' +
|
||||
' border-width: 0 1px 1px 0;\n' +
|
||||
' border-color: #bbb;\n' +
|
||||
' border-style: solid;\n' +
|
||||
' padding: 10px;\n' +
|
||||
'}' +
|
||||
//Show code blocks
|
||||
'pre {\n' +
|
||||
' display: block;\n' +
|
||||
' padding: 9.5px;\n' +
|
||||
' margin: 0 0 10px;\n' +
|
||||
' font-size: 13px;\n' +
|
||||
' line-height: 1.42857143;\n' +
|
||||
' color: #333;\n' +
|
||||
' word-break: break-all;\n' +
|
||||
' word-wrap: break-word;\n' +
|
||||
' background-color: #f5f5f5;\n' +
|
||||
' border: 1px solid #ccc;\n' +
|
||||
' border-radius: 4px;\n' +
|
||||
'}' +
|
||||
'padding: 0;\n' +
|
||||
' font-size: inherit;\n' +
|
||||
' color: inherit;\n' +
|
||||
' white-space: pre-wrap;\n' +
|
||||
' background-color: transparent;\n' +
|
||||
' border-radius: 0;' +
|
||||
'code, kbd, pre, samp {\n' +
|
||||
' font-family: Menlo, Monaco, Consolas, "Courier New", monospace;\n' +
|
||||
'}' +
|
||||
//Show images small
|
||||
'img {\n' +
|
||||
' max-width: 35%;\n' +
|
||||
' vertical-align: middle;' +
|
||||
'}'
|
||||
);
|
||||
},
|
||||
|
||||
beforeInit: function( editor ) {
|
||||
var config = editor.config;
|
||||
|
||||
CKEDITOR.tools.extend( config, {
|
||||
basicEntities: false,
|
||||
entities: false,
|
||||
fillEmptyBlocks: false
|
||||
}, true );
|
||||
|
||||
editor.filter.disable();
|
||||
},
|
||||
|
||||
init: function( editor ) {
|
||||
var config = editor.config;
|
||||
|
||||
var rootPath = this.path;
|
||||
//We override the dataprocessor later (after we loaded the needes scripts), sow we need the save untouched data now.
|
||||
editor.markdown_unchangedData = editor.getData();
|
||||
|
||||
if (typeof(showdown) == 'undefined') {
|
||||
CKEDITOR.scriptLoader.load(rootPath + 'js/showdown.min.js', function() {
|
||||
overrideDataProcessor(editor);
|
||||
}, CKEDITOR, true);
|
||||
}
|
||||
|
||||
if (typeof(DOMPurify) == 'undefined') {
|
||||
CKEDITOR.scriptLoader.load(rootPath + 'js/purify.min.js', function() {
|
||||
overrideDataProcessor()
|
||||
}, CKEDITOR, true);
|
||||
}
|
||||
},
|
||||
|
||||
afterInit: function( editor ) {
|
||||
//Override the data processor with our for Markdown.
|
||||
overrideDataProcessor(editor);
|
||||
}
|
||||
} );
|
||||
} )();
|
Binary file not shown.
Before Width: | Height: | Size: 2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB |
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'partdb_label', 'de', {
|
||||
title: 'Platzhalter einfügen',
|
||||
label: 'Platzhalter',
|
||||
'section.global': 'Global',
|
||||
'section.part': 'Bauteil',
|
||||
'section.part_lot': 'Bauteilbestand',
|
||||
'section.storelocation': 'Lagerort',
|
||||
'part.id': 'Datenbank ID',
|
||||
'part.name': 'Bauteilename',
|
||||
'part.category': 'Kategorie',
|
||||
'part.category_full': 'Kategorie (Ganzer Pfad)',
|
||||
'part.manufacturer': 'Hersteller',
|
||||
'part.manufacturer_full': 'Hersteller (Ganzer Pfad)',
|
||||
'part.footprint': 'Footprint',
|
||||
'part.footprint_full': 'Footprint (Ganzer Pfad)',
|
||||
'part.mass': 'Gewicht',
|
||||
'part.tags': 'Tags',
|
||||
'part.mpn': 'Herstellernummer (MPN)',
|
||||
'part.status': 'Herstellungsstatus',
|
||||
'part.description': 'Beschreibung',
|
||||
'part.description_t': 'Beschreibung (Text)',
|
||||
'part.comment': 'Kommentar',
|
||||
'part.comment_t': 'Kommentar (Text)',
|
||||
'part.last_modified': 'Änderungsdatum',
|
||||
'part.creation_date': 'Erstellungsdatum',
|
||||
'global.username': 'Benutzername',
|
||||
'global.username_full': 'Benutzername (inklusive Name)',
|
||||
'global.datetime': 'Datum & Uhrzeit',
|
||||
'global.date': 'Datum',
|
||||
'global.time': 'Uhrzeit',
|
||||
'global.install_name': 'Installationsname',
|
||||
'global.type': 'Zieltyp',
|
||||
'lot.id': 'Lot ID',
|
||||
'lot.name': 'Lot Name',
|
||||
'lot.comment': 'Lot Kommentar',
|
||||
'lot.expiration_date': 'Ablaufdatum',
|
||||
'lot.amount': 'Bestandsmenge',
|
||||
'lot.location': 'Lagerort',
|
||||
'lot.location_full': 'Lagerort (Ganzer Pfad)',
|
||||
|
||||
'storelocation.id': 'Lagerort ID',
|
||||
'storelocation.name': 'Name',
|
||||
'storelocation.full_path': 'Ganzer Pfad',
|
||||
'storelocation.parent_name': 'Name des Übergeordneten Elements',
|
||||
'storelocation.parent_full_path': 'Ganzer Pfad des Übergeordneten Elements',
|
||||
'storelocation.comment': 'Kommentar',
|
||||
'storelocation.comment_t': 'Kommentar (Text)',
|
||||
'storelocation.last_modified': 'Änderungsdatum',
|
||||
'storelocation.creation_date': 'Erstellungsdatum',
|
||||
} );
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
CKEDITOR.plugins.setLang( 'partdb_label', 'en', {
|
||||
title: 'Insert Placeholders',
|
||||
label: 'Placeholders',
|
||||
'section.global': 'Globals',
|
||||
'section.part': 'Part',
|
||||
'section.part_lot': 'Part lot',
|
||||
'section.storelocation': 'Storage location',
|
||||
'part.id': 'Database ID',
|
||||
'part.name': 'Part name',
|
||||
'part.category': 'Category',
|
||||
'part.category_full': 'Category (Full path)',
|
||||
'part.manufacturer': 'Manufacturer',
|
||||
'part.manufacturer_full': 'Manufacturer (Full path)',
|
||||
'part.footprint': 'Footprint',
|
||||
'part.footprint_full': 'Footprint (Full path)',
|
||||
'part.mass': 'Mass',
|
||||
'part.tags': 'Tags',
|
||||
'part.mpn': 'Manufacturer Product Number (MPN)',
|
||||
'part.status': 'Manufacturing status',
|
||||
'part.description': 'Description',
|
||||
'part.description_t': 'Description (Text)',
|
||||
'part.comment': 'Comment',
|
||||
'part.comment_t': 'Comment (Text)',
|
||||
'part.last_modified': 'Last modified datetime',
|
||||
'part.creation_date': 'Creation datetime',
|
||||
'global.username': 'Username',
|
||||
'global.username_full': 'Username (including name)',
|
||||
'global.datetime': 'Current datetime',
|
||||
'global.date': 'Current date',
|
||||
'global.time': 'Current time',
|
||||
'global.install_name': 'Instance name',
|
||||
'global.type': 'Target type',
|
||||
'lot.id': 'Lot ID',
|
||||
'lot.name': 'Lot name',
|
||||
'lot.comment': 'Lot comment',
|
||||
'lot.expiration_date': 'Expiration date',
|
||||
'lot.amount': 'Lot amount',
|
||||
'lot.location': 'Storage location',
|
||||
'lot.location_full': 'Storage location (Full path)',
|
||||
|
||||
'storelocation.id': 'Location ID',
|
||||
'storelocation.name': 'Name',
|
||||
'storelocation.full_path': 'Full path',
|
||||
'storelocation.parent_name': 'Parent name',
|
||||
'storelocation.parent_full_path': 'Parent full path',
|
||||
'storelocation.comment': 'Comment',
|
||||
'storelocation.comment_t': 'Comment (Text)',
|
||||
'storelocation.last_modified': 'Last modified datetime',
|
||||
'storelocation.creation_date': 'Createion datetime',
|
||||
} );
|
|
@ -1,209 +0,0 @@
|
|||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Placeholder logic inspired by CKEDITOR placeholder plugin (https://github.com/ckeditor/ckeditor4/blob/master/plugins/placeholder/plugin.js)
|
||||
*/
|
||||
|
||||
const PLACEHOLDERS = {
|
||||
part: {
|
||||
label: 'section.part',
|
||||
entries: [
|
||||
['[[ID]]', 'part.id'],
|
||||
['[[NAME]]', 'part.name'],
|
||||
['[[CATEGORY]]', 'part.category'],
|
||||
['[[CATEGORY_FULL]]', 'part.category_full'],
|
||||
['[[MANUFACTURER]]', 'part.manufacturer'],
|
||||
['[[MANUFACTURER_FULL]]', 'part.manufacturer_full'],
|
||||
['[[FOOTPRINT]]', 'part.footprint'],
|
||||
['[[FOOTPRINT_FULL]]', 'part.footprint'],
|
||||
['[[MASS]]', 'part.mass'],
|
||||
['[[MPN]]', 'part.mpn'],
|
||||
['[[TAGS]]', 'part.tags'],
|
||||
['[[M_STATUS]]', 'part.status'],
|
||||
['[[DESCRIPTION]]', 'part.description'],
|
||||
['[[DESCRIPTION_T]]', 'part.description_t'],
|
||||
['[[COMMENT]]', 'part.comment'],
|
||||
['[[COMMENT_T]]', 'part.comment_t'],
|
||||
['[[LAST_MODIFIED]]', 'part.last_modified'],
|
||||
['[[CREATION_DATE]]', 'part.creation_date'],
|
||||
]
|
||||
},
|
||||
part_lot: {
|
||||
label: 'section.part_lot',
|
||||
entries: [
|
||||
['[[LOT_ID]]', 'lot.id'],
|
||||
['[[LOT_NAME]]', 'lot.name'],
|
||||
['[[LOT_COMMENT]]', 'lot.comment'],
|
||||
['[[EXPIRATION_DATE]]', 'lot.expiration_date'],
|
||||
['[[AMOUNT]]', 'lot.amount'],
|
||||
['[[LOCATION]]', 'lot.location'],
|
||||
['[[LOCATION_FULL]]', 'lot.location_full'],
|
||||
]
|
||||
},
|
||||
storelocation: {
|
||||
label: 'section.storelocation',
|
||||
entries: [
|
||||
['[[ID]]', 'storelocation.id'],
|
||||
['[[NAME]]', 'storelocation.name'],
|
||||
['[[FULL_PATH]]', 'storelocation.full_path'],
|
||||
['[[PARENT]]', 'storelocation.parent_name'],
|
||||
['[[PARENT_FULL_PATH]]', 'storelocation.parent_full_path'],
|
||||
['[[COMMENT]]', 'storelocation.comment'],
|
||||
['[[COMMENT_T]]', 'storelocation.comment_t'],
|
||||
['[[LAST_MODIFIED]]', 'storelocation.last_modified'],
|
||||
['[[CREATION_DATE]]', 'storelocation.creation_date'],
|
||||
]
|
||||
},
|
||||
global: {
|
||||
label: 'section.global',
|
||||
entries: [
|
||||
['[[USERNAME]]', 'global.username'],
|
||||
['[[USERNAME_FULL]]', 'global.username_full'],
|
||||
['[[DATETIME]]', 'global.datetime'],
|
||||
['[[DATE]]', 'global.date'],
|
||||
['[[TIME]]', 'global.time'],
|
||||
['[[INSTALL_NAME]]', 'global.install_name'],
|
||||
['[[TYPE]]', 'global.type']
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
function findLabelForPlaceholder(search)
|
||||
{
|
||||
for (var group in PLACEHOLDERS) {
|
||||
var entries = PLACEHOLDERS[group].entries;
|
||||
for (var placeholder in entries) {
|
||||
if (entries[placeholder][0] == search) {
|
||||
return entries[placeholder][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Dont escape text inside of twig blocks
|
||||
CKEDITOR.config.protectedSource.push(/\{\{[\s\S]*?\}\}/g);
|
||||
CKEDITOR.config.protectedSource.push(/\{\%[\s\S]*?%\}/g);
|
||||
|
||||
CKEDITOR.plugins.add('partdb_label', {
|
||||
hidpi: true,
|
||||
icons: 'placeholder',
|
||||
lang: ['en', 'de'],
|
||||
init: function (editor) {
|
||||
var config = editor.config,
|
||||
lang = editor.lang.partdb_label;
|
||||
|
||||
var pluginDirectory = this.path;
|
||||
editor.addContentsCss( pluginDirectory + 'styles/style.css' );
|
||||
|
||||
// Put ur init code here.
|
||||
editor.widgets.add( 'placeholder', {
|
||||
// Widget code.
|
||||
pathName: lang.label,
|
||||
// We need to have wrapping element, otherwise there are issues in
|
||||
// add dialog.
|
||||
template: '<span class="cke_placeholder">[[]]</span>',
|
||||
|
||||
downcast: function() {
|
||||
return new CKEDITOR.htmlParser.text( '[[' + this.data.name + ']]' );
|
||||
},
|
||||
|
||||
init: function() {
|
||||
// Note that placeholder markup characters are stripped for the name.
|
||||
this.setData( 'name', this.element.getText().slice( 2, -2 ) );
|
||||
},
|
||||
|
||||
data: function() {
|
||||
this.element.setText( '[[' + this.data.name + ']]' );
|
||||
var title = findLabelForPlaceholder( '[[' + this.data.name + ']]');
|
||||
if (lang[title]) {
|
||||
title = lang[title];
|
||||
}
|
||||
this.element.setAttribute('title', title);
|
||||
},
|
||||
|
||||
getLabel: function() {
|
||||
return this.editor.lang.widget.label.replace( /%1/, this.data.name + ' ' + this.pathName );
|
||||
}
|
||||
} );
|
||||
|
||||
editor.ui.addRichCombo('Placeholders', {
|
||||
label: lang.label,
|
||||
title: lang.title,
|
||||
allowedContent: 'abbr[title]',
|
||||
panel: {
|
||||
css: [ CKEDITOR.skin.getPath( 'editor' ) ].concat( config.contentsCss ),
|
||||
multiSelect: false,
|
||||
attributes: { 'aria-label': lang.title }
|
||||
},
|
||||
init: function () {
|
||||
for (var group in PLACEHOLDERS) {
|
||||
var localized_group = PLACEHOLDERS[group].label;
|
||||
if (lang[localized_group]) {
|
||||
localized_group = lang[localized_group];
|
||||
}
|
||||
this.startGroup(localized_group);
|
||||
var entries = PLACEHOLDERS[group].entries;
|
||||
for (var placeholder in entries) {
|
||||
var localized_placeholder = entries[placeholder][1];
|
||||
if (lang[localized_placeholder]) {
|
||||
localized_placeholder = lang[localized_placeholder];
|
||||
}
|
||||
this.add(entries[placeholder][0], localized_placeholder, entries[placeholder][0])
|
||||
}
|
||||
}
|
||||
},
|
||||
onClick: function(value) {
|
||||
editor.focus();
|
||||
editor.fire('saveSnapshot');
|
||||
editor.insertText(value);
|
||||
}
|
||||
});
|
||||
},
|
||||
afterInit: function( editor ) {
|
||||
var placeholderReplaceRegex = /\[\[([^\[\]])+\]\]/g;
|
||||
|
||||
editor.dataProcessor.dataFilter.addRules({
|
||||
text: function (text, node) {
|
||||
var dtd = node.parent && CKEDITOR.dtd[node.parent.name];
|
||||
|
||||
// Skip the case when placeholder is in elements like <title> or <textarea>
|
||||
// but upcast placeholder in custom elements (no DTD).
|
||||
if (dtd && !dtd.span)
|
||||
return;
|
||||
|
||||
return text.replace(placeholderReplaceRegex, function (match) {
|
||||
// Creating widget code.
|
||||
var widgetWrapper = null,
|
||||
innerElement = new CKEDITOR.htmlParser.element('span', {
|
||||
'class': 'cke_placeholder'
|
||||
});
|
||||
|
||||
// Adds placeholder identifier as innertext.
|
||||
innerElement.add(new CKEDITOR.htmlParser.text(match));
|
||||
widgetWrapper = editor.widgets.wrapElement(innerElement, 'placeholder');
|
||||
|
||||
// Return outerhtml of widget wrapper so it will be placed
|
||||
// as replacement.
|
||||
return widgetWrapper.getOuterHtml();
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,117 +0,0 @@
|
|||
/*
|
||||
* This file is part of Part-DB (https://github.com/Part-DB/Part-DB-symfony).
|
||||
*
|
||||
* Copyright (C) 2019 - 2020 Jan Böhmer (https://github.com/jbtronics)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as published
|
||||
* by the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans Mono";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local(DejaVu Sans Mono), local(DejaVuSansMono),
|
||||
url(DejaVuSansMono.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans Mono";
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
src: local(DejaVu Sans Mono Bold), local(DejaVuSansMono-Bold),
|
||||
url(DejaVuSansMono-Bold.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans Mono";
|
||||
font-style: oblique;
|
||||
font-weight: bold;
|
||||
src: local(DejaVu Sans Mono Bold Oblique), local(DejaVuSansMono-BoldOblique),
|
||||
url(DejaVuSansMono-BoldOblique.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans Mono";
|
||||
font-style: oblique;
|
||||
font-weight: normal;
|
||||
src: local(DejaVu Sans Mono Oblique), local(DejaVuSansMono-Oblique),
|
||||
url(DejaVuSansMono-Oblique.woff) format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local(DejaVu Sans), local(DejaVuSans),
|
||||
url(DejaVuSans.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans";
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
src: local(DejaVu Sans Bold), local(DejaVuSans-Bold),
|
||||
url(DejaVuSans-Bold.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans";
|
||||
font-style: oblique;
|
||||
font-weight: bold;
|
||||
src: local(DejaVu Sans Bold Oblique), local(DejaVuSans-BoldOblique),
|
||||
url(DejaVuSans-BoldOblique.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Sans";
|
||||
font-style: oblique;
|
||||
font-weight: normal;
|
||||
src: local(DejaVu Sans Oblique), local(DejaVuSans-Oblique),
|
||||
url(DejaVuSans-Oblique.woff) format("woff");
|
||||
}
|
||||
|
||||
@font-face {
|
||||
font-family: "DejaVu Serif";
|
||||
font-style: normal;
|
||||
font-weight: normal;
|
||||
src: local(DejaVu Serif), local(DejaVuSerif),
|
||||
url(DejaVuSerif.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Serif";
|
||||
font-style: normal;
|
||||
font-weight: bold;
|
||||
src: local(DejaVu Serif Bold), local(DejaVuSerif-Bold),
|
||||
url(DejaVuSerif-Bold.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Serif";
|
||||
font-style: italic;
|
||||
font-weight: bold;
|
||||
src: local(DejaVu Serif Bold Italic), local(DejaVuSerif-BoldItalic),
|
||||
url(DejaVuSerif-BoldItalic.woff) format("woff");
|
||||
}
|
||||
@font-face {
|
||||
font-family: "DejaVu Serif";
|
||||
font-style: italic;
|
||||
font-weight: normal;
|
||||
src: local(DejaVu Serif Italic), local(DejaVuSerif-Italic),
|
||||
url(DejaVuSerif-Italic.woff) format("woff");
|
||||
}
|
||||
|
||||
|
||||
.cke_placeholder {
|
||||
background-color:#ff0
|
||||
}
|
||||
|
||||
.cke_editable {
|
||||
font-family: "DejaVu Sans Mono";
|
||||
font-size: 9pt;
|
||||
line-height: 1.5;
|
||||
}
|
|
@ -1,52 +0,0 @@
|
|||
|
||||
CKEDITOR.dialog.add( 'showProtectedDialog', function( editor ) {
|
||||
|
||||
return {
|
||||
title: 'Edit Protected Source',
|
||||
minWidth: 300,
|
||||
minHeight: 60,
|
||||
onOk: function() {
|
||||
var newSourceValue = this.getContentElement( 'info', 'txtProtectedSource' ).getValue();
|
||||
|
||||
var encodedSourceValue = CKEDITOR.plugins.showprotected.encodeProtectedSource( newSourceValue );
|
||||
|
||||
this._.selectedElement.setAttribute('data-cke-realelement', encodedSourceValue);
|
||||
this._.selectedElement.setAttribute('title', newSourceValue);
|
||||
this._.selectedElement.setAttribute('alt', newSourceValue);
|
||||
},
|
||||
|
||||
onHide: function() {
|
||||
delete this._.selectedElement;
|
||||
},
|
||||
|
||||
onShow: function() {
|
||||
this._.selectedElement = editor.getSelection().getSelectedElement();
|
||||
|
||||
var decodedSourceValue = CKEDITOR.plugins.showprotected.decodeProtectedSource( this._.selectedElement.getAttribute('data-cke-realelement') );
|
||||
|
||||
this.setValueOf( 'info', 'txtProtectedSource', decodedSourceValue );
|
||||
},
|
||||
contents: [
|
||||
{
|
||||
id: 'info',
|
||||
label: 'Edit Protected Source',
|
||||
accessKey: 'I',
|
||||
elements: [
|
||||
{
|
||||
type: 'text',
|
||||
id: 'txtProtectedSource',
|
||||
label: 'Value',
|
||||
required: true,
|
||||
validate: function() {
|
||||
if ( !this.getValue() ) {
|
||||
alert( 'The value cannot be empty' );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
} );
|
Binary file not shown.
Before Width: | Height: | Size: 278 B |
|
@ -1,105 +0,0 @@
|
|||
/*
|
||||
* "showprotected" CKEditor plugin
|
||||
*
|
||||
* Created by Matthew Lieder (https://github.com/IGx89)
|
||||
*
|
||||
* Licensed under the MIT, GPL, LGPL and MPL licenses
|
||||
*
|
||||
* Icon courtesy of famfamfam: http://www.famfamfam.com/lab/icons/mini/
|
||||
*/
|
||||
|
||||
// TODO: configuration settings
|
||||
// TODO: show the actual text inline, not just an icon?
|
||||
// TODO: improve copy/paste behavior (tooltip is wrong after paste)
|
||||
|
||||
CKEDITOR.plugins.add( 'showprotected', {
|
||||
requires: 'dialog,fakeobjects',
|
||||
onLoad: function() {
|
||||
// Add the CSS styles for protected source placeholders.
|
||||
var iconPath = CKEDITOR.getUrl( this.path + 'images' + '/code.gif' ),
|
||||
baseStyle = 'background:url(' + iconPath + ') no-repeat %1 center;border:1px dotted #00f;background-size:16px;';
|
||||
|
||||
var template = '.%2 img.cke_protected' +
|
||||
'{' +
|
||||
baseStyle +
|
||||
'width:16px;' +
|
||||
'min-height:15px;' +
|
||||
// The default line-height on IE.
|
||||
'height:1.15em;' +
|
||||
// Opera works better with "middle" (even if not perfect)
|
||||
'vertical-align:' + ( CKEDITOR.env.opera ? 'middle' : 'text-bottom' ) + ';' +
|
||||
'}';
|
||||
|
||||
// Styles with contents direction awareness.
|
||||
function cssWithDir( dir ) {
|
||||
return template.replace( /%1/g, dir == 'rtl' ? 'right' : 'left' ).replace( /%2/g, 'cke_contents_' + dir );
|
||||
}
|
||||
|
||||
CKEDITOR.addCss( cssWithDir( 'ltr' ) + cssWithDir( 'rtl' ) );
|
||||
},
|
||||
|
||||
init: function( editor ) {
|
||||
CKEDITOR.dialog.add( 'showProtectedDialog', this.path + 'dialogs/protected.js' );
|
||||
|
||||
editor.on( 'doubleclick', function( evt ) {
|
||||
var element = evt.data.element;
|
||||
|
||||
if ( element.is( 'img' ) && element.hasClass( 'cke_protected' ) ) {
|
||||
evt.data.dialog = 'showProtectedDialog';
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
afterInit: function( editor ) {
|
||||
// Register a filter to displaying placeholders after mode change.
|
||||
|
||||
var dataProcessor = editor.dataProcessor,
|
||||
dataFilter = dataProcessor && dataProcessor.dataFilter;
|
||||
|
||||
if ( dataFilter ) {
|
||||
dataFilter.addRules( {
|
||||
comment: function( commentText, commentElement ) {
|
||||
if(commentText.indexOf(CKEDITOR.plugins.showprotected.protectedSourceMarker) == 0) {
|
||||
commentElement.attributes = [];
|
||||
var fakeElement = editor.createFakeParserElement( commentElement, 'cke_protected', 'protected' );
|
||||
|
||||
var cleanedCommentText = CKEDITOR.plugins.showprotected.decodeProtectedSource( commentText );
|
||||
fakeElement.attributes.title = fakeElement.attributes.alt = cleanedCommentText;
|
||||
|
||||
return fakeElement;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
} );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Set of showprotected plugin's helpers.
|
||||
*
|
||||
* @class
|
||||
* @singleton
|
||||
*/
|
||||
CKEDITOR.plugins.showprotected = {
|
||||
|
||||
protectedSourceMarker: '{cke_protected}',
|
||||
|
||||
decodeProtectedSource: function( protectedSource ) {
|
||||
if(protectedSource.indexOf('%3C!--') == 0) {
|
||||
return decodeURIComponent(protectedSource).replace( /<!--\{cke_protected\}([\s\S]+?)-->/g, function( match, data ) {
|
||||
return decodeURIComponent( data );
|
||||
} );
|
||||
} else {
|
||||
return decodeURIComponent(protectedSource.substr(CKEDITOR.plugins.showprotected.protectedSourceMarker.length));
|
||||
}
|
||||
},
|
||||
|
||||
encodeProtectedSource: function( protectedSource ) {
|
||||
return '<!--' + CKEDITOR.plugins.showprotected.protectedSourceMarker +
|
||||
encodeURIComponent( protectedSource ).replace( /--/g, '%2D%2D' ) +
|
||||
'-->';
|
||||
}
|
||||
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue