@webjourney/vite-plugins 1.2.9 → 1.2.10-0

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,wBAAgB,uBAAuB;;;oBAKnB,MAAM,MAAM,MAAM;;;;EA0MrC;AAED,wBAAgB,sBAAsB;;;6BAKT,MAAM;EAoBlC;AAED,wBAAgB,iBAAiB;;;oBAvOb,MAAM,MAAM,MAAM;;;;;;;6BAiNT,MAAM;KA0BlC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,wBAAgB,uBAAuB;;;oBAKnB,MAAM,MAAM,MAAM;;;;EA6OrC;AAED,wBAAgB,sBAAsB;;;6BAKT,MAAM;EAelC;AAED,wBAAgB,iBAAiB;;;oBArQb,MAAM,MAAM,MAAM;;;;;;;6BAoPT,MAAM;KAqBlC"}
package/dist/index.js CHANGED
@@ -116,6 +116,19 @@ export function webjourneyElementTagger() {
116
116
  modified = true;
117
117
  }
118
118
  }
119
+ // Handle anchor elements
120
+ if (tagName === 'a') {
121
+ // Check if anchor has href attribute
122
+ const hasHref = openingElement.attributes.some((attr) => t.isJSXAttribute(attr) &&
123
+ t.isJSXIdentifier(attr.name) &&
124
+ attr.name.name === 'href');
125
+ if (hasHref) {
126
+ // Generate unique ID: filename:line
127
+ const elementId = `${relativePath}:${lineNumber}`;
128
+ openingElement.attributes.push(t.jsxAttribute(t.jsxIdentifier('data-wj-file'), t.stringLiteral(relativePath)), t.jsxAttribute(t.jsxIdentifier('data-wj-line'), t.stringLiteral(String(lineNumber))), t.jsxAttribute(t.jsxIdentifier('data-wj-type'), t.stringLiteral('link')), t.jsxAttribute(t.jsxIdentifier('data-wj-id'), t.stringLiteral(elementId)));
129
+ modified = true;
130
+ }
131
+ }
119
132
  }
120
133
  });
121
134
  if (modified) {
@@ -143,17 +156,13 @@ export function webjourneyPluginScript() {
143
156
  name: 'webjourney-plugin-script',
144
157
  enforce: 'pre',
145
158
  transformIndexHtml(html) {
146
- // Get project ID and badge visibility from environment variables
159
+ // Get project ID from environment variable
147
160
  const projectId = process.env.WEBJOURNEY_PROJECT_ID;
148
- const hideBadge = process.env.WEBJOURNEY_HIDE_BADGE === 'true';
149
- // Build the meta tags
150
- const projectIdTag = projectId
161
+ // Build the meta tag if project ID exists
162
+ const metaTag = projectId
151
163
  ? `<meta name="webjourney-project-id" content="${projectId}">\n `
152
164
  : '';
153
- const hideBadgeTag = hideBadge
154
- ? `<meta name="webjourney-hide-badge" content="true">\n `
155
- : '';
156
- return html.replace('</head>', `${projectIdTag}${hideBadgeTag}<script src="${webjourneyPluginScriptHost}/plugins/plugin.iife.js"></script></head>`);
165
+ return html.replace('</head>', `${metaTag}<script src="${webjourneyPluginScriptHost}/plugins/plugin.iife.js"></script></head>`);
157
166
  }
158
167
  };
159
168
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjourney/vite-plugins",
3
- "version": "1.2.9",
3
+ "version": "1.2.10-0",
4
4
  "description": "Vite plugins for Webjourney WYSIWYG editing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",