# extendify/3.2.1/src/Agent/workflows/content/edit-post-strings.js

Extendify, version 3.2.1. 37 lines.

- Page: https://pluginprobe.com/plugins/extendify/3.2.1/code/src/Agent/workflows/content/edit-post-strings.js
- Raw: https://pluginprobe.com/plugins/extendify/3.2.1/raw/src/Agent/workflows/content/edit-post-strings.js
- Modified: 2026-09-09T18:23:40+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/extendify/3.2.1/code/src/Agent/workflows/content/edit-post-strings.js#L10-L20`.

```javascript
import { BLOCK_ID_SEL } from '@agent/lib/block-el';
import { UpdatePostConfirm } from '@agent/workflows/content/components/UpdatePostConfirm';

const { context, abilities } = window.extAgentData;

// A wrapper carries its children's text, so counting it repeats every string.
const ownText = (el) => {
	let text = '';
	for (const node of el.childNodes) {
		if (node.nodeType === Node.TEXT_NODE) text += node.nodeValue;
	}
	return text.replace(/\s+/g, ' ').trim();
};

// One string is select-block's job; this earns its place on several.
const hasSeveralStrings = () => {
	const strings = new Set();
	for (const el of document.querySelectorAll(BLOCK_ID_SEL)) {
		const text = ownText(el);
		if (text) strings.add(text);
		if (strings.size > 1) return true;
	}
	return false;
};

export default {
	available: () =>
		abilities?.canEditPosts &&
		!context?.adminPage &&
		context?.postId &&
		!context?.isBlogPage &&
		context.usingBlockEditor &&
		hasSeveralStrings(),
	id: 'edit-post-strings',
	whenFinished: { component: UpdatePostConfirm },
};

```
