@webjourney/vite-plugins 1.2.10-1 → 1.2.10-2

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.
Files changed (2) hide show
  1. package/dist/index.js +6 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -116,13 +116,13 @@ 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) &&
119
+ // Handle anchor elements and Link components
120
+ if (tagName === 'a' || tagName === 'Link') {
121
+ // Check if anchor has href attribute or Link has to attribute
122
+ const hasHrefOrTo = openingElement.attributes.some((attr) => t.isJSXAttribute(attr) &&
123
123
  t.isJSXIdentifier(attr.name) &&
124
- attr.name.name === 'href');
125
- if (hasHref) {
124
+ (attr.name.name === 'href' || attr.name.name === 'to'));
125
+ if (hasHrefOrTo) {
126
126
  // Generate unique ID: filename:line
127
127
  const elementId = `${relativePath}:${lineNumber}`;
128
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)));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webjourney/vite-plugins",
3
- "version": "1.2.10-1",
3
+ "version": "1.2.10-2",
4
4
  "description": "Vite plugins for Webjourney WYSIWYG editing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",