jodit | Jodit - Best WYSIWYG Editor | Editor library
kandi X-RAY | jodit Summary
kandi X-RAY | jodit Summary
An excellent WYSIWYG editor written in pure TypeScript without the use of additional libraries. Its file editor and image editor.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- The configuration object .
- Constructs an image editor .
- Create an iframe document .
- Adds event listeners to storage
- Apply style to a font
- Create a resizer instance .
- Creates a new FileBrowser .
- Initialize local files
- Bind table navigation
- send image files to upload
jodit Key Features
jodit Examples and Code Snippets
arrayAppend(responseStruct["images"],"#this_image.serverFile#");
#serializeJSON(responseStruct)#
var editor = new Jodit('#editor',
{
uploader: {
Community Discussions
Trending Discussions on jodit
QUESTION
I'm trying to test a react component using both jest and enzyme, i've installed the necessary package for them, then configured my setupTests.js as shown below, but still have the same error that Enzyme module is not found, and "shallow" as well. this is where i am trying to use Shallow from enzyme
...ANSWER
Answered 2021-Dec-28 at 15:38Install all these dependencies in dev. In my case I am using typescript, if you are using javascript, skip types. Run npm i -D and all these dependencies.
@types/enzyme @types/enzyme-adapter-react-16 enzyme enzyme-adapter-react-16 jest-environment-enzyme jest-enzyme @testing-library/jest-dom @testing-library/react @testing-library/user-event @types/jest ts-jest
In root of your project, create a file named jest.config.js and inside put this code :
module.exports = { preset: 'ts-jest', testEnvironment: 'node', modulePathIgnorePatterns: ["/dist/"], };
- In the same root of the project, create a file called jest.config.unit.js and put this code there:
QUESTION
I have made a codesandbox example with my case and need help making it work. Here is the link to the example.
Repro steps:
- Type something on the jodit editor
- Mouse click on the outside of the editor and you will see the log that says
onBlur
is triggered. - Switch to code edit mode using
icon on the top-left.
- Modify something on the html.
- Mouse click on outside of the editor and you will NOT see any additional log.
My initial goal is to confirm this mechanism is by design or a bug and I tried to ask to the community before opening a ticket on the github repository.
You may also have noticed that the logging system is not working properly in my example.
I tried to stack all the logs - onChange
, onBlur
but it is showing only the last log. It works fine when I click on the Add
button. Maybe there is something wrong with react hook usage.
Can someone please help me with the above issues?
onBlur
is not triggered on code edit mode in theJodit
editor. Is it by design or a bug?- Why do I see only the latest log instead of the stacked logs?
Thank you in advance.
...ANSWER
Answered 2021-Nov-14 at 15:38onBlur
is not called because insidejodit
a separatetextarea
is used to display the code, this is either a bug injodit-react
or injodit
itself- Inside
jodit-react
callbacks fortextarea
are added insideuseEffect
which is called only when theconfig
is changed.
For the correct display of the logs you need to fix the way of saving the logs to the state
QUESTION
I'm trying to insert the following block on the cursor position:
Inserted Text
I've used following methods to get the exact cursor position:
- this.jodit.selectionStart
- window.getSelection().getRangeAt(0).startOffset
my function buttonClick inserts it inside the line but is unable to recapture the changed cursor position when I try inserting it.
...ANSWER
Answered 2021-Apr-04 at 10:27Add below in the config object
QUESTION
I have this JavaScript:
...ANSWER
Answered 2021-Feb-17 at 20:13The following line will always target the first element with the editor
class:
QUESTION
What I did so far: I imported a component into the share module because I want to use it on 2 different Modules. Now when I'm recompiling the app it says that jodit-editor which is used by the shared component is not a known element. (worked completely normal before shared the component)
This is how the shared Component look like:
...ANSWER
Answered 2020-Dec-16 at 18:47The JoditAngularModule should be added to the imports of the shared module for your shared component to 'know' the element 'jodit-editor'.
This is the import statement.
QUESTION
I would like to use Jodit in a SFC, but I am not sure how this is supposed to be done. I realized there is a wrapper (jodit-vue
), but for educational purposes, I would like to know how it's done without it. I created a Vue CLI project with default presets, and all I changed is the App.vue
:
ANSWER
Answered 2020-Dec-05 at 21:20The jodit
module exports the Jodit
constructor, so your component would import it like this:
QUESTION
I keep getting warnings from TS files in a node_modules library, that I don't want to see.
The library in question is this here: https://github.com/xdan/jodit
I import the library in my app.tsx like such:
...ANSWER
Answered 2020-Aug-21 at 12:18Ok there is no good clean way of doing this, however, I did find a way to make it work.
Since I don't want any validation from another library's files I decided just to add // @ts-nocheck
to the files that were trowing warnings.
Now, you have to go into the node_modules folder and find the library, and add that comment to the first line of all the .ts
files that are causing you problems.
After that you want to use the https://github.com/ds300/patch-package#readme module to patch the library, so you don't have to make these changes manually every time you install the library.
And the last step, if you feel up for it is to go fix the bugs in the library and submit a pull request.
So:
- Add the ignore comment to the files causing errors in the node_modules folder
- Patch the package
- Enjoy!
QUESTION
I'm adding a Jodit editor to a webpage. I'd like to be able to paste formatted text from, say, MS Word, into the editor. I can paste text that does not call the little pop-up for pasting html text, but not text with formatting. The console logs a warning that addRange(): The given range isn't in document
. Indeed, logging window.getSelection().rangeCount
returns 0 (instead of 1 in other cases). I have no idea what is wrong as pasting from various programs, of course, works on the website. Am I missing an event?
ANSWER
Answered 2020-May-28 at 19:54The problem was that the editor was in an ag-grid cell. The different selections in the dialog box when pasting from MS Word into the editor lay outside of the ag-grid cell, and therefore clicking in the dialog ended the ag-grid session mid-edit!
As the behavior I was looking for is to keep the formatting, I simply turned off the dialog box (askBeforePasteFromWord: false
, askBeforePasteFromHTML: false
). To still handle the pasting from MS Word (because MS Word), added in Jodit's author's code to auto-handle (https://github.com/xdan/jodit/issues/197):
QUESTION
I'm trying to test our customized Jodit editor in app but even automatic 'should create' test is failed. Failure message is 'Jodit is not defined'.
jodit.component.ts
...ANSWER
Answered 2020-Apr-14 at 11:48In your .spec.ts
file, you have to import
Jodit and bundle it the same way you have in your jodit.component.ts
. Maybe the imports
array of TestBed.configureTestingModule
needs it as well.
Add a typescript library to angular
Check that out but in your tests you have to import it as well.
I would use the Angular wrapper though if I were you: https://github.com/jodit/jodit-angular
QUESTION
I cloned a repository and did an npm install
but at the end some error occured.
Now whenever I run npm audit
I get the message
ANSWER
Answered 2020-Jan-27 at 10:30You'll have to use npm audit
and actually read the audit log. In there will be advice on which versions can be installed to fix vulnerabilities.See https://docs.npmjs.com/cli/audit for more information on npm audit.
You can get a report of all vulnerabilities using npm audit
. In that report for each vulnerability you will also see a way to fix it. When you use npm audit fix
you are telling npm to execute those fixes. Npm however will not automatically install fixes that might break your project, such as major versions changes. You'll have to manually execute the npm install
commands for those if you decide the vulnerability is more important than having to deal with the possible breaking change.
Another common warning are peer dependency warnings. Peer dependencies specify not dependency, but compatibility. Check out this post for a way better explanation on peer dependencies: https://stackoverflow.com/a/34645112/1016004
You can see a peer dependency warning for 2 reasons: the specified peer dependency is missing, or the peer dependency is of the wrong version. In both cases you will have to figure out the correct response yourself. The core question to answer is whether you can install the dependency in your project:
- Do you use any deprecated features that will be removed in an update, do any breaking changes apply to your code, ...?
- Do you have to revert to a version with a known vulnerability that you use in such a way that it might endanger user data, ... ?
The simple solution, not recommended for production, is to just manually try to run npm install
for both the vulnerabilities and peer dependencies with the proposed versions. Be sure to have version control or backups so that you can revert if you end up with more errors than you started with.
If the simple solution doesn't cut it you'll have to look for other versions of packages that are part of the unsolvable constraints. Maybe previous versions of any of those packages can work together?
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install jodit
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page