@pathmx/embed 0.7.4 → 0.7.6
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/index.ts +10 -11
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -121,7 +121,7 @@ export function EmbedPlugin(options: EmbedPluginOptions = {}): Plugin {
|
|
|
121
121
|
)
|
|
122
122
|
|
|
123
123
|
let index = 0
|
|
124
|
-
|
|
124
|
+
const output = app.rewriteHtml(content, [
|
|
125
125
|
[
|
|
126
126
|
"a[href]",
|
|
127
127
|
{
|
|
@@ -142,16 +142,15 @@ export function EmbedPlugin(options: EmbedPluginOptions = {}): Plugin {
|
|
|
142
142
|
},
|
|
143
143
|
],
|
|
144
144
|
])
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return content
|
|
145
|
+
if (output.includes('class="pmx-embed')) {
|
|
146
|
+
ctx.addAsset({ type: "stylesheet", name: "embed.css", text: styles })
|
|
147
|
+
if (output.includes("data-pmx-embed-x"))
|
|
148
|
+
await ctx.addBrowserBundle(
|
|
149
|
+
new URL("./browser/x.ts", import.meta.url),
|
|
150
|
+
"embed-x",
|
|
151
|
+
)
|
|
152
|
+
}
|
|
153
|
+
return output
|
|
155
154
|
},
|
|
156
155
|
}
|
|
157
156
|
}
|