@worktile/theia 2.2.8 → 2.2.9

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.
@@ -2097,7 +2097,7 @@
2097
2097
  else if (slate.Element.isElement(node) && node.type === exports.ElementKinds.paragraph) {
2098
2098
  var textIndent = node.textIndent;
2099
2099
  if (textIndent) {
2100
- slate.Transforms.setNodes(editor, { textIndent: undefined }, // remove textIndent
2100
+ slate.Transforms.setNodes(editor, { textIndent: undefined, indent: undefined }, // remove indent
2101
2101
  { at: path });
2102
2102
  }
2103
2103
  }
@@ -2228,30 +2228,80 @@
2228
2228
  }
2229
2229
  };
2230
2230
 
2231
+ var HeadingEditor = {
2232
+ setHeading: function (editor, heading) {
2233
+ slate.Editor.withoutNormalizing(editor, function () {
2234
+ var _a;
2235
+ var types = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.listItem];
2236
+ slate.Transforms.unwrapNodes(editor, {
2237
+ at: editor.selection,
2238
+ match: function (n) { return slate.Element.isElement(n) && types.includes(n.type); },
2239
+ mode: 'all',
2240
+ split: true
2241
+ });
2242
+ slate.Transforms.setNodes(editor, { type: heading });
2243
+ var entry = anchorBlockEntry(editor);
2244
+ var unMarks = (_a = {},
2245
+ _a[exports.MarkTypes.fontSize] = null,
2246
+ _a);
2247
+ if (entry) {
2248
+ setMarks(editor, unMarks, entry[1]);
2249
+ return;
2250
+ }
2251
+ setMarks(editor, unMarks, editor.selection);
2252
+ });
2253
+ },
2254
+ isHeadingActive: function (editor, heading) {
2255
+ var _a = __read(slate.Editor.nodes(editor, {
2256
+ match: function (n) { return slate.Element.isElement(n) && n.type === heading; },
2257
+ universal: true
2258
+ }), 1), match = _a[0];
2259
+ return !!match;
2260
+ }
2261
+ };
2262
+
2231
2263
  var autoFormatRules = [
2232
2264
  {
2233
2265
  type: exports.ElementKinds.heading_1,
2234
- markup: '#'
2266
+ markup: '#',
2267
+ format: function (editor) {
2268
+ HeadingEditor.setHeading(editor, exports.ElementKinds.heading_1);
2269
+ }
2235
2270
  },
2236
2271
  {
2237
2272
  type: exports.ElementKinds.heading_2,
2238
- markup: '##'
2273
+ markup: '##',
2274
+ format: function (editor) {
2275
+ HeadingEditor.setHeading(editor, exports.ElementKinds.heading_2);
2276
+ }
2239
2277
  },
2240
2278
  {
2241
2279
  type: exports.ElementKinds.heading_3,
2242
- markup: '###'
2280
+ markup: '###',
2281
+ format: function (editor) {
2282
+ HeadingEditor.setHeading(editor, exports.ElementKinds.heading_3);
2283
+ }
2243
2284
  },
2244
2285
  {
2245
2286
  type: exports.ElementKinds.heading_4,
2246
- markup: '####'
2287
+ markup: '####',
2288
+ format: function (editor) {
2289
+ HeadingEditor.setHeading(editor, exports.ElementKinds.heading_4);
2290
+ }
2247
2291
  },
2248
2292
  {
2249
2293
  type: exports.ElementKinds.heading_5,
2250
- markup: '#####'
2294
+ markup: '#####',
2295
+ format: function (editor) {
2296
+ HeadingEditor.setHeading(editor, exports.ElementKinds.heading_5);
2297
+ }
2251
2298
  },
2252
2299
  {
2253
2300
  type: exports.ElementKinds.heading_6,
2254
- markup: '######'
2301
+ markup: '######',
2302
+ format: function (editor) {
2303
+ HeadingEditor.setHeading(editor, exports.ElementKinds.heading_6);
2304
+ }
2255
2305
  },
2256
2306
  {
2257
2307
  type: exports.ElementKinds.blockquote,
@@ -6106,38 +6156,6 @@
6106
6156
  }
6107
6157
  ];
6108
6158
 
6109
- var HeadingEditor = {
6110
- setHeading: function (editor, heading) {
6111
- slate.Editor.withoutNormalizing(editor, function () {
6112
- var _a;
6113
- var types = [exports.ElementKinds.bulletedList, exports.ElementKinds.numberedList, exports.ElementKinds.listItem];
6114
- slate.Transforms.unwrapNodes(editor, {
6115
- at: editor.selection,
6116
- match: function (n) { return slate.Element.isElement(n) && types.includes(n.type); },
6117
- mode: 'all',
6118
- split: true
6119
- });
6120
- slate.Transforms.setNodes(editor, { type: heading });
6121
- var entry = anchorBlockEntry(editor);
6122
- var unMarks = (_a = {},
6123
- _a[exports.MarkTypes.fontSize] = null,
6124
- _a);
6125
- if (entry) {
6126
- setMarks(editor, unMarks, entry[1]);
6127
- return;
6128
- }
6129
- setMarks(editor, unMarks, editor.selection);
6130
- });
6131
- },
6132
- isHeadingActive: function (editor, heading) {
6133
- var _a = __read(slate.Editor.nodes(editor, {
6134
- match: function (n) { return slate.Element.isElement(n) && n.type === heading; },
6135
- universal: true
6136
- }), 1), match = _a[0];
6137
- return !!match;
6138
- }
6139
- };
6140
-
6141
6159
  var HeadingOptions = [
6142
6160
  {
6143
6161
  name: '正文',