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

Chore(tabulation): Keydown refactor #79

Merged
merged 32 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
22922cb
refactored tab and shift+tab nehaviour
e11sy Aug 9, 2024
faba066
tab fix
e11sy Aug 9, 2024
1083cf1
now list could be splitted in the middle on enter
e11sy Aug 9, 2024
787d03e
comments improved
e11sy Aug 9, 2024
d0d1852
split corner case fixed
e11sy Aug 9, 2024
8dd7b56
fix enter behaviour
e11sy Aug 12, 2024
01e4788
replace some of the utils with @editorjs/utils packages
e11sy Aug 26, 2024
128655a
refactored item merging behaviour
e11sy Aug 26, 2024
d38c568
clean up
e11sy Aug 26, 2024
158bcd2
blocks merge implemented
e11sy Sep 9, 2024
8977973
now nested list passes initialized renderer to the tabulator
e11sy Sep 9, 2024
0d65f0a
moved to types
e11sy Sep 9, 2024
9549e90
merge method added
e11sy Sep 11, 2024
a2a9090
refactor merge lists
e11sy Sep 17, 2024
96f07a6
renaming and comments improvements
e11sy Sep 17, 2024
b71cef8
now new instance of tabulator is created on convertion
e11sy Sep 17, 2024
1267fa3
codestyle
e11sy Sep 17, 2024
b64470a
renaming
e11sy Sep 17, 2024
358ac9e
removed currentLevel from tabulator
e11sy Sep 18, 2024
8d2d555
fix paragraph insertion bug
e11sy Sep 23, 2024
227644e
improved responsibilities of enterpressed and backspace
e11sy Sep 25, 2024
4e76dc7
codestyle improvement
e11sy Sep 25, 2024
f72e54f
suggestions
e11sy Sep 25, 2024
d0518f0
caret alias added
e11sy Sep 25, 2024
01efb29
comments improved
e11sy Sep 25, 2024
2e43690
typo fixed
e11sy Sep 25, 2024
b6249b9
added utils for code readability
e11sy Sep 28, 2024
6de4e14
fixed merge item logic
e11sy Sep 28, 2024
740ceef
build fix and comments improved
e11sy Sep 28, 2024
eee722a
get child items could not return null now
e11sy Sep 28, 2024
a9009ee
changed getSiblings util
e11sy Sep 28, 2024
16abb05
fix bug
e11sy Sep 28, 2024
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
96 changes: 51 additions & 45 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,77 +114,80 @@
data: {
blocks: [
{
type : 'List',
data : {
items : [
type: 'List',
data: {
items: [
{
"content": "Canon",
"items": [
content: "Canon",
items: [
{
"content": "Fisheye",
"items": [
content: "Fisheye",
items: [
{
"content": "Canon 15mm f/2.8",
"items": []
},
content: "Canon 15mm f/2.8",
items: []
}
]
},
{
"content": "Normal",
"items": [
content: "Normal",
items: [
{
"content": "Canon 40mm f/2.8",
"items": []
content: "Canon 40mm f/2.8",
items: []
},
{
"content": "Canon 50mm f/1.8",
"items": []
},
content: "Canon 50mm f/1.8",
items: []
}
]
},
{
"content": "Zoom",
"items": [
{
"content": "Canon 75-300mm f/4-5.6",
"items": []
},
]
},
content: "Zoom",
items: []
}
]
},
{
content: "",
items: [
{
content: "Canon 75-300mm f/4-5.6",
items: []
}
]
},
{
"content": "Tamron",
"items": [
content: "Tamron",
items: [
{
"content": "Zoom",
"items": [
content: "Zoom",
items: [
{
"content": "Tamron 28-75mm f/2.8",
"items": []
},
content: "Tamron 28-75mm f/2.8",
items: []
}
]
},
}
]
},
{
"content": "Samyang",
"items": [
content: "Samyang",
items: [
{
"content": "Wide",
"items": [
content: "Wide",
items: [
{
"content": "Samyang 14mm f/2.8",
"items": []
},
content: "Samyang 14mm f/2.8",
items: []
}
]
},
}
]
},
],
style: 'checklist'
}
]
}
},
}
]
},
onReady: function(){
Expand All @@ -195,6 +198,9 @@
}
});

window.editor = editor;


/**
* Saving button
*/
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"@editorjs/editorjs": "^2.29.1",
"@typescript-eslint/eslint-plugin": "^7.13.1",
"@typescript-eslint/parser": "^7.13.1",
"@editorjs/caret": "^0.0.7",
"@editorjs/dom": "^0.0.7",
"eslint": "^7.22.0",
"eslint-loader": "^4.0.2",
"postcss-nested": "^5.0.3",
Expand Down
8 changes: 4 additions & 4 deletions src/ListRenderer/ChecklistRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IconCheck } from '@codexteam/icons'
import type { ChecklistItemMeta } from "../types/ItemMeta";
import { NestedListConfig } from "../types/ListParams";
import * as Dom from '../utils/Dom';
import * as Dom from '@editorjs/dom';
import { ListRendererInterface, DefaultListCssClasses, CssPrefix } from './ListRenderer';
import type { ListCssClasses } from './ListRenderer';

Expand Down Expand Up @@ -45,16 +45,16 @@ export class CheckListRenderer implements ListRendererInterface<ChecklistItemMet

/**
* Renders ul wrapper for list
* @param level - level of nesting (0 for the rool level)
* @param isRoot - boolean variable that represents level of the wrappre (root or childList)
* @returns - created html ul element
*/
renderWrapper(level: number): HTMLUListElement {
renderWrapper(isRoot: boolean): HTMLUListElement {
let wrapperElement: HTMLUListElement;

/**
* Check if it's root level
*/
if (level === 0) {
if (isRoot === true) {
wrapperElement = Dom.make('ul', [CheckListRenderer.CSS.wrapper, CheckListRenderer.CSS.checklist]) as HTMLUListElement;

/**
Expand Down
4 changes: 2 additions & 2 deletions src/ListRenderer/ListRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ export interface ListCssClasses {
export interface ListRendererInterface<ItemMeta> {
/**
* Renders wrapper for list
* @param level - level of nesting (0 for the rool level)
* @param isRoot - boolean variable that represents level of the wrappre (root or childList)
* @returns - created html ul element
*/
renderWrapper: (level: number) => HTMLElement;
renderWrapper: (isRoot: boolean) => HTMLElement;

/**
* Redners list item element
Expand Down
8 changes: 4 additions & 4 deletions src/ListRenderer/OrderedListRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { OrderedListItemMeta } from "../types/ItemMeta";
import { NestedListConfig } from "../types/ListParams";
import * as Dom from '../utils/Dom';
import * as Dom from '@editorjs/dom';
import { ListRendererInterface, DefaultListCssClasses, CssPrefix } from './ListRenderer';
import type { ListCssClasses } from './ListRenderer';

Expand Down Expand Up @@ -39,16 +39,16 @@ export class OrderedListRenderer implements ListRendererInterface<OrderedListIte

/**
* Renders ol wrapper for list
* @param level - level of nesting (0 for the rool level)
* @param isRoot - boolean variable that represents level of the wrappre (root or childList)
* @returns - created html ol element
*/
renderWrapper(level: number): HTMLOListElement {
renderWrapper(isRoot: boolean): HTMLOListElement {
let wrapperElement: HTMLOListElement;

/**
* Check if it's root level
*/
if (level === 0) {
if (isRoot === true) {
wrapperElement = Dom.make('ol', [OrderedListRenderer.CSS.wrapper, OrderedListRenderer.CSS.orderedList]) as HTMLOListElement;
} else {
wrapperElement = Dom.make('ol', [OrderedListRenderer.CSS.orderedList, OrderedListRenderer.CSS.itemChildren]) as HTMLOListElement;
Expand Down
8 changes: 4 additions & 4 deletions src/ListRenderer/UnorderedListRenderer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { UnorderedListItemMeta } from "../types/ItemMeta";
import { NestedListConfig } from "../types/ListParams";
import * as Dom from '../utils/Dom';
import * as Dom from '@editorjs/dom';
import { ListRendererInterface, DefaultListCssClasses, CssPrefix } from './ListRenderer';
import type { ListCssClasses } from './ListRenderer';

Expand Down Expand Up @@ -39,16 +39,16 @@ export class UnorderedListRenderer implements ListRendererInterface<UnorderedLis

/**
* Renders ol wrapper for list
* @param level - level of nesting (0 for the rool level)
* @param isRoot - boolean variable that represents level of the wrappre (root or childList)
* @returns - created html ul element
*/
renderWrapper(level: number): HTMLUListElement {
renderWrapper(isRoot: boolean): HTMLUListElement {
let wrapperElement: HTMLUListElement;

/**
* Check if it's root level
*/
if (level === 0) {
if (isRoot === true) {
wrapperElement = Dom.make('ul', [UnorderedListRenderer.CSS.wrapper, UnorderedListRenderer.CSS.unorderedList]) as HTMLUListElement;
} else {
wrapperElement = Dom.make('ul', [UnorderedListRenderer.CSS.unorderedList, UnorderedListRenderer.CSS.itemChildren]) as HTMLUListElement;
Expand Down
Loading
Loading