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

Improved and added new UI components #14893

Merged
merged 85 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
85 commits
Select commit Hold shift + click to select a range
3a729b0
Poc of groups within ListView component instances.
oleq Aug 11, 2023
8896812
Implementing textarea component
DawidKossowski Aug 31, 2023
a45d9eb
Fix docs
DawidKossowski Aug 31, 2023
961f69b
Spinner component
DawidKossowski Sep 4, 2023
06ef3d3
Refactoring
DawidKossowski Sep 8, 2023
09df455
Docs
DawidKossowski Sep 8, 2023
b6ad555
Minor code refactoring.
oleq Sep 8, 2023
f643561
Tests: Added spinner to the theme manual test.
oleq Sep 8, 2023
31d1d44
Added IconView#isVisible property with a binding.
oleq Sep 8, 2023
a84b06b
Added loupe icon to ckeditor5-core.
oleq Aug 30, 2023
d437d69
ListItemGroupView should not have a border when it's a first visible …
oleq Aug 30, 2023
4f84c7a
Made it possible to inject custom labels into ButtonView instances.
oleq Aug 30, 2023
228cebe
Allowed hiding ListItemGroupView instances.
oleq Aug 30, 2023
abc4e95
Extracted the HighlightedTextView component from the internal logic o…
oleq Aug 30, 2023
7124309
Extracted a generic search UI component from ckeditor5-template.
oleq Aug 30, 2023
2ebce34
Created an autocomplete component draft on top of the generic search …
oleq Aug 30, 2023
6ed0537
Tests: Added manual tests for search and autocomplete components.
oleq Aug 30, 2023
3991c7e
Updated public exports in the ckeditor5-ui package.
oleq Aug 30, 2023
303f6bd
Updated imports in the AutocompleteView component.
oleq Aug 30, 2023
b6d6287
Code refactoring.
oleq Sep 1, 2023
858c7b4
Allowed custom filed view creators in SearchView.
oleq Sep 1, 2023
2799692
Code refactoring and docs. Added test for ListGroupView, ListItemView…
oleq Sep 1, 2023
012f60e
Docs and tests for ButtonView with configurable label view instance.
oleq Sep 4, 2023
45a4525
Tests: Added tests for addListToDropdown() used with item groups.
oleq Sep 4, 2023
a5fba96
Code refactoring, docs, and tests for HighlightedTextView.
oleq Sep 4, 2023
9189e94
Tests and docs for the SearchView component.
oleq Sep 5, 2023
b79ccb0
Code refactoring and tests for focus management in ListView with groups.
oleq Sep 5, 2023
7147500
Tests: Additional code coverage for the HighlightedTextView.
oleq Sep 5, 2023
2069fe2
Tests and docs for SearchView sub-components.
oleq Sep 5, 2023
eefdbab
Tests and docs for the AutocompleteView component.
oleq Sep 5, 2023
32eef35
DomWrapperView should meet the FocusableView interface if it is meant…
oleq Sep 6, 2023
6c83126
Docs: Fixed an invalid link.
oleq Sep 6, 2023
eba638e
type FocusableView -> interface FocusableView to avoid TSDoc errors w…
oleq Sep 6, 2023
1d15ac6
Docs: Fixed invalid links in the search component classes.
oleq Sep 6, 2023
2ec6f25
Tests: Added missing DomWrapperView tests in ckeditor5-mention.
oleq Sep 6, 2023
3dcab2f
Tests: Added missing manual tests descriptions.
oleq Sep 7, 2023
f73eb61
Removed obsolete console log.
oleq Sep 7, 2023
a85216f
Docs: Added missing module description.
oleq Sep 8, 2023
fb2b26b
Docs: Added missing API docs.
oleq Sep 8, 2023
ebe5266
Renamed SearchView -> SearchTextView.
oleq Sep 8, 2023
f8e6e85
Renamed SearchTextFieldView->SearchTextQueryView. Renamed SearchTextV…
oleq Sep 8, 2023
5413b41
Intoduced resizable TextareaView. Allowed using TextareaView for Auto…
oleq Sep 12, 2023
fec7f42
Improvements to SearchView and AutocompleteView API and behaviors.
oleq Sep 13, 2023
186a583
InputBase should have reset() method.
oleq Sep 13, 2023
e2bba49
Used 2 rows as min value for TextareaView. Code refactoring.
oleq Sep 14, 2023
3c486e9
Added min and max rows validation for TextareaView.
oleq Sep 14, 2023
fa5ab36
Used requestAnimationFrame instead of setTimeout for TextareaView aut…
oleq Sep 14, 2023
a953142
Tests and docs for resizable TextareaView.
oleq Sep 14, 2023
b9f6231
Documented and tested InputBase#reset().
oleq Sep 14, 2023
be780a5
Docs and tests for the changes in the SearchView component.
oleq Sep 15, 2023
6f90e5f
Tests and docs for changes in AutocompleteView.
oleq Sep 15, 2023
3716944
Docs.
oleq Sep 15, 2023
30f88ca
Allowed passing an icon to the FormHeaderView component.
oleq Sep 15, 2023
bfd9954
Tests: Added missing TextareaView test.
oleq Sep 15, 2023
bc2d2a1
AutocompleteView should update its value upon child FilteredView#exec…
oleq Sep 18, 2023
a7db808
Autocomplete panel should show up closer to the input.
oleq Sep 19, 2023
f9d0473
Improved the UX of the AutocompleteView.
oleq Sep 19, 2023
b3a34b9
SearchTextView's focus tracking should be open-ended.
oleq Sep 19, 2023
accfdcc
TextareaView should fire an event upon auto-growing.
oleq Sep 19, 2023
7879447
Moved the history icon to ckeditor5-core.
oleq Sep 19, 2023
3f4e5a0
Tests: Added tests for TextareaView #autoGrow event.
oleq Sep 19, 2023
d5532cb
Tests: Added tests for SearchTextView's open-ended focus management l…
oleq Sep 19, 2023
6b53e41
Tests and code refactoring in AutocompleteView.
oleq Sep 19, 2023
ebe9da4
Clarified TextareaView docs.
oleq Sep 20, 2023
5b5edc8
Docs.
oleq Sep 20, 2023
6a40969
Secured AutocompleteView results positioning in edge cases.
oleq Sep 20, 2023
eae2f2d
Code refactoring: Overridden AutocompleteView#_config type.
oleq Sep 21, 2023
bb8bcda
Made ListItemGroupView children extendable.
oleq Sep 21, 2023
8e4a15c
Made the SearchResultsView focusable. SearchTextView should focus the…
oleq Sep 20, 2023
0cb1dc1
TextareaView should have the right height if minRows is 1 and the con…
oleq Sep 22, 2023
2fca617
Docs and refactoring
DawidKossowski Sep 22, 2023
37d92de
Removed .? from the code
DawidKossowski Sep 22, 2023
7967b03
Fixed linter issue
DawidKossowski Sep 22, 2023
3671b8b
Implemented FocusCycler#forwardCycle and #backwardCycle events. Made …
oleq Sep 22, 2023
f143405
Docs.
oleq Sep 22, 2023
513cccc
Made SearchTextView#focusCycler a public property.
oleq Sep 25, 2023
4a2c915
Streamlined nested focus cycling by moving the logic to the component…
oleq Sep 25, 2023
b8f49ad
Code refactoring.
oleq Sep 25, 2023
7fc57b7
Apply suggestions from code review
oleq Sep 25, 2023
5f9bc87
Implemented nested focus cycling navigation in the table (call)proper…
oleq Sep 25, 2023
acb44de
Corrected TS types.
oleq Sep 25, 2023
cb9505e
Merge pull request #15050 from ckeditor/cf/5436-nested-focus-cycling
scofalik Sep 25, 2023
70c8e55
TextareaView should not be manually resizable by default.
oleq Sep 25, 2023
ace53a8
TextareaView should fire #update event whenever its geometry has poss…
oleq Sep 25, 2023
0e4742b
TextareaView should throw if misconfigured.
oleq Sep 25, 2023
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
2 changes: 1 addition & 1 deletion docs/features/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Additionally, CKEditor 5 offers the {@link features/restricted-editing rest

{@img assets/img/features-collaboration.png 800 CKEditor 5 collaboration features.}

You can also easily track the progress and changes done in the content with the {@link features/revision-history revision history feature} {@icon @ckeditor/ckeditor5-revision-history/theme/icons/revision-history.svg Revision history}. This modern and robust document versioning tool lets you create named versions, compare changes, and restore previous document versions at ease, tracking all progress — also when multiple editors work together.
You can also easily track the progress and changes done in the content with the {@link features/revision-history revision history feature} {@icon @ckeditor/ckeditor5-core/theme/icons/history.svg Revision history}. This modern and robust document versioning tool lets you create named versions, compare changes, and restore previous document versions at ease, tracking all progress — also when multiple editors work together.

{@img assets/img/features-revision-history.png 800 CKEditor 5 document versioning feature.}

Expand Down
4 changes: 4 additions & 0 deletions packages/ckeditor5-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ import caption from './../theme/icons/caption.svg';
import check from './../theme/icons/check.svg';
import cog from './../theme/icons/cog.svg';
import eraser from './../theme/icons/eraser.svg';
import history from './../theme/icons/history.svg';
import lowVision from './../theme/icons/low-vision.svg';
import loupe from './../theme/icons/loupe.svg';
import image from './../theme/icons/image.svg';

import alignBottom from './../theme/icons/align-bottom.svg';
Expand Down Expand Up @@ -81,8 +83,10 @@ export const icons = {
check,
cog,
eraser,
history,
image,
lowVision,
loupe,
importExport,
paragraph,
plus,
Expand Down
1 change: 1 addition & 0 deletions packages/ckeditor5-core/theme/icons/history.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions packages/ckeditor5-core/theme/icons/loupe.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions packages/ckeditor5-mention/src/ui/domwrapperview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,11 @@ export default class DomWrapperView extends View {

this.element = this.domElement;
}

/**
* Focuses the DOM element.
*/
public focus(): void {
this.domElement.focus();
}
}
70 changes: 70 additions & 0 deletions packages/ckeditor5-mention/tests/ui/domwrapperview.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**
* @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/* global document, Event */

import { Locale } from '@ckeditor/ckeditor5-utils';
import DomWrapperView from '../../src/ui/domwrapperview';

describe( 'DomWrapperView', () => {
let domElement, view;

beforeEach( () => {
domElement = document.createElement( 'div' );
view = new DomWrapperView( new Locale(), domElement );
} );

afterEach( () => {
view.destroy();
} );

describe( 'constructor()', () => {
it( 'should add CSS class to the element', () => {
expect( domElement.classList.contains( 'ck-button' ) ).to.be.true;
} );

it( 'should set #isOn observable property with a CSS class binding', () => {
expect( view.isOn ).to.be.false;

// TODO: This is actually a bug because the initial state is not set correctly.
expect( domElement.classList.contains( 'ck-on' ) ).to.be.false;
expect( domElement.classList.contains( 'ck-off' ) ).to.be.false;

view.isOn = true;
expect( domElement.classList.contains( 'ck-on' ) ).to.be.true;
expect( domElement.classList.contains( 'ck-off' ) ).to.be.false;

view.isOn = false;
expect( domElement.classList.contains( 'ck-on' ) ).to.be.false;
expect( domElement.classList.contains( 'ck-off' ) ).to.be.true;
} );

it( 'should fire #execute on DOM element click', () => {
const spy = sinon.spy();
view.on( 'execute', spy );

domElement.dispatchEvent( new Event( 'click' ) );

sinon.assert.calledOnce( spy );
} );
} );

describe( 'render()', () => {
it( 'should assign passed element to #element', () => {
view.render();
expect( view.element ).to.equal( domElement );
} );
} );

describe( 'focus()', () => {
it( 'focuses the #domElement', () => {
const spy = sinon.spy( domElement, 'focus' );

view.focus();

sinon.assert.calledOnce( spy );
} );
} );
} );
3 changes: 3 additions & 0 deletions packages/ckeditor5-theme-lark/tests/manual/theme.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ <h3>Button: Responsiveness</h3>
<h3>Button: Tooltip</h3>
<div id="button-tooltip" class="ck ck-reset_all"></div>

<h3>Button: Spinner</h3>
<div id="button-spinner" class="ck ck-reset_all"></div>

<h2>Dropdown</h2>

<h3>ListDropdown</h3>
Expand Down
18 changes: 18 additions & 0 deletions packages/ckeditor5-theme-lark/tests/manual/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import checkIcon from '@ckeditor/ckeditor5-core/theme/icons/check.svg';
import cancelIcon from '@ckeditor/ckeditor5-core/theme/icons/cancel.svg';

import SplitButtonView from '@ckeditor/ckeditor5-ui/src/dropdown/button/splitbuttonview';
import { SpinnerView } from '@ckeditor/ckeditor5-ui';

const locale = new Locale();

Expand Down Expand Up @@ -71,6 +72,7 @@ const ui = testUtils.createTestUIView( {
'buttonResponsive2': '#button-responsive-2',
'buttonResponsive3': '#button-responsive-3',
'buttonTooltip': '#button-tooltip',
'buttonSpinner': '#button-spinner',

listDropdown: '#list-dropdown',
buttonDropdown: '#button-dropdown',
Expand Down Expand Up @@ -273,6 +275,22 @@ function renderButton() {
tooltipPosition: 'sw'
} )
] ) );

// --- With spinner ------------------------------------------------------------

const buttonWithSpinner = button( {
label: 'Button with spinner',
withText: false
} );

const spinnerView = new SpinnerView();
spinnerView.isVisible = true;

buttonWithSpinner.children.add( spinnerView );

ui.buttonSpinner.add( toolbar( [
buttonWithSpinner
] ) );
}

function renderDropdown() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

@import "@ckeditor/ckeditor5-theme-lark/theme/mixins/_rounded.css";
@import "@ckeditor/ckeditor5-theme-lark/theme/mixins/_shadow.css";

.ck.ck-autocomplete {
& > .ck-search__results {
@mixin ck-rounded-corners;
@mixin ck-drop-shadow;

max-height: 200px;
overflow-y: auto;
background: var(--ck-color-base-background);
border: 1px solid var(--ck-color-dropdown-panel-border);
min-width: auto;

&.ck-search__results_n {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;

/* Prevent duplicated borders between the input and the results pane. */
margin-bottom: -1px;
}

&.ck-search__results_s {
border-top-left-radius: 0;
border-top-right-radius: 0;

/* Prevent duplicated borders between the input and the results pane. */
margin-top: -1px;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@
}
}

.ck-list .ck-list__group {
padding-top: var(--ck-spacing-medium);

/* The group should have a border when it's not the first item. */
*:not(.ck-hidden) ~ & {
border-top: 1px solid var(--ck-color-base-border);
}

& > span {
font-size: 11px;
font-weight: bold;
padding: var(--ck-spacing-medium);
}
}

.ck.ck-list__separator {
height: 1px;
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
/*
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

@import "@ckeditor/ckeditor5-ui/theme/mixins/_dir.css";

:root {
--ck-search-field-view-horizontal-spacing: calc(var(--ck-icon-size) + var(--ck-spacing-medium));
}

.ck.ck-search {
& > .ck-labeled-field-view {
& .ck-input {
width: 100%;
}

&.ck-search__query_with-icon {
--ck-labeled-field-label-default-position-x: var(--ck-search-field-view-horizontal-spacing);

& > .ck-labeled-field-view__input-wrapper > .ck-icon {
opacity: .5;
pointer-events: none;
}

& .ck-input {
width: 100%;

@mixin ck-dir ltr {
padding-left: var(--ck-search-field-view-horizontal-spacing);
}

@mixin ck-dir rtl {
&:not(.ck-input-text_empty) {
padding-left: var(--ck-search-field-view-horizontal-spacing);
}
}
}
}

&.ck-search__query_with-reset {
--ck-labeled-field-empty-unfocused-max-width: 100% - 2 * var(--ck-search-field-view-horizontal-spacing);

&.ck-labeled-field-view_empty {
--ck-labeled-field-empty-unfocused-max-width: 100% - var(--ck-search-field-view-horizontal-spacing) - var(--ck-spacing-medium);
}

& .ck-search__reset {
min-width: auto;
min-height: auto;

background: none;
opacity: .5;
padding: 0;

@mixin ck-dir ltr {
right: var(--ck-spacing-medium);
}

@mixin ck-dir rtl {
left: var(--ck-spacing-medium);
}

&:hover {
opacity: 1;
}
}

& .ck-input {
width: 100%;

@mixin ck-dir ltr {
&:not(.ck-input-text_empty) {
padding-right: var(--ck-search-field-view-horizontal-spacing);
}
}

@mixin ck-dir rtl {
padding-right: var(--ck-search-field-view-horizontal-spacing);
}
}
}
}

& > .ck-search__results {
min-width: 100%;

& > .ck-search__info {
width: 100%;
padding: var(--ck-spacing-medium) var(--ck-spacing-large);

& * {
white-space: normal;
}

& > span:first-child {
font-weight: bold;
}

& > span:last-child {
margin-top: var(--ck-spacing-medium);
}
}
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

:root {
--ck-toolbar-spinner-size: 18px;
}

.ck.ck-spinner-container {
width: var(--ck-toolbar-spinner-size);
height: var(--ck-toolbar-spinner-size);
animation: 1.5s infinite rotate linear;
}

.ck.ck-spinner {
width: var(--ck-toolbar-spinner-size);
height: var(--ck-toolbar-spinner-size);
border-radius: 50%;
border: 2px solid var(--ck-color-text);
border-top-color: transparent;
}

@keyframes rotate {
to {
transform: rotate(360deg)
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
*/

/*
* This fixes a problem in Firefox when the initial height of the complement does not match the number of rows.
* This bug is especially visible when rows=1.
*/
.ck-textarea {
overflow-x: hidden
}
Loading