@use-kona/editor 0.1.7 → 0.1.8-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -160,7 +160,7 @@ class CodeBlockPlugin {
160
160
  deserialize: (el, children)=>{
161
161
  const { nodeName } = el;
162
162
  if ('PRE' === nodeName) {
163
- const lines = children.join('').split('\n');
163
+ const lines = children.join('').split('\n').filter((line)=>Boolean(line));
164
164
  return external_slate_hyperscript_jsx('element', {
165
165
  type: CodeBlockPlugin.CODE_ELEMENT
166
166
  }, lines.map((line)=>external_slate_hyperscript_jsx('element', {
@@ -51,7 +51,7 @@ class ListsPlugin {
51
51
  const prevListItemPath = Editor.before(editor, path, {
52
52
  unit: 'block'
53
53
  });
54
- const prevList = Editor.above(editor, {
54
+ const prevList = prevListItemPath && Editor.above(editor, {
55
55
  at: prevListItemPath,
56
56
  match: (n)=>this.isList(editor, n)
57
57
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@use-kona/editor",
3
- "version": "0.1.7",
3
+ "version": "0.1.8-rc.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./src/index.ts"
@@ -216,7 +216,10 @@ export class CodeBlockPlugin implements IPlugin {
216
216
  const { nodeName } = el;
217
217
 
218
218
  if (nodeName === 'PRE') {
219
- const lines = children.join('').split('\n');
219
+ const lines = children
220
+ .join('')
221
+ .split('\n')
222
+ .filter((line) => Boolean(line));
220
223
 
221
224
  return jsx(
222
225
  'element',
@@ -93,10 +93,12 @@ export class ListsPlugin implements IPlugin {
93
93
  unit: 'block',
94
94
  });
95
95
 
96
- const prevList = Editor.above(editor, {
97
- at: prevListItemPath,
98
- match: (n) => this.isList(editor, n as CustomElement),
99
- });
96
+ const prevList =
97
+ prevListItemPath &&
98
+ Editor.above(editor, {
99
+ at: prevListItemPath,
100
+ match: (n) => this.isList(editor, n as CustomElement),
101
+ });
100
102
 
101
103
  if (prevList) {
102
104
  const currentDepth = this.getListDepth(editor, path);