@riebeckite/plugin-share 0.0.14 → 0.0.16
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/README.md +5 -4
- package/README_ja.md +4 -3
- package/dist/index.d.ts +3 -4
- package/dist/index.js +6 -8
- package/package.json +2 -2
- package/style.css +0 -5
package/README.md
CHANGED
|
@@ -11,9 +11,9 @@ JavaScript; only the copy-link action is a progressive enhancement.
|
|
|
11
11
|
|
|
12
12
|
`share()` resolves each note's `permalink` to an absolute URL, composes the
|
|
13
13
|
service URLs from the note title and URL, and inserts the controls near the
|
|
14
|
-
article.
|
|
15
|
-
route renders
|
|
16
|
-
feeds.
|
|
14
|
+
article. The controls are inserted into the manifest entry's HTML, which Core
|
|
15
|
+
synchronizes with the content the route renders, so they appear on generated
|
|
16
|
+
pages and in feeds.
|
|
17
17
|
|
|
18
18
|
Supported services:
|
|
19
19
|
|
|
@@ -139,4 +139,5 @@ optional `className` is added to the root without replacing them.
|
|
|
139
139
|
|
|
140
140
|
## See also
|
|
141
141
|
|
|
142
|
-
- [Plugin guide](../../../docs/en/reference/plugin-api.md)
|
|
142
|
+
- [Plugin guide](../../../docs/en/docs/reference/plugin-api.md)
|
|
143
|
+
|
package/README_ja.md
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
|
|
12
12
|
`share()` は各ノートの `permalink` を絶対 URL に解決し、ノートのタイトルと URL
|
|
13
13
|
からサービスごとの共有 URL を組み立て、記事の近くにコントロールを挿入します。
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
挿入先はマニフェストエントリの HTML で、Core がそれをコンテンツルートの描画
|
|
15
|
+
HTML と同期するため、生成ページとフィードの両方に反映されます。
|
|
16
16
|
|
|
17
17
|
対応サービスは次のとおりです。
|
|
18
18
|
|
|
@@ -139,4 +139,5 @@ import "@riebeckite/plugin-share/style.css";
|
|
|
139
139
|
|
|
140
140
|
## 関連
|
|
141
141
|
|
|
142
|
-
- [プラグインガイド](../../../docs/ja/reference/plugin-api.md)
|
|
142
|
+
- [プラグインガイド](../../../docs/ja/docs/reference/plugin-api.md)
|
|
143
|
+
|
package/dist/index.d.ts
CHANGED
|
@@ -10,10 +10,9 @@ export declare const SHARE_PLUGIN_NAME = "share";
|
|
|
10
10
|
* Per-article share controls.
|
|
11
11
|
*
|
|
12
12
|
* For every entry the plugin builds absolute share URLs for the configured
|
|
13
|
-
* services and injects the controls into
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* enhanced at runtime.
|
|
13
|
+
* services and injects the controls into the manifest entry HTML, which is the
|
|
14
|
+
* final rendering source. The links are ordinary anchors, so they work without
|
|
15
|
+
* JavaScript; only the copy-link action is enhanced at runtime.
|
|
17
16
|
*/
|
|
18
17
|
export declare function share(options?: ShareOptions): import("@riebeckite/core").RiebeckitePlugin<ShareOptions>;
|
|
19
18
|
/** Alias matching the `*Plugin` suffix used by other plugin factories. */
|
package/dist/index.js
CHANGED
|
@@ -246,7 +246,8 @@ ${html}`;
|
|
|
246
246
|
}
|
|
247
247
|
const closeIndex = html.toLowerCase().lastIndexOf("</article>");
|
|
248
248
|
if (closeIndex !== -1) {
|
|
249
|
-
|
|
249
|
+
const articleEnd = closeIndex + "</article>".length;
|
|
250
|
+
return `${html.slice(0, articleEnd)}${block}${html.slice(articleEnd)}`;
|
|
250
251
|
}
|
|
251
252
|
return `${html}
|
|
252
253
|
${block}`;
|
|
@@ -327,14 +328,14 @@ function copyWithExecCommand(value) {
|
|
|
327
328
|
var SHARE_PLUGIN_NAME = "share";
|
|
328
329
|
function share(options = {}) {
|
|
329
330
|
const resolved = resolveShareOptions(options);
|
|
330
|
-
const processed = /* @__PURE__ */ new Map();
|
|
331
331
|
return definePlugin({
|
|
332
332
|
name: SHARE_PLUGIN_NAME,
|
|
333
|
+
processedContentCache: {
|
|
334
|
+
version: "share-v1",
|
|
335
|
+
dependencyMode: "none"
|
|
336
|
+
},
|
|
333
337
|
options,
|
|
334
338
|
validateOptions: validateShareOptions,
|
|
335
|
-
onPostProcessed: (context) => {
|
|
336
|
-
processed.set(context.slug, context.content);
|
|
337
|
-
},
|
|
338
339
|
onManifestCreated: (context) => {
|
|
339
340
|
const { manifest, config } = context;
|
|
340
341
|
if (!config) return;
|
|
@@ -347,10 +348,7 @@ function share(options = {}) {
|
|
|
347
348
|
if (block === "") continue;
|
|
348
349
|
const html = injectShareControls(entry.html, block, resolved.placement);
|
|
349
350
|
entry.html = html;
|
|
350
|
-
const content = processed.get(entry.slug);
|
|
351
|
-
if (content) content.html = html;
|
|
352
351
|
}
|
|
353
|
-
processed.clear();
|
|
354
352
|
},
|
|
355
353
|
assets: [createStyleAsset(SHARE_PLUGIN_NAME)],
|
|
356
354
|
clientEntries: [createClientEntry(SHARE_PLUGIN_NAME, "initShare")]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riebeckite/plugin-share",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.16",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"./style.css": "./style.css"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@riebeckite/core": "0.0.
|
|
24
|
+
"@riebeckite/core": "0.0.16"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"tsx": "^4.22.4"
|