-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
…sion, in might change in the future) review
} | ||
|
||
private updateValue(): void { | ||
if (JSON.stringify(this.oldModel) === JSON.stringify(this.model)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
personnellement, j'inverserais la condition du if et je mettrais le setContent a l’intérieur. Ça éviterait un return "vide".
@Prop() | ||
public scrollableContainer: string; | ||
|
||
protected id: string = `mTextarea-${uuid.generate()}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modifier l'id pour 'mRichTextEditor-${uuid.generate()}'
public getInput(): HTMLElement | null { | ||
const selector: string = this.as<InputStateInputSelector>()!.selector || 'input, textarea, [contenteditable=true]'; | ||
const elements: NodeListOf<Element> = this.$el.querySelectorAll(selector); | ||
if (elements.length > 1 || elements.length === 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if(elements.length != 1)
src/utils/filter/htmlFilter.ts
Outdated
} | ||
|
||
export function replaceTags(tags: string[], replace: string, html: string): string { | ||
tags.forEach((tag) => { html = replaceTag(tag, replace, html); }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
déjà fait mais pas encore pushé
src/utils/filter/htmlFilter.ts
Outdated
@@ -0,0 +1,44 @@ | |||
/* tslint:disable:no-console */ | |||
|
|||
export function filterNewLines(html: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pas bête! je vais tester ça!
</m-icon><span class="m-validation-message__text">{{ errorMessage }}</span> | ||
</p> | ||
<p class="m-validation-message__valid" v-if="hasValidMessage && isValid"> | ||
<m-icon name="check" :svg-title="titleValidIcon" class="m-validation-message__valid__icon"></m-icon> | ||
<m-icon name="m-svg__confirmation" :svg-title="titleValidIcon" class="m-validation-message__valid__icon"></m-icon> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D’après le git blame, ça fait parti de l’intégration
import { RICH_TEXT } from '../component-names'; | ||
import WithRender from './rich-text.html?style=./rich-text.scss'; | ||
|
||
require('froala-editor/css/froala_editor.pkgd.min.css'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Si on le mets pas l'affichage "riche" se fait pas.
|
||
function cleanHtml(html: string): string { | ||
// delete new lines so the regexps will work | ||
html = filterNewLines(html); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je vais regarder ca. Je pense que ca marchera pour les filters mais pas les replace et erase. Je pense que le comportement de la methode est le meme que l'option pasteDeniedTags : "Tags that are removed together with their content". Et on veut pas toujours effacer le contenu.
|
||
function cleanHtml(html: string): string { | ||
// delete new lines so the regexps will work | ||
html = filterNewLines(html); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
et j'utiliserai l'option si le comportement est le même
return html; | ||
} | ||
|
||
class PopupPlugin { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je vais le faire!
src/components/index.ts
Outdated
@@ -116,6 +121,8 @@ const ComponentsPlugin: PluginObject<any> = { | |||
Vue.use(RadioPlugin); | |||
Vue.use(RadioGroupPlugin); | |||
Vue.use(RadioStylePlugin); | |||
Vue.use(RichTextLicensePlugin, { key: options.richTextOptions ? options.richTextOptions.key : undefined }); | |||
Vue.use(RichTextPlugin); // TODO : rich-text read-only mode will always be included. Are we all ok with that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c’était bon pour Vincent, le lecteur est léger.
src/components/component-names.ts
Outdated
@@ -43,6 +43,8 @@ export const PROGRESS_NAME: string = 'm-progress'; | |||
export const RADIO_NAME: string = 'm-radio'; | |||
export const RADIO_GROUP_NAME: string = 'm-radio-group'; | |||
export const RADIO_STYLE_NAME: string = 'm-radio-style'; | |||
export const RICH_TEXT: string = 'm-rich-text'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ajouter le suffixe _NAME.
src/components/index.ts
Outdated
@@ -116,6 +121,8 @@ const ComponentsPlugin: PluginObject<any> = { | |||
Vue.use(RadioPlugin); | |||
Vue.use(RadioGroupPlugin); | |||
Vue.use(RadioStylePlugin); | |||
Vue.use(RichTextLicensePlugin, { key: options.richTextOptions ? options.richTextOptions.key : undefined }); | |||
Vue.use(RichTextPlugin); // TODO : rich-text read-only mode will always be included. Are we all ok with that? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce fichier est destiné à mourir et le bundling des composantes sera à revoir. Donc je ne me casserais pas trop le becyk avec ça pour le moment.
min-height: 24px; | ||
flex: 1 1 auto; | ||
// overflow: hidden; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
enlever les commentaires s'ils ne sont pas nécessaires. Sinon mettre un commentaire sur le pourquoi on veut le garder (ex: à tester dans telle cas particulier)
@@ -2,7 +2,7 @@ import { PluginObject } from 'vue'; | |||
import Component from 'vue-class-component'; | |||
import { Prop } from 'vue-property-decorator'; | |||
|
|||
import { InputState } from '../../mixins/input-state/input-state'; | |||
import { InputState, InputStateMixin } from '../../mixins/input-state/input-state'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
J'ai mal à la tête avec tous ces input-style-state-management-mixin qui s'entremêlent!!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
je remets InputState partout, je demanderai a @Mboulianne s'il y avait une raison particulière à utiliser InputStateMixin quand il rentrera de vacances.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
C'était un commentaire gratuit de ma part :) C'est juste qu'avec le temps, j'ai complètement perdu le contrôle de toutes ces input-* mixins/state/etc. Ça se peut que ça soit bien correct de même.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
D'apres mes tests, ca marche que l'on utilise InputState ou InputStateMixin dans les as, puisque InputState implemente InputStateMixin. Donc, autant utiliser InputState partout je pense. En tout cas c'est fait ;-)
@@ -0,0 +1,51 @@ | |||
export class PopupPlugin { | |||
private editor: any; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La déclaration des attributs ici n'est pas nécessaire si on utilise le constructeur comme ceci:
constructor(private editor, private name: string, private pluginName: string, private buttonList: string[]) {
// this.editor = editor; plus nécessaire
this.buttonName = `${name}Popup`;
this.pluginName = `${name}Plugin`;
// this.buttonList = buttonList; plus nécessaire
}
Si on ne veut pas passer le pluginName en paramètre, on peut le premettre comme attribut. Au choix. Ça peut être laissé tel quel aussi, j'ai pas de préférences.
this.editor.popups.show(`${this.pluginName}.popup`, left, top, btn.outerHeight()); | ||
} | ||
|
||
hidePopup(): void { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mettre public
private pluginName: string; | ||
private buttonList: string[]; | ||
|
||
constructor(editor, name: string, buttonList: string[]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
editor: any
Est-ce qu'on a envisagé faire un d.ts de l'éditeur? du moins pour les propriétés et méthodes utilisées? Ça devient beaucoup plus simple pour la personne qui a à maintenir le code, surtout si elle n'a pas vraiment contribué à la composante.
|
||
protected currentTag: string = 'div'; | ||
protected listeningEvents: any[] = []; | ||
protected froalaEditor: any = undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beaucoup de any
. Est-ce que ça aurait été relativement simple de les typer selon la documentation qu'on a et l'utilisation qu'on en fait?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce code a été en grande partie de https://github.com/froala/vue-froala-wysiwyg. On l'a pas encore trop optimisé. C'est un bon point, on créera tous les types que l'on peut créer, mais je pense qu'il restera quand même quelques any (froala est codé en javascript + jQuery).
|
||
} | ||
|
||
export class RichTextLicensePlugin implements PluginObject<RichTextLicensePluginOptions | undefined> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ce code se retrouve à deux places. Ici et dans rich-text-license-plugin
@@ -82,7 +87,7 @@ | |||
"vue-class-component": "^6.1.1", | |||
"vue-property-decorator": "^6.0.0", | |||
"vue-template-compiler": "^2.5.9", | |||
"vue-template-loader": "^0.3.1" | |||
"vue-template-loader": "^1.0.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bien que ce soit une dev-dependency, je ne suis pas certain que c'est cette dépendance qui sera prise en compte dans Prisme si elle est redéfinie dans le package.json. C'était peut-être un bon cas de peer-dependency finalement!
package-lock.json
Outdated
} | ||
}, | ||
"@mrmlnc/readdir-enhanced": { | ||
"version": "2.2.1", | ||
"resolved": "https://registry.npmjs.org/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", | ||
"integrity": "sha512-bPHp6Ji8b41szTOcaP63VlnbbO5Ny6dwAATtY6JTjh5N2OLrb5Qk/Th5cRkRQhkWCt+EJsYrNB0MiL+Gpn6e3g==", | ||
"resolved": "https://maven.ulaval.ca/api/npm/npm/@mrmlnc/readdir-enhanced/-/readdir-enhanced-2.2.1.tgz", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ne doit pas avoir de références Maven sur github. Si ça ne fonctionne pas de votre bord, je peux le regénérer avant de merger.
@@ -93,7 +93,7 @@ export class VueFroala extends Vue { | |||
$.FroalaEditor.POPUP_TEMPLATES[`${pluginName}.popup`] = '[_BUTTONS_]'; | |||
|
|||
// The custom popup is defined inside a plugin (new or existing). | |||
$.FroalaEditor.PLUGINS[pluginName] = (editor) => { return new PopupPlugin(editor, name, buttonList); }; | |||
$.FroalaEditor.PLUGINS[pluginName] = (editor) => { return new PopupPlugin(name, editor, buttonList); }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Juste pour être certain... il y a eu ici une inversion des champs nom et editor dans le dernier commit. C'est voulu?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oublie ça... l'ordre a changé dans le constructeur!
@ulaval/modul-components
PR Checklist
https://jira.dti.ulaval.ca/browse/MODUL-152