planning
All checks were successful
Publish To Prod / deploy_and_publish (push) Successful in 35s

This commit is contained in:
2024-10-14 09:15:30 +02:00
parent bcba00a730
commit 6e64e138e2
21059 changed files with 2317811 additions and 1 deletions

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
var _lowestMatchedAncestor = _interopRequireDefault(require("../../matchers/lowestMatchedAncestor"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function areCurrentAndPreviousBlocksOfType(editor, type) {
const {
selection
} = editor;
if (!selection) return false;
const [current] = _slate.Editor.nodes(editor, (0, _lowestMatchedAncestor.default)(editor, 'block'));
const previous = _slate.Editor.previous(editor, (0, _lowestMatchedAncestor.default)(editor, type));
return current && previous && current[0].type === previous[0].type;
}
var _default = exports.default = areCurrentAndPreviousBlocksOfType;

View File

@@ -0,0 +1,15 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
var _lowestMatchedAncestor = _interopRequireDefault(require("../../matchers/lowestMatchedAncestor"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function getListTypeAtCursor(editor) {
const list = _slate.Editor.above(editor, (0, _lowestMatchedAncestor.default)(editor, 'list'));
if (!list) return null;
return list[0].type;
}
var _default = exports.default = getListTypeAtCursor;

View File

@@ -0,0 +1,16 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
function isCursorAfterSoftBreak(editor) {
const {
selection
} = editor;
if (!selection) return false;
const [previous] = _slate.Editor.previous(editor);
return previous && previous.type == 'break';
}
var _default = exports.default = isCursorAfterSoftBreak;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
var _lowestMatchedAncestor = _interopRequireDefault(require("../../matchers/lowestMatchedAncestor"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isCursorAtEndOfParagraph(editor) {
const {
selection
} = editor;
if (!selection) return false;
const paragraph = _slate.Editor.above(editor, (0, _lowestMatchedAncestor.default)(editor, 'paragraph'));
return !!paragraph && _slate.Editor.isEnd(editor, editor.selection.focus, paragraph[1]);
}
var _default = exports.default = isCursorAtEndOfParagraph;

View File

@@ -0,0 +1,18 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
var _lowestMatchedAncestor = _interopRequireDefault(require("../../matchers/lowestMatchedAncestor"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function isCursorAtStartOfBlockType(editor, type) {
const {
selection
} = editor;
if (!selection) return false;
const block = _slate.Editor.above(editor, (0, _lowestMatchedAncestor.default)(editor, type));
return !!block && _slate.Editor.isStart(editor, editor.selection.focus, block[1]);
}
var _default = exports.default = isCursorAtStartOfBlockType;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
function isCursorAtStartOfNonEmptyHeading(editor) {
const {
selection
} = editor;
if (!selection) return false;
const [match] = Array.from(_slate.Editor.nodes(editor, {
match: n => _slate.Element.isElement(n) && _slate.Editor.isBlock(editor, n) && `${n.type}`.startsWith('heading-'),
mode: 'lowest'
}));
return !!match && _slate.Editor.isStart(editor, editor.selection.focus, match[1]) && !_slate.Editor.isEmpty(editor, match[0]);
}
var _default = exports.default = isCursorAtStartOfNonEmptyHeading;

View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
function isCursorCollapsedAfterSoftBreak(editor) {
const {
selection
} = editor;
if (!selection) return false;
if (_slate.Range.isExpanded(selection)) return false;
const previous = _slate.Editor.previous(editor);
return previous && previous[0].type == 'break';
}
var _default = exports.default = isCursorCollapsedAfterSoftBreak;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
function isCursorInBlockType(editor, type, ignoreHeadings, ignoreLists) {
const {
selection
} = editor;
if (!selection) return false;
const [match] = Array.from(_slate.Editor.nodes(editor, {
match: n => _slate.Element.isElement(n) && _slate.Editor.isBlock(editor, n) && n.type !== 'paragraph' && n.type !== 'list-item' && (ignoreHeadings || !`${n.type}`.startsWith('heading-')) && (!ignoreLists || !`${n.type}`.endsWith('-list')),
mode: 'lowest'
}));
return !!match && (match[0].type === type || `${match[0].type}`.startsWith(`${type}-` || `${match[0].type}`.endsWith(`-${type}`)));
}
var _default = exports.default = isCursorInBlockType;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
function isCursorInNonDefaultBlock(editor) {
const {
selection
} = editor;
if (!selection) return false;
const [match] = Array.from(_slate.Editor.nodes(editor, {
match: n => _slate.Element.isElement(n) && _slate.Editor.isBlock(editor, n) && n.type !== 'paragraph',
mode: 'lowest'
}));
return !!match && !_slate.Editor.isEditor(match[0]);
}
var _default = exports.default = isCursorInNonDefaultBlock;

View File

@@ -0,0 +1,19 @@
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _slate = require("slate");
function isCursorInNonDefaultBlock(editor) {
const {
selection
} = editor;
if (!selection) return false;
const [match] = Array.from(_slate.Editor.nodes(editor, {
match: n => _slate.Element.isElement(n) && _slate.Editor.isBlock(editor, n) && n.type !== 'paragraph',
mode: 'lowest'
}));
return !!match && !_slate.Editor.isEditor(match[0]);
}
var _default = exports.default = isCursorInNonDefaultBlock;