Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add CSS styles to classic editor when in a Web Component #7847

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/assets/snippet-styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
* Copyright (c) 2003-2020, CKSource - Frederico Knabben. All rights reserved.
*/

:root {
:root, :host {
/* This custom property is read by the JS and passed to editor configurations
as config.toolbar.viewportTopOffset. */
--ck-snippet-viewport-top-offset: 100
}

@media (max-width: 960px) {
:root {
:root, :host {
/* The mobile layout of Umberto is different and the toolbar offset must be
smaller (https://github.com/ckeditor/ckeditor5/issues/1348). */
--ck-snippet-viewport-top-offset: 55;
Expand Down
12 changes: 12 additions & 0 deletions packages/ckeditor5-build-classic/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'use strict';

/* eslint-env node */
/* global window, document */

const path = require( 'path' );
const webpack = require( 'webpack' );
Expand Down Expand Up @@ -72,6 +73,17 @@ module.exports = {
injectType: 'singletonStyleTag',
attributes: {
'data-cke': true
},
// In order to support CKEditor running in a shadow root, save all of the style elements into an
// array so that they can be added to a shadow root by accessing the array. If the style elements
// were only added to the document head (the default behavior of style-loader), the styles would
// not get applied to an editor in a shadow root due to style encapsulation.
insert: function addToStyles( styleElement ) {
if ( !window.ckeStylesToInject ) {
window.ckeStylesToInject = [];
}
window.ckeStylesToInject.push( styleElement );
document.head.prepend( styleElement );
}
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-highlight/theme/highlight.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-highlight-marker-yellow: hsl(60, 97%, 73%);
--ck-highlight-marker-green: hsl(120, 93%, 68%);
--ck-highlight-marker-pink: hsl(345, 96%, 73%);
Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-image/theme/imagestyle.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-image-style-spacing: 1.5em;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-list/theme/todolist.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-todo-list-checkmark-size: 16px;
}

Expand Down
2 changes: 1 addition & 1 deletion packages/ckeditor5-mention/theme/mentionui.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-mention-list-max-height: 300px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host{
/* Overrides the border radius setting in the theme. */
--ck-border-radius: 4px;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-code-block-label-background: hsl(0, 0%, 46%);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-image-upload-icon: hsl(0, 0%, 100%);
--ck-color-image-upload-icon-background: hsl(120, 100%, 27%);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-upload-placeholder-loader: hsl(0, 0%, 70%);
--ck-upload-placeholder-loader-size: 32px;
}
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-mention-background: hsla(341, 100%, 30%, 0.1);
--ck-color-mention-text: hsl(341, 100%, 30%);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-restricted-editing-exception-background: hsla(31, 100%, 65%, .2);
--ck-color-restricted-editing-exception-hover-background: hsla(31, 100%, 65%, .35);
--ck-color-restricted-editing-exception-brackets: hsla(31, 100%, 40%, .4);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@import "../mixins/_rounded.css";

:root {
:root, :host {
--ck-character-grid-tile-size: 24px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-insert-table-dropdown-padding: 10px;
--ck-insert-table-dropdown-box-height: 11px;
--ck-insert-table-dropdown-box-width: 12px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-table-focused-cell-background: hsla(208, 90%, 80%, .3);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@import "../mixins/_rounded.css";

:root {
:root, :host {
--ck-table-properties-error-arrow-size: 6px;
--ck-table-properties-min-error-width: 150px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-table-selected-cell-background: hsla(208, 90%, 80%, .3);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/* Note: To avoid rendering issues (aliasing) but to preserve the responsive nature
of the component, floating–point numbers have been used which, for the default font size
(see: --ck-font-size-base), will generate simple integers. */
:root {
:root, :host {
/* 34px at 13px font-size */
--ck-switch-button-toggle-width: 2.6153846154em;
/* 14px at 13px font-size */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@import "../../../mixins/_rounded.css";

:root {
:root, :host {
--ck-color-grid-tile-size: 24px;

/* Not using global colors here because these may change but some colors in a pallette
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
@import "../../../mixins/_shadow.css";
@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";

:root {
:root, :host {
--ck-dropdown-arrow-size: calc(0.5 * var(--ck-icon-size));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@import "../../../mixins/_rounded.css";

:root {
:root, :host {
--ck-color-split-button-hover-background: hsl(0, 0%, 92%);
--ck-color-split-button-hover-border: hsl(0, 0%, 70%);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
@import "../../../mixins/_focus.css";
@import "../../mixins/_button.css";

:root {
:root, :host {
--ck-color-editable-blur-selection: hsl(0, 0%, 85%);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-form-header-height: 38px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-icon-size: calc(var(--ck-line-height-base) * var(--ck-font-size-normal));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
@import "../../../mixins/_focus.css";
@import "../../../mixins/_shadow.css";

:root {
:root, :host {
--ck-input-text-width: 18em;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@import "../../../mixins/_rounded.css";
@import "../../../mixins/_shadow.css";

:root {
:root, :host {
--ck-balloon-arrow-offset: 2px;
--ck-balloon-arrow-height: 10px;
--ck-balloon-arrow-half-width: 8px;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@import "../../../mixins/_shadow.css";

:root {
:root, :host {
--ck-balloon-fake-panel-offset-horizontal: 6px;
--ck-balloon-fake-panel-offset-vertical: 6px;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-block-toolbar-button: var(--ck-color-text);
--ck-block-toolbar-button-size: var(--ck-font-size-normal);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

@import "../../../mixins/_rounded.css";

:root {
:root, :host {
--ck-tooltip-arrow-size: 5px;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-color-base-foreground: hsl(0, 0%, 98%);
--ck-color-base-background: hsl(0, 0%, 100%);
--ck-color-base-border: hsl(0, 0%, 77%);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
/**
* An opacity value of disabled UI item.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
/**
* The geometry of the of focused element's outer shadow.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-font-size-base: 13px;
--ck-line-height-base: 1.84615;
--ck-font-face: Helvetica, Arial, Tahoma, Verdana, Sans-Serif;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
/* This is super-important. This is **manually** adjusted so a button without an icon
is never smaller than a button with icon, additionally making sure that text-less buttons
are perfect squares. The value is also shared by other components which should stay "in-line"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
/**
* Default border-radius value.
*/
:root{
:root, :host{
--ck-border-radius: 2px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
/**
* A visual style of element's inner shadow (i.e. input).
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-spacing-unit: 0.6em;
--ck-spacing-large: calc(var(--ck-spacing-unit) * 1.5);
--ck-spacing-standard: var(--ck-spacing-unit);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@import "../mixins/_focus.css";
@import "../mixins/_shadow.css";

:root {
:root, :host {
--ck-widget-outline-thickness: 3px;
--ck-widget-handler-icon-size: 16px;
--ck-widget-handler-animation-duration: 200ms;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
--ck-widget-type-around-button-size: 20px;
--ck-color-widget-type-around-button-active: var(--ck-color-focus-border);
--ck-color-widget-type-around-button-hover: var(--ck-color-widget-hover-border);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
:root, :host {
/* Make sure the balloon arrow does not float over its children. */
--ck-balloon-panel-arrow-z-index: calc(var(--ck-z-default) - 3);
}
Expand Down
Loading