Skip to content
This repository has been archived by the owner on Nov 23, 2022. It is now read-only.

Lighthouse draftjs #613

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Lighthouse draftjs #613

wants to merge 5 commits into from

Conversation

Wagner3UB
Copy link
Collaborator

US33941

Added a button to draftjs toolbar to select a data-element inside a link. This option is showed only when both option, "link" and "lighthouse", are selected

Select options:
"Prenotazione appuntamento" -> produce sul link data-element="appointment-booking"
"Domande frequenti" -> produce sul link data-element="faq"
"Segnalazione disservizio" -> produce sul link data-element="report-inefficency"
"Dichiarazione di accessibilità" -> produce sul link data-element="accessibility-link"
"Informativa privacy" -> produce sul link data-element="privacy-policy-link"

To add the data-element to the link it was necessary add a function to push it inside the tag because the constructor of this element wasn't accessible.

Schermata 2022-11-22 alle 09 41 35

@Wagner3UB Wagner3UB self-assigned this Nov 22, 2022
@github-actions
Copy link

github-actions bot commented Nov 22, 2022

Bundle size diff

Old size New size Diff
11.95 MB 11.95 MB -1.14 KB (-0.01%)


import DraftJsDropdownButton from './DraftJsDropdownButton';

const AlignButtonComponent = (props) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'è un refuso, dai un nome specifico a questo componente

Comment on lines 62 to 66
export const AlignButton = injectLazyLibs(['draftJsCreateBlockStyleButton'])(
AlignButtonComponent,
);

export default React.memo(AlignButton);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Idem qua come sopra, occhio quando copi e incolli!

import React from 'react';
import { injectLazyLibs } from '@plone/volto/helpers/Loadable/Loadable';
import Icon from '@plone/volto/components/theme/Icon/Icon';
import showSVG from '@plone/volto/icons/show.svg';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questa icona dell'occhio non mi convince perchè viene utilizzata in generale per mostrare e nascondere un contenuto, non vorrei che venisse fraintesa, suggerisco di utilizzare una di queste due icone

  • un target, più generico

Screenshot 2022-11-22 alle 12 19 53

  • l'icona delle news che potrebbe vagamente assomigliare al faro di lighthouse però ditemi voi

Screenshot 2022-11-22 alle 12 19 33

Comment on lines 78 to 85
const renderDataElement = (element) => {
if (typeof document !== 'undefined') {
document.querySelector(`.lighthouse_${element} a`) &&
document
.querySelector(`.lighthouse_${element} a`)
.setAttribute('data-element', element);
}
};
Copy link
Contributor

@SaraBianchi SaraBianchi Nov 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Questo seleziona un elemento con una classe specifica ma se creo due link con lo stesso data element il secondo è vuoto, qui ho inserito nel secondo e nel terzo link lo stesso data element, il secondo non popola neanche la classe
Screenshot 2022-11-22 alle 12 52 52

Chiedo, non è possibile invece di utilizzare un selettore, applicare direttamente il data element ad un tag <a> invece che a un <p>?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants