Skip to content

Commit

Permalink
Merge branch 'fix-shift-tab-behaviour' into ui-improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
e11sy committed Oct 30, 2024
2 parents 9303776 + 7f0612c commit e0cb899
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
9 changes: 0 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,6 @@ export default class NestedList {
public renderSettings(): MenuConfigItem[] {
const defaultTunes: MenuConfigItem[] = [
{
name: 'unordered' as const,
label: this.api.i18n.t('Unordered'),
icon: IconListBulleted,
closeOnActivate: true,
Expand All @@ -277,7 +276,6 @@ export default class NestedList {
},
},
{
name: 'ordered' as const,
label: this.api.i18n.t('Ordered'),
icon: IconListNumbered,
closeOnActivate: true,
Expand All @@ -287,7 +285,6 @@ export default class NestedList {
},
},
{
name: 'checklist' as const,
label: this.api.i18n.t('Checklist'),
icon: IconChecklist,
closeOnActivate: true,
Expand All @@ -313,12 +310,10 @@ export default class NestedList {

const orderedListTunes: MenuConfigItem[] = [
{
name: 'start with' as const,
label: this.api.i18n.t('Start with'),
children: {
items: [
{
name: 'start with input',
element: startWithElement,
// @ts-expect-error ts(2820) can not use PopoverItem enum from editor.js types
type: 'html',
Expand All @@ -329,7 +324,6 @@ export default class NestedList {
];

const orderedListCountersTunes: MenuConfigItem = {
name: 'counter types' as const,
label: this.api.i18n.t('Counters type'),
children: {
items: [],
Expand All @@ -342,15 +336,12 @@ export default class NestedList {
// eslint-disable-next-line @typescript-eslint/no-unsafe-call
OlCounterTypesMap.keys().forEach((counterType: string) => {
orderedListCountersTunes.children.items!.push({
name: counterType,
title: this.api.i18n.t(counterType),
isActive: this.data.counterType === OlCounterTypesMap.get(counterType),
closeOnActivate: true,
onActivate: () => {
this.changeCounters(OlCounterTypesMap.get(counterType) as OlCounterType);
},
// @ts-expect-error ts(2820) can not use PopoverItem enum from editor.js types
type: 'default',
});
});

Expand Down
5 changes: 4 additions & 1 deletion src/utils/removeChildWrapperIfEmpty.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import { getChildItems } from './getChildItems';
* @param childWrapper - childWrapper to be removed if it is empty
*/
export function removeChildWrapperIfEmpty(childWrapper: ItemChildWrapperElement): void {
if (getChildItems(childWrapper) === null) {
/**
* Check that there is at least one item
*/
if (getChildItems(childWrapper).length === 0) {
childWrapper.remove();
}
}

0 comments on commit e0cb899

Please sign in to comment.