Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Commit

Permalink
Merge pull request #345 from ckeditor/t/144
Browse files Browse the repository at this point in the history
Other: Migrated the package styles from SASS to PostCSS to bring theme support and avoid duplicates in some editor builds. Closes #144. Closes ckeditor/ckeditor5#420.

BREAKING CHANGE: The styles are no longer developed in SASS which means the `.scss` files became unavailable. Please refer to the [Theme Customization](https://docs.ckeditor.com/ckeditor5/latest/framework/guides/ui/theme-customization.html) guide to learn more about migration to PostCSS.
  • Loading branch information
oleq committed Nov 30, 2017
2 parents 876f681 + 27ef57c commit f152dfc
Show file tree
Hide file tree
Showing 50 changed files with 424 additions and 394 deletions.
2 changes: 2 additions & 0 deletions src/button/buttonview.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import TooltipView from '../tooltip/tooltipview';

import { getEnvKeystrokeText } from '@ckeditor/ckeditor5-utils/src/keyboard';

import '../../theme/components/button/button.css';

/**
* The button view class.
*
Expand Down
2 changes: 2 additions & 0 deletions src/dropdown/dropdownview.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import View from '../view';
import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';

import '../../theme/components/dropdown/dropdown.css';

/**
* The dropdown view class.
*
Expand Down
45 changes: 33 additions & 12 deletions src/editorui/boxed/boxededitoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
*/

import EditorUIView from '../../editorui/editoruiview';
import LabelView from '../../label/labelview';
import uid from '@ckeditor/ckeditor5-utils/src/uid';

/**
Expand All @@ -25,7 +26,6 @@ export default class BoxedEditorUIView extends EditorUIView {
constructor( locale ) {
super( locale );

const t = this.t;
const ariaLabelUid = uid();

/**
Expand All @@ -46,6 +46,15 @@ export default class BoxedEditorUIView extends EditorUIView {
*/
this.main = this.createCollection();

/**
* Voice label of the UI.
*
* @protected
* @readonly
* @member {module:ui/view~View} #_voiceLabelView
*/
this._voiceLabelView = this._createVoiceLabel( ariaLabelUid );

this.setTemplate( {
tag: 'div',

Expand All @@ -62,17 +71,7 @@ export default class BoxedEditorUIView extends EditorUIView {
},

children: [
{
tag: 'span',
attributes: {
id: `cke-editor__aria-label_${ ariaLabelUid }`,
class: 'cke-voice-label'
},
children: [
// TODO: Editor name?
t( 'Rich Text Editor' )
]
},
this._voiceLabelView,
{
tag: 'div',
attributes: {
Expand All @@ -92,4 +91,26 @@ export default class BoxedEditorUIView extends EditorUIView {
]
} );
}

/**
* Creates a voice label view instance.
*
* @private
* @returns {module:ui/label/labelview~LabelView}
*/
_createVoiceLabel( ariaLabelUid ) {
const t = this.t;
const voiceLabel = new LabelView();

voiceLabel.text = t( 'Rich Text Editor' );

voiceLabel.extendTemplate( {
attributes: {
id: `cke-editor__aria-label_${ ariaLabelUid }`,
class: 'cke-voice-label'
}
} );

return voiceLabel;
}
}
2 changes: 2 additions & 0 deletions src/editorui/editoruiview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
import View from '../view';
import Template from '../template';

import '../../theme/components/editorui/editorui.css';

/**
* The editor UI view class. Base class for the editor main views.
*
Expand Down
2 changes: 2 additions & 0 deletions src/icon/iconview.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@

import View from '../view';

import '../../theme/components/icon/icon.css';

/**
* The icon view class.
*
Expand Down
2 changes: 2 additions & 0 deletions src/inputtext/inputtextview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import View from '../view';

import '../../theme/components/inputtext/inputtext.css';

/**
* The text input view class.
*
Expand Down
2 changes: 2 additions & 0 deletions src/label/labelview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import View from '../view';

import '../../theme/components/label/label.css';

/**
* The label view class.
*
Expand Down
2 changes: 2 additions & 0 deletions src/list/listview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import FocusTracker from '@ckeditor/ckeditor5-utils/src/focustracker';
import FocusCycler from '../focuscycler';
import KeystrokeHandler from '@ckeditor/ckeditor5-utils/src/keystrokehandler';

import '../../theme/components/list/list.css';

/**
* The list view class.
*
Expand Down
2 changes: 2 additions & 0 deletions src/panel/balloon/balloonpanelview.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import isElement from '@ckeditor/ckeditor5-utils/src/lib/lodash/isElement';
import toUnit from '@ckeditor/ckeditor5-utils/src/dom/tounit';
import global from '@ckeditor/ckeditor5-utils/src/dom/global';

import '../../../theme/components/panel/balloonpanel.css';

const toPx = toUnit( 'px' );
const defaultLimiterElement = global.document.body;

Expand Down
2 changes: 2 additions & 0 deletions src/panel/sticky/stickypanelview.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import View from '../../view';
import Template from '../../template';
import toUnit from '@ckeditor/ckeditor5-utils/src/dom/tounit';

import '../../../theme/components/panel/stickypanel.css';

const toPx = toUnit( 'px' );

/**
Expand Down
2 changes: 2 additions & 0 deletions src/toolbar/toolbarview.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import ToolbarSeparatorView from './toolbarseparatorview';
import preventDefault from '../bindings/preventdefault.js';
import log from '@ckeditor/ckeditor5-utils/src/log';

import '../../theme/components/toolbar/toolbar.css';

/**
* The toolbar view class.
*
Expand Down
2 changes: 2 additions & 0 deletions src/tooltip/tooltipview.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import View from '../view';

import '../../theme/components/tooltip/tooltip.css';

/**
* The tooltip view class.
*
Expand Down
2 changes: 2 additions & 0 deletions src/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import Collection from '@ckeditor/ckeditor5-utils/src/collection';
import mix from '@ckeditor/ckeditor5-utils/src/mix';
import isIterable from '@ckeditor/ckeditor5-utils/src/isiterable';

import '../theme/globals/globals.css';

/**
* The basic view class, which represents an HTML element created out of a
* {@link module:ui/view~View#template}. Views are building blocks of the user interface and handle
Expand Down
1 change: 0 additions & 1 deletion tests/dropdown/manual/dropdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Collection from '@ckeditor/ckeditor5-utils/src/collection';
import createDropdown from '../../../src/dropdown/createdropdown';
import createListDropdown from '../../../src/dropdown/list/createlistdropdown';

import '@ckeditor/ckeditor5-theme-lark/theme/theme.scss';
import testUtils from '../../_utils/utils';

const ui = testUtils.createTestUIView( {
Expand Down
2 changes: 0 additions & 2 deletions tests/manual/icon/icon.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import IconView from '../../../src/icon/iconview';

import '@ckeditor/ckeditor5-theme-lark/theme/theme.scss';

const wrapper = document.querySelector( '#inline-svg' );

const icon = `
Expand Down
1 change: 0 additions & 1 deletion tests/manual/panel/balloon/balloonpanelview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
/* globals document */

import BalloonPanelView from '../../../../src/panel/balloon/balloonpanelview';
import '@ckeditor/ckeditor5-theme-lark/theme/theme.scss';

const defaultPositions = BalloonPanelView.defaultPositions;
const container = document.querySelector( '#container' );
Expand Down
2 changes: 0 additions & 2 deletions tests/manual/panel/sticky/stickypanelview.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import testUtils from '../../../_utils/utils';
import StickyPanelView from '../../../../src/panel/sticky/stickypanelview';

import '@ckeditor/ckeditor5-theme-lark/theme/theme.scss';

const ui = testUtils.createTestUIView( {
stickyToTheTop: '.ck-sticky_to-the-top .ck-editor__top',
stickyToTheBox: '.ck-sticky_to-the-box .ck-editor__top'
Expand Down
2 changes: 0 additions & 2 deletions tests/manual/tickets/126/1.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@

import BalloonPanelView from '../../../../src/panel/balloon/balloonpanelview';

import '@ckeditor/ckeditor5-theme-lark/theme/theme.scss';

window.createPanel = selector => {
const view = new BalloonPanelView();

Expand Down
30 changes: 0 additions & 30 deletions theme/components/button.scss

This file was deleted.

35 changes: 35 additions & 0 deletions theme/components/button/button.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/

@import "../../mixins/_unselectable.css";
@import "../tooltip/mixins/_tooltip.css";

.ck-button,
a.ck-button {
@mixin ck-unselectable;
@mixin ck-tooltip_enabled;

display: inline-block;
position: relative;

&.ck-button_with-text {
& .ck-button__label {
display: block;
}
}

&:hover {
@mixin ck-tooltip_visible;
}

/* Get rid of the native focus outline around the tooltip when focused (but not :hover). */
&:focus:not(:hover) {
@mixin ck-tooltip_disabled;
}

& .ck-button__label {
display: none;
}
}
37 changes: 0 additions & 37 deletions theme/components/dropdown.scss

This file was deleted.

39 changes: 39 additions & 0 deletions theme/components/dropdown/dropdown.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2003-2017, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md.
*/

.ck-dropdown {
display: inline-block;
position: relative;

/* A triangle displayed to indicate this is actually a dropdown. */
&::after {
content: '';
width: 0;
height: 0;
pointer-events: none;
z-index: var(--ck-z-default);

position: absolute;
top: 50%;
transform: translate( 0, -50% );
}
}

.ck-dropdown__panel {
/* This is to get rid of flickering when the tooltip is shown under the panel,
which looks like the panel moves vertically a pixel down and up. */
-webkit-backface-visibility: hidden;

display: none;
z-index: var(--ck-z-modal);

position: absolute;
left: 0px;
transform: translateY( 100% );
}

.ck-dropdown__panel-visible {
display: inline-block;
}
21 changes: 0 additions & 21 deletions theme/components/editor.scss

This file was deleted.

Loading

0 comments on commit f152dfc

Please sign in to comment.