Allow to choose between the different fonts in CKEDITOR.

This commit is contained in:
Jan Böhmer 2020-04-25 19:19:12 +02:00
parent 74b1b7acf5
commit 2768eb1745
15 changed files with 128 additions and 5 deletions

View file

@ -22,6 +22,13 @@ fos_ck_editor:
enterMode: 2 enterMode: 2
toolbar: label_toolbar toolbar: label_toolbar
extraPlugins: "partdb_label" extraPlugins: "partdb_label"
font_names: >
DejaVu Sans Mono/DejaVu Sans Mono;
DejaVu Sans/DejaVu Sans;
DejaVu Serif/DejaVu Serif;
Helvetica/Helvetica, Arial, sans-serif;
Times New Roman/Times New Roman, Times, serif;
Courier New/Courier New, Courier, monospace;
plugins: plugins:
bbcode: bbcode:
@ -46,7 +53,7 @@ fos_ck_editor:
- ["SpecialChar"] - ["SpecialChar"]
- ["Source"] - ["Source"]
- "/" - "/"
- ['Format', 'FontSize'] - ['Format', 'FontSize', 'Font']
- ['Table', 'HorizontalRule'] - ['Table', 'HorizontalRule']
- ['Placeholders'] - ['Placeholders']
description_toolbar: description_toolbar:

View file

@ -87,14 +87,13 @@ CKEDITOR.plugins.add('partdb_label', {
hidpi: true, hidpi: true,
icons: 'placeholder', icons: 'placeholder',
lang: ['en', 'de'], lang: ['en', 'de'],
onLoad: function() {
// Register styles for placeholder widget frame.
CKEDITOR.addCss( '.cke_placeholder{background-color:#ff0}' );
},
init: function (editor) { init: function (editor) {
var config = editor.config, var config = editor.config,
lang = editor.lang.partdb_label; lang = editor.lang.partdb_label;
var pluginDirectory = this.path;
editor.addContentsCss( pluginDirectory + 'styles/style.css' );
// Put ur init code here. // Put ur init code here.
editor.widgets.add( 'placeholder', { editor.widgets.add( 'placeholder', {
// Widget code. // Widget code.

View file

@ -0,0 +1,117 @@
/*
* 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;
}