autoblogger 0.2.27 → 0.2.29

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/ui.mjs CHANGED
@@ -1076,6 +1076,9 @@ function getAttributesFromExtensions(extensions) {
1076
1076
  keepOnSplit: true,
1077
1077
  isRequired: false
1078
1078
  };
1079
+ const nodeExtensionTypes = nodeExtensions.filter((ext) => ext.name !== "text").map((ext) => ext.name);
1080
+ const markExtensionTypes = markExtensions.map((ext) => ext.name);
1081
+ const allExtensionTypes = [...nodeExtensionTypes, ...markExtensionTypes];
1079
1082
  extensions.forEach((extension) => {
1080
1083
  const context = {
1081
1084
  name: extension.name,
@@ -1093,7 +1096,19 @@ function getAttributesFromExtensions(extensions) {
1093
1096
  }
1094
1097
  const globalAttributes = addGlobalAttributes();
1095
1098
  globalAttributes.forEach((globalAttribute) => {
1096
- globalAttribute.types.forEach((type) => {
1099
+ let resolvedTypes;
1100
+ if (Array.isArray(globalAttribute.types)) {
1101
+ resolvedTypes = globalAttribute.types;
1102
+ } else if (globalAttribute.types === "*") {
1103
+ resolvedTypes = allExtensionTypes;
1104
+ } else if (globalAttribute.types === "nodes") {
1105
+ resolvedTypes = nodeExtensionTypes;
1106
+ } else if (globalAttribute.types === "marks") {
1107
+ resolvedTypes = markExtensionTypes;
1108
+ } else {
1109
+ resolvedTypes = [];
1110
+ }
1111
+ resolvedTypes.forEach((type) => {
1097
1112
  Object.entries(globalAttribute.attributes).forEach(([name, attribute]) => {
1098
1113
  extensionAttributes.push({
1099
1114
  type,
@@ -1529,6 +1544,9 @@ function isMarkActive(state, typeOrName, attributes = {}) {
1529
1544
  const from = $from.pos;
1530
1545
  const to = $to.pos;
1531
1546
  state.doc.nodesBetween(from, to, (node, pos) => {
1547
+ if (type && node.inlineContent && !node.type.allowsMarkType(type)) {
1548
+ return false;
1549
+ }
1532
1550
  if (!node.isText && !node.marks.length) {
1533
1551
  return;
1534
1552
  }
@@ -3030,8 +3048,12 @@ var init_dist = __esm({
3030
3048
  }
3031
3049
  });
3032
3050
  };
3033
- if (view.hasFocus() && position === null || position === false) {
3034
- return true;
3051
+ try {
3052
+ if (view.hasFocus() && position === null || position === false) {
3053
+ return true;
3054
+ }
3055
+ } catch {
3056
+ return false;
3035
3057
  }
3036
3058
  if (dispatch && position === null && !isTextSelection(editor.state.selection)) {
3037
3059
  delayedFocus();
@@ -4307,6 +4329,39 @@ var init_dist = __esm({
4307
4329
  };
4308
4330
  }, baseDispatch);
4309
4331
  }
4332
+ /**
4333
+ * Get the composed transformPastedHTML function from all extensions.
4334
+ * @param baseTransform The base transform function (e.g. from the editor props)
4335
+ * @returns A composed transform function that chains all extension transforms
4336
+ */
4337
+ transformPastedHTML(baseTransform) {
4338
+ const { editor } = this;
4339
+ const extensions = sortExtensions([...this.extensions]);
4340
+ return extensions.reduce(
4341
+ (transform, extension) => {
4342
+ const context = {
4343
+ name: extension.name,
4344
+ options: extension.options,
4345
+ storage: this.editor.extensionStorage[extension.name],
4346
+ editor,
4347
+ type: getSchemaTypeByName(extension.name, this.schema)
4348
+ };
4349
+ const extensionTransform = getExtensionField(
4350
+ extension,
4351
+ "transformPastedHTML",
4352
+ context
4353
+ );
4354
+ if (!extensionTransform) {
4355
+ return transform;
4356
+ }
4357
+ return (html, view) => {
4358
+ const transformedHtml = transform(html, view);
4359
+ return extensionTransform.call(context, transformedHtml);
4360
+ };
4361
+ },
4362
+ baseTransform || ((html) => html)
4363
+ );
4364
+ }
4310
4365
  get markViews() {
4311
4366
  const { editor } = this;
4312
4367
  const { markExtensions } = splitExtensions(this.extensions);
@@ -5462,11 +5517,13 @@ var init_dist2 = __esm({
5462
5517
  });
5463
5518
 
5464
5519
  // node_modules/@tiptap/extension-paragraph/dist/index.js
5465
- var Paragraph, index_default2;
5520
+ var EMPTY_PARAGRAPH_MARKDOWN, NBSP_CHAR, Paragraph, index_default2;
5466
5521
  var init_dist3 = __esm({
5467
5522
  "node_modules/@tiptap/extension-paragraph/dist/index.js"() {
5468
5523
  "use strict";
5469
5524
  init_dist();
5525
+ EMPTY_PARAGRAPH_MARKDOWN = " ";
5526
+ NBSP_CHAR = "\xA0";
5470
5527
  Paragraph = Node3.create({
5471
5528
  name: "paragraph",
5472
5529
  priority: 1e3,
@@ -5488,18 +5545,21 @@ var init_dist3 = __esm({
5488
5545
  if (tokens.length === 1 && tokens[0].type === "image") {
5489
5546
  return helpers.parseChildren([tokens[0]]);
5490
5547
  }
5491
- return helpers.createNode(
5492
- "paragraph",
5493
- void 0,
5494
- // no attributes for paragraph
5495
- helpers.parseInline(tokens)
5496
- );
5548
+ const content = helpers.parseInline(tokens);
5549
+ if (content.length === 1 && content[0].type === "text" && (content[0].text === EMPTY_PARAGRAPH_MARKDOWN || content[0].text === NBSP_CHAR)) {
5550
+ return helpers.createNode("paragraph", void 0, []);
5551
+ }
5552
+ return helpers.createNode("paragraph", void 0, content);
5497
5553
  },
5498
5554
  renderMarkdown: (node, h2) => {
5499
- if (!node || !Array.isArray(node.content)) {
5555
+ if (!node) {
5500
5556
  return "";
5501
5557
  }
5502
- return h2.renderChildren(node.content);
5558
+ const content = Array.isArray(node.content) ? node.content : [];
5559
+ if (content.length === 0) {
5560
+ return EMPTY_PARAGRAPH_MARKDOWN;
5561
+ }
5562
+ return h2.renderChildren(content);
5503
5563
  },
5504
5564
  addCommands() {
5505
5565
  return {
@@ -5812,11 +5872,13 @@ var init_dist4 = __esm({
5812
5872
  node,
5813
5873
  h2,
5814
5874
  (context) => {
5875
+ var _a, _b;
5815
5876
  if (context.parentType === "bulletList") {
5816
5877
  return "- ";
5817
5878
  }
5818
5879
  if (context.parentType === "orderedList") {
5819
- return `${context.index + 1}. `;
5880
+ const start = ((_b = (_a = context.meta) == null ? void 0 : _a.parentAttrs) == null ? void 0 : _b.start) || 1;
5881
+ return `${start + context.index}. `;
5820
5882
  }
5821
5883
  return "- ";
5822
5884
  },
@@ -14129,20 +14191,7 @@ function AutobloggerDashboard({
14129
14191
  }) {
14130
14192
  const resolvedChatApiPath = chatApiPath || `${apiBasePath}/ai/chat`;
14131
14193
  const resolvedHistoryApiPath = historyApiPath || `${apiBasePath}/chat/history`;
14132
- useEffect26(() => {
14133
- const viewportMeta = document.querySelector('meta[name="viewport"]');
14134
- if (viewportMeta) {
14135
- const originalContent = viewportMeta.getAttribute("content") || "";
14136
- if (!originalContent.includes("user-scalable")) {
14137
- const newContent = originalContent + ", user-scalable=no, maximum-scale=1";
14138
- viewportMeta.setAttribute("content", newContent);
14139
- return () => {
14140
- viewportMeta.setAttribute("content", originalContent);
14141
- };
14142
- }
14143
- }
14144
- }, []);
14145
- return /* @__PURE__ */ jsx44(ThemeProvider, { className: "h-dvh bg-background text-foreground flex flex-col overscroll-none touch-manipulation", children: /* @__PURE__ */ jsx44(
14194
+ return /* @__PURE__ */ jsx44(ThemeProvider, { className: "h-dvh bg-background text-foreground flex flex-col overscroll-none", children: /* @__PURE__ */ jsx44(
14146
14195
  ChatProvider,
14147
14196
  {
14148
14197
  apiBasePath,