@burger-editor/client 4.0.0-alpha.16 → 4.0.0-alpha.17
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.
- package/dist/client.js +62 -44
- package/dist/client.js.map +1 -1
- package/package.json +8 -8
package/dist/client.js
CHANGED
|
@@ -2938,6 +2938,7 @@ const CSS_LAYER = {
|
|
|
2938
2938
|
ui: 'bge-ui',
|
|
2939
2939
|
};
|
|
2940
2940
|
const BLOCK_OPTION_CSS_CUSTOM_PROPERTY_PREFIX = '--bge-options-';
|
|
2941
|
+
const BLOCK_OPTION_SCOPE_SELECTOR = `[data-bge-container]`;
|
|
2941
2942
|
|
|
2942
2943
|
/**
|
|
2943
2944
|
*
|
|
@@ -3417,7 +3418,7 @@ function getStyleRules(rules, scope) {
|
|
|
3417
3418
|
const styleRules = [];
|
|
3418
3419
|
for (const rule of rules) {
|
|
3419
3420
|
if (rule instanceof CSSStyleRule) {
|
|
3420
|
-
styleRules.push(rule);
|
|
3421
|
+
styleRules.push(...getStyleRules(rule.cssRules, scope), rule);
|
|
3421
3422
|
continue;
|
|
3422
3423
|
}
|
|
3423
3424
|
if (rule instanceof CSSGroupingRule) {
|
|
@@ -3437,10 +3438,11 @@ function searchCustomProperty(scope, found) {
|
|
|
3437
3438
|
try {
|
|
3438
3439
|
const styleRules = getStyleRules(styleSheet.cssRules, scope);
|
|
3439
3440
|
for (const cssRule of styleRules) {
|
|
3440
|
-
|
|
3441
|
+
const selector = cssRule.selectorText.trim().replace(/^&/, '').trim();
|
|
3442
|
+
if (selector === BLOCK_OPTION_SCOPE_SELECTOR) {
|
|
3441
3443
|
for (const cssProperty of cssRule.style) {
|
|
3442
3444
|
if (!cssProperty.startsWith('--')) {
|
|
3443
|
-
|
|
3445
|
+
continue;
|
|
3444
3446
|
}
|
|
3445
3447
|
const value = cssRule.style.getPropertyValue(cssProperty);
|
|
3446
3448
|
found(cssProperty, value);
|
|
@@ -21909,12 +21911,17 @@ function run2(config) {
|
|
|
21909
21911
|
});
|
|
21910
21912
|
const handlers = [];
|
|
21911
21913
|
state.doc.nodesBetween(from, to, (node, pos) => {
|
|
21912
|
-
|
|
21914
|
+
var _a, _b, _c, _d, _e;
|
|
21915
|
+
if (((_b = (_a = node.type) == null ? void 0 : _a.spec) == null ? void 0 : _b.code) || !(node.isText || node.isTextblock || node.isInline)) {
|
|
21913
21916
|
return;
|
|
21914
21917
|
}
|
|
21918
|
+
const contentSize = (_e = (_d = (_c = node.content) == null ? void 0 : _c.size) != null ? _d : node.nodeSize) != null ? _e : 0;
|
|
21915
21919
|
const resolvedFrom = Math.max(from, pos);
|
|
21916
|
-
const resolvedTo = Math.min(to, pos +
|
|
21917
|
-
|
|
21920
|
+
const resolvedTo = Math.min(to, pos + contentSize);
|
|
21921
|
+
if (resolvedFrom >= resolvedTo) {
|
|
21922
|
+
return;
|
|
21923
|
+
}
|
|
21924
|
+
const textToMatch = node.isText ? node.text || "" : node.textBetween(resolvedFrom - pos, resolvedTo - pos, void 0, "\uFFFC");
|
|
21918
21925
|
const matches = pasteRuleMatcherHandler(textToMatch, rule.find, pasteEvent);
|
|
21919
21926
|
matches.forEach((match) => {
|
|
21920
21927
|
if (match.index === void 0) {
|
|
@@ -22131,8 +22138,6 @@ var ExtensionManager = class {
|
|
|
22131
22138
|
get plugins() {
|
|
22132
22139
|
const { editor } = this;
|
|
22133
22140
|
const extensions = sortExtensions([...this.extensions].reverse());
|
|
22134
|
-
const inputRules = [];
|
|
22135
|
-
const pasteRules = [];
|
|
22136
22141
|
const allPlugins = extensions.map((extension) => {
|
|
22137
22142
|
const context = {
|
|
22138
22143
|
name: extension.name,
|
|
@@ -22163,11 +22168,23 @@ var ExtensionManager = class {
|
|
|
22163
22168
|
plugins.push(keyMapPlugin);
|
|
22164
22169
|
const addInputRules = getExtensionField(extension, "addInputRules", context);
|
|
22165
22170
|
if (isExtensionRulesEnabled(extension, editor.options.enableInputRules) && addInputRules) {
|
|
22166
|
-
|
|
22171
|
+
const rules = addInputRules();
|
|
22172
|
+
if (rules && rules.length) {
|
|
22173
|
+
const inputResult = inputRulesPlugin({
|
|
22174
|
+
editor,
|
|
22175
|
+
rules
|
|
22176
|
+
});
|
|
22177
|
+
const inputPlugins = Array.isArray(inputResult) ? inputResult : [inputResult];
|
|
22178
|
+
plugins.push(...inputPlugins);
|
|
22179
|
+
}
|
|
22167
22180
|
}
|
|
22168
22181
|
const addPasteRules = getExtensionField(extension, "addPasteRules", context);
|
|
22169
22182
|
if (isExtensionRulesEnabled(extension, editor.options.enablePasteRules) && addPasteRules) {
|
|
22170
|
-
|
|
22183
|
+
const rules = addPasteRules();
|
|
22184
|
+
if (rules && rules.length) {
|
|
22185
|
+
const pasteRules = pasteRulesPlugin({ editor, rules });
|
|
22186
|
+
plugins.push(...pasteRules);
|
|
22187
|
+
}
|
|
22171
22188
|
}
|
|
22172
22189
|
const addProseMirrorPlugins = getExtensionField(
|
|
22173
22190
|
extension,
|
|
@@ -22180,17 +22197,7 @@ var ExtensionManager = class {
|
|
|
22180
22197
|
}
|
|
22181
22198
|
return plugins;
|
|
22182
22199
|
}).flat();
|
|
22183
|
-
return
|
|
22184
|
-
inputRulesPlugin({
|
|
22185
|
-
editor,
|
|
22186
|
-
rules: inputRules
|
|
22187
|
-
}),
|
|
22188
|
-
...pasteRulesPlugin({
|
|
22189
|
-
editor,
|
|
22190
|
-
rules: pasteRules
|
|
22191
|
-
}),
|
|
22192
|
-
...allPlugins
|
|
22193
|
-
];
|
|
22200
|
+
return allPlugins;
|
|
22194
22201
|
}
|
|
22195
22202
|
/**
|
|
22196
22203
|
* Get all attributes from the extensions.
|
|
@@ -35812,29 +35819,40 @@ function create_effect(type, fn, sync, push = true) {
|
|
|
35812
35819
|
schedule_effect(effect);
|
|
35813
35820
|
}
|
|
35814
35821
|
|
|
35815
|
-
|
|
35816
|
-
|
|
35817
|
-
|
|
35818
|
-
sync &&
|
|
35819
|
-
effect.deps === null &&
|
|
35820
|
-
effect.first === null &&
|
|
35821
|
-
effect.nodes_start === null &&
|
|
35822
|
-
effect.teardown === null &&
|
|
35823
|
-
(effect.f & EFFECT_PRESERVED) === 0;
|
|
35824
|
-
|
|
35825
|
-
if (!inert && push) {
|
|
35826
|
-
if (parent !== null) {
|
|
35827
|
-
push_effect(effect, parent);
|
|
35828
|
-
}
|
|
35822
|
+
if (push) {
|
|
35823
|
+
/** @type {Effect | null} */
|
|
35824
|
+
var e = effect;
|
|
35829
35825
|
|
|
35830
|
-
// if
|
|
35826
|
+
// if an effect has already ran and doesn't need to be kept in the tree
|
|
35827
|
+
// (because it won't re-run, has no DOM, and has no teardown etc)
|
|
35828
|
+
// then we skip it and go to its child (if any)
|
|
35831
35829
|
if (
|
|
35832
|
-
|
|
35833
|
-
|
|
35834
|
-
|
|
35830
|
+
sync &&
|
|
35831
|
+
e.deps === null &&
|
|
35832
|
+
e.teardown === null &&
|
|
35833
|
+
e.nodes_start === null &&
|
|
35834
|
+
e.first === e.last && // either `null`, or a singular child
|
|
35835
|
+
(e.f & EFFECT_PRESERVED) === 0
|
|
35835
35836
|
) {
|
|
35836
|
-
|
|
35837
|
-
|
|
35837
|
+
e = e.first;
|
|
35838
|
+
}
|
|
35839
|
+
|
|
35840
|
+
if (e !== null) {
|
|
35841
|
+
e.parent = parent;
|
|
35842
|
+
|
|
35843
|
+
if (parent !== null) {
|
|
35844
|
+
push_effect(e, parent);
|
|
35845
|
+
}
|
|
35846
|
+
|
|
35847
|
+
// if we're in a derived, add the effect there too
|
|
35848
|
+
if (
|
|
35849
|
+
active_reaction !== null &&
|
|
35850
|
+
(active_reaction.f & DERIVED) !== 0 &&
|
|
35851
|
+
(type & ROOT_EFFECT) === 0
|
|
35852
|
+
) {
|
|
35853
|
+
var derived = /** @type {Derived} */ (active_reaction);
|
|
35854
|
+
(derived.effects ??= []).push(e);
|
|
35855
|
+
}
|
|
35838
35856
|
}
|
|
35839
35857
|
}
|
|
35840
35858
|
|
|
@@ -35897,7 +35915,7 @@ function user_pre_effect(fn) {
|
|
|
35897
35915
|
*/
|
|
35898
35916
|
function component_root(fn) {
|
|
35899
35917
|
Batch.ensure();
|
|
35900
|
-
const effect = create_effect(ROOT_EFFECT, fn, true);
|
|
35918
|
+
const effect = create_effect(ROOT_EFFECT | EFFECT_PRESERVED, fn, true);
|
|
35901
35919
|
|
|
35902
35920
|
return (options = {}) => {
|
|
35903
35921
|
return new Promise((fulfil) => {
|
|
@@ -36013,7 +36031,7 @@ function block(fn, flags = 0) {
|
|
|
36013
36031
|
* @param {boolean} [push]
|
|
36014
36032
|
*/
|
|
36015
36033
|
function branch(fn, push = true) {
|
|
36016
|
-
return create_effect(BRANCH_EFFECT, fn, true, push);
|
|
36034
|
+
return create_effect(BRANCH_EFFECT | EFFECT_PRESERVED, fn, true, push);
|
|
36017
36035
|
}
|
|
36018
36036
|
|
|
36019
36037
|
/**
|
|
@@ -42774,7 +42792,7 @@ function parseConfig(config) {
|
|
|
42774
42792
|
}
|
|
42775
42793
|
}
|
|
42776
42794
|
|
|
42777
|
-
const version = "4.0.0-alpha.
|
|
42795
|
+
const version = "4.0.0-alpha.16";
|
|
42778
42796
|
function attachDraftSwitcher(engine) {
|
|
42779
42797
|
if (engine.hasDraft()) {
|
|
42780
42798
|
const container = document.createElement("div");
|