Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change dependency: ngx-jodit instead of jodit-angular #736

Merged
merged 5 commits into from
Jan 25, 2023

Conversation

jamesrwelch
Copy link
Contributor

Fixes #735

@pjmonks pjmonks self-assigned this Jan 20, 2023
@pjmonks
Copy link
Contributor

pjmonks commented Jan 20, 2023

image

I can't seem to switch back to develop branch due to npm install changing a lot of things on my local build, so can't check this myself. But did this custom toolbar button originally have an icon? I can't remember if it existed before or it was a change I made to the pending PR #572

@pjmonks
Copy link
Contributor

pjmonks commented Jan 20, 2023

I see the following TypeScript warnings now:

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/src/config.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/src/core/constants.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/src/types/storage.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/types/types/storage.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

I think maybe the tsconfig.app.json file could have an excludes list added with these files to remove the warnings, but not sure. See https://stackoverflow.com/questions/57729518/how-to-get-rid-of-the-warning-ts-file-is-part-of-the-typescript-compilation-but for more information perhaps.

@pjmonks
Copy link
Contributor

pjmonks commented Jan 20, 2023

Found a bug when editing existing HTML content:

  1. Pick a catalogue item and edit the description. Set the value through the HTML editor and save.
  2. Confirm the description was saved - the catalogue item should reload and you'll see your changes.
  3. Now edit the description again. The HTML editor is blank.
  4. Switch the Markdown editor option though and the content is there.

Some sort of binding issue it seems, perhaps [(ngModel)] isn't supported in this now Jodit wrapper?

Copy link
Contributor

@pjmonks pjmonks left a comment

Choose a reason for hiding this comment

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

The code changes look fine but found some functional issues when testing. Could you review them please?

package.json Outdated
@@ -60,8 +60,7 @@
"diff-match-patch": "^1.0.5",
"dmn-js": "^10.1.0",
"graphlib": "2.1.8",
"jodit": "^3.5.4",
"jodit-angular": "^1.12.3",
"jodit": "^3.24.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we be trying to avoid the ^ symbol for npm package dependencies? The various bots running against the repo to check dependencies seem to want to change them to hard, concrete versions to avoid any version mismatch.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've read this: https://docs.renovatebot.com/dependency-pinning/. It all makes sense... I think you're right, we should go with their suggestion and pin dependencies. I've pushed a commit to do this

@jamesrwelch
Copy link
Contributor Author

image

I can't seem to switch back to develop branch due to npm install changing a lot of things on my local build, so can't check this myself. But did this custom toolbar button originally have an icon? I can't remember if it existed before or it was a change I made to the pending PR #572

You're right - they've changed the way icons work in Jodit. I couldn't find one I liked in their default set, so I've pushed a commit with a new SVG and a change to code.

@jamesrwelch
Copy link
Contributor Author

Found a bug when editing existing HTML content:

  1. Pick a catalogue item and edit the description. Set the value through the HTML editor and save.
  2. Confirm the description was saved - the catalogue item should reload and you'll see your changes.
  3. Now edit the description again. The HTML editor is blank.
  4. Switch the Markdown editor option though and the content is there.

Some sort of binding issue it seems, perhaps [(ngModel)] isn't supported in this now Jodit wrapper?

Great catch - thank you! I believe I've now done the right thing by binding value instead. This caused issues with the name property, which I've removed and I think this doesn't cause any issues, but could you double-check when you re-test, please?

@jamesrwelch
Copy link
Contributor Author

I see the following TypeScript warnings now:

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/src/config.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/src/core/constants.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/src/types/storage.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

Warning: C:/Code/Mauro/MauroDataMapper/mdm-ui/node_modules/jodit/types/types/storage.ts is part of the TypeScript compilation but it's unused.
Add only entry points to the 'files' or 'include' properties in your tsconfig.

I think maybe the tsconfig.app.json file could have an excludes list added with these files to remove the warnings, but not sure. See https://stackoverflow.com/questions/57729518/how-to-get-rid-of-the-warning-ts-file-is-part-of-the-typescript-compilation-but for more information perhaps.

I don't get these when I upgrade to angular 14, so maybe this is just a temporary thing. There are lots of other warnings then though, so maybe we could have a separate ticket to remove any remaining build warnings once we've completed the upgrade

@jamesrwelch
Copy link
Contributor Author

@pjmonks Thank you so much for your thorough review - I'm glad we're picking up these issues that would have been difficult to spot amongst a much bigger upgrade.
I believe I've addressed all your issues, so please feel free to re-test. However, although ng serve is working for me, I'm getting a build error running npm run build. I'll look into this next - would be interesting to hear if you have the same problem. In bouncing between branches I've been finding it helpful to do npm cache verify / npm cache clear --false in order to get clean installs on a different branch. I'll be glad when I can stop doing that!

@jamesrwelch
Copy link
Contributor Author

I'm getting a build error running npm run build. I'll look into this next - would be interesting to hear if you have the same problem. In bouncing between branches I've been finding it helpful to do npm cache verify / npm cache clear --false in order to get clean installs on a different branch. I'll be glad when I can stop doing that!

I've done some more investigation:

  • This only occurs during npm run build and not building npm run dist, so it's not a huge problem. It relates to the source maps for debugging TS code.
  • It happens for me building develop (recent, and an older version), so it's not a regression
  • I don't get the errors in my upgrade to Angular 14, which will be my next PR after this.

So I think we might be ready for re-testing on this one 👍

@pjmonks pjmonks self-requested a review January 25, 2023 09:38
Copy link
Contributor

@pjmonks pjmonks left a comment

Choose a reason for hiding this comment

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

Re-tested and the changes are functioning better now, looks no different using the new Jodit wrapper compared to before 👍

Approved ✔️

@pjmonks pjmonks merged commit 037e76e into develop Jan 25, 2023
@pjmonks pjmonks deleted the feature/gh-735 branch January 25, 2023 10:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Angular Jodit dependency
2 participants