@frontify/guideline-blocks-settings 0.29.2 → 0.29.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@frontify/guideline-blocks-settings",
3
- "version": "0.29.2",
3
+ "version": "0.29.4",
4
4
  "description": "Provides types and helpers for the guideline block development",
5
5
  "sideEffects": false,
6
6
  "main": "dist/index.umd.js",
@@ -56,14 +56,14 @@
56
56
  "@dnd-kit/core": "^6.0.8",
57
57
  "@dnd-kit/modifiers": "^6.0.1",
58
58
  "@dnd-kit/sortable": "^7.0.2",
59
- "@frontify/fondue": "12.0.0-beta.314",
59
+ "@frontify/fondue": "12.0.0-beta.316",
60
60
  "@react-aria/focus": "^3.14.0",
61
61
  "@react-stately/overlays": "^3.6.1",
62
62
  "@udecode/plate": "^21.5.0",
63
63
  "slate": "^0.94.1",
64
64
  "slate-react": "^0.98.3",
65
- "@frontify/app-bridge": "3.0.0-beta.89",
66
- "@frontify/sidebar-settings": "0.6.6"
65
+ "@frontify/app-bridge": "^3.0.0-beta.90",
66
+ "@frontify/sidebar-settings": "^0.6.8"
67
67
  },
68
68
  "peerDependencies": {
69
69
  "react": "^18",
@@ -10,6 +10,7 @@ import { convertToRteValue } from '../../helpers';
10
10
  const RteHtmlSelector = '[data-test-id="rte-content-html"]';
11
11
  const RichTextSelector = '[data-test-id="rich-text-editor"]';
12
12
  const ButtonSelector = '[data-test-id="button"]';
13
+ const CheckboxSelector = '[data-test-id="checkbox-icon-box"]';
13
14
  const ToolbarButtonSelector = '[data-testid="ToolbarButton"]';
14
15
  const InternalDocumentLinkSelector = '[data-test-id="internal-link-selector-document-link"]';
15
16
  const FloatingLinkModalSelector = '[data-test-id="floating-link-insert"]';
@@ -71,7 +72,33 @@ describe('RichTextEditor', () => {
71
72
  cy.get(InternalDocumentLinkSelector).click();
72
73
  cy.get(ButtonSelector).last().click();
73
74
  cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
74
- cy.get(RichTextSelector).find('a[href="/r/document"]').should('exist');
75
+ const linkTag = cy.get(RichTextSelector).find('a[href="/r/document"]');
76
+ linkTag.should('exist');
77
+ linkTag.should('have.attr', 'target', '_self');
78
+ });
79
+
80
+ it('should be able to select internal link with target blank', () => {
81
+ (appBridge.getDocumentGroups as SinonStub) = cy.stub().returns([]);
82
+ (appBridge.getAllDocuments as SinonStub) = cy.stub().returns(Promise.resolve(apiDocuments));
83
+
84
+ mount(
85
+ <RichTextEditor
86
+ isEditing={true}
87
+ plugins={new PluginComposer().setPlugin([new LinkPlugin({ appBridge })])}
88
+ value={convertToRteValue('p', 'This is a link')}
89
+ />,
90
+ );
91
+ cy.get(RichTextSelector).click();
92
+ cy.get(RichTextSelector).type('{selectall}');
93
+ cy.get(ToolbarButtonSelector).click();
94
+ cy.get(ButtonSelector).first().click();
95
+ cy.get(InternalDocumentLinkSelector).click();
96
+ cy.get(ButtonSelector).last().click();
97
+ cy.get(CheckboxSelector).click();
98
+ cy.get(FloatingLinkModalSelector).find(ButtonSelector).last().click();
99
+ const linkTag = cy.get(RichTextSelector).find('a[href="/r/document"]');
100
+ linkTag.should('exist');
101
+ linkTag.should('have.attr', 'target', '_blank');
75
102
  });
76
103
 
77
104
  it('should prepend the URL with https:// if not exists', () => {
@@ -13,7 +13,7 @@ const useButton = (props: ButtonRootProps): HTMLPropsAs<'a'> & { buttonStyle: Ri
13
13
  elementToAttributes: (element) => ({
14
14
  url: element.href,
15
15
  buttonStyle: element.buttonStyle || 'primary',
16
- target: element.target || '_blank',
16
+ target: element.target || '_self',
17
17
  }),
18
18
  });
19
19
 
@@ -88,7 +88,7 @@ export const createButtonPlugin = (appBridge: AppBridgeBlock) =>
88
88
  getNode: (el) => ({
89
89
  type,
90
90
  url: el.getAttribute('href'),
91
- target: el.getAttribute('target') || '_blank',
91
+ target: el.getAttribute('target') || '_self',
92
92
  }),
93
93
  },
94
94
  }),
@@ -11,7 +11,7 @@ const useLink = (props: LinkRootProps): HTMLPropsAs<'a'> => {
11
11
  ...props,
12
12
  elementToAttributes: (element) => ({
13
13
  href: element.url || element.chosenLink?.searchResult?.link || '',
14
- target: element.target || '_blank',
14
+ target: element.target || '_self',
15
15
  }),
16
16
  });
17
17