Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-append-image",
name: "Append Image to Document",
description: "Appends an image to the end of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertInlineImageRequest)",
version: "0.0.10",
version: "0.0.11",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/google_docs/actions/append-text/append-text.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-append-text",
name: "Append Text",
description: "Append text to an existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#InsertTextRequest)",
version: "0.1.9",
version: "0.1.10",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default {
...others,
key: "google_docs-create-document-from-template",
name: "Create New Document From Template",
version: "0.0.5",
version: "0.0.6",
description,
type,
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-create-document",
name: "Create a New Document",
description: "Create a new document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/create)",
version: "0.2.0",
version: "0.2.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default {
...others,
key: "google_docs-find-document",
name: "Find Document",
version: "0.0.4",
version: "0.0.5",
description,
type,
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export default {
key: "google_docs-get-document",
name: "Get Document",
description: "Get the contents of the latest version of a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)",
version: "0.1.9",
version: "0.1.10",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-get-tab-content",
name: "Get Tab Content",
description: "Get the content of a tab in a document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/get)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-insert-page-break",
name: "Insert Page Break",
description: "Insert a page break into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#insertpagebreakrequest)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-insert-table",
name: "Insert Table",
description: "Insert a table into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttablerequest)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
2 changes: 1 addition & 1 deletion components/google_docs/actions/insert-text/insert-text.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-insert-text",
name: "Insert Text",
description: "Insert text into a document. [See the documentation](https://developers.google.com/workspace/docs/api/reference/rest/v1/documents/request#inserttextrequest)",
version: "0.0.3",
version: "0.0.4",
annotations: {
destructiveHint: false,
openWorldHint: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "google_docs-replace-image",
name: "Replace Image",
description: "Replace image in a existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#ReplaceImageRequest)",
version: "0.0.10",
version: "0.0.11",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down
64 changes: 47 additions & 17 deletions components/google_docs/actions/replace-text/replace-text.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import googleDocs from "../../google_docs.app.mjs";
export default {
key: "google_docs-replace-text",
name: "Replace Text",
description: "Replace all instances of matched text in an existing document. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#ReplaceAllTextRequest)",
version: "0.0.10",
description: "Replace all instances of matched text in an existing document. Supports Markdown formatting in the replacement text. [See the documentation](https://developers.google.com/docs/api/reference/rest/v1/documents/request#ReplaceAllTextRequest)",
version: "0.0.11",
annotations: {
destructiveHint: true,
openWorldHint: true,
Expand Down Expand Up @@ -33,6 +33,14 @@ export default {
"text",
],
label: "New Text",
description: "The replacement text. Can include Markdown formatting (bold, italic, code, links, headings, lists, etc.).",
},
enableMarkdown: {
type: "boolean",
label: "Parse as Markdown",
description: "Enable Markdown parsing for the replacement text. When enabled, Markdown syntax (e.g., **bold**, *italic*, [links](url), `code`) will be converted to Google Docs formatting.",
default: false,
optional: true,
},
matchCase: {
propDefinition: [
Expand All @@ -55,21 +63,43 @@ export default {
},
},
async run({ $ }) {
const text = {
replaceText: this.text,
containsText: {
text: this.replaced,
matchCase: this.matchCase,
},
tabsCriteria: this.tabIds
? {
tabIds: this.tabIds,
}
: undefined,
};
await this.googleDocs.replaceText(this.docId, text);
const doc = this.googleDocs.getDocument(this.docId);
$.export("$summary", `Successfully replaced text in doc with ID: ${this.docId}`);
const {
googleDocs,
docId,
replaced,
text,
enableMarkdown,
matchCase,
tabIds,
} = this;

if (enableMarkdown) {
// Use Markdown-aware replacement
await googleDocs.replaceTextWithMarkdown({
documentId: docId,
textToReplace: replaced,
markdownReplacement: text,
matchCase,
tabIds,
});
} else {
// Use plain text replacement (original behavior)
const textObject = {
replaceText: text,
containsText: {
text: replaced,
matchCase,
},
tabsCriteria: tabIds
? {
tabIds,
}
: undefined,
};
await googleDocs.replaceText(docId, textObject);
}
const doc = await googleDocs.getDocument(docId);
$.export("$summary", `Successfully replaced text in doc with ID: ${docId}`);
return doc;
},
};
Loading
Loading