Comments (8)
Hi try this https://github.com/jodit/jodit-tributejs
from jodit.
Thanks @xdan!
I've also been looking at the events listing and is it possible to use the configuration option events to accomplish the same?
Something along:
config = {
events: (event) => {
if (event === 'beforeEnter') {
...
}
}
Maybe you could give an example of using the events
option?
from jodit.
var editor = new Jodit('#editor', {
events: {
beforeEnter: function (event) {
if (tribute.isActive) {
return true; // prevent enter plugin but not prevent default behavior
}
}
}
});
// or
editor.events.on('beforeEnter', function (event) {
if (tribute.isActive) {
return true; // prevent enter plugin but not prevent default behavior
}
});
from jodit.
Thanks again @xdan!
However, the only event I'm able to make work is afterInit
. Haven't tried all events, but a fair amount.
I'm using jodit-angular
, have not tried pure ts.
from jodit.
Unfortunately i don't know how return value from EventEmitter
in Angular
<jodit-editor #editor (onBeforeEnter)="handleEvent($event)"></jodit-editor>
and
export class AppComponent {
title = 'app';
handleEvent() {
console.log('triggered');
return false;
}
}
It is triggered but not return false
from jodit.
For that approach, events via jodit-angular
, I think you could solve it by passing a callback from Jodit which then is called in handleEvent
with the return value.
But I'm a bit puzzled why the afterInit
works but not the other events. Anyway, I updated jodit-angular
and tried the last approach but with the same results as in your example.
I then tested the options approach again (with the latest version of jodit-angular
) - and now it works! I have not tried replicating by doing a reinstall of the previous jodit-angular
version, but the following configuration works for afterInit
and beforeEnter
with [email protected], [email protected] and [email protected]:
Template:
<jodit-editor #editor id="jodit-id" [config]="joditConfig" [defaultValue]="content.body" ></jodit-editor>
Component:
this.joditConfig = {
buttons: 'paragraph, bold,strikethrough,underline,italic,|, \
superscript,subscript,|, \
ul,ol,|, \
outdent,indent,|, \
brush,|, \
image,video,table,link,|, \
align,undo,redo,\n,cut,hr,eraser,copyformat,|, \
symbol,selectall,source, fullsize',
imageDefaultWidth: 400,
height: 600,
events: {
beforeEnter: (event) => {
if (this.tribute.isActive) {
return true; // prevent enter plugin but not prevent default behavior
}
},
afterInit: (event, jodit) => {
this.tribute.attach(document.getElementsByClassName('jodit_wysiwyg'));
// this.jodit = jodit; // get editor instance
return true;
},
}
};
from jodit.
Ok, replicated and can confirm that [email protected]
do not work while [email protected]
do!
from jodit.
Also, (onChange)="handleChange($event)"
seems to only fire once in [email protected]
when having events defined in options.
Removing (onChange)="handleChange($event)"
from the template and defining change
event in options works but angular throws an error on init because (I guess) change
fires on the [defaultValue]="content.body"
.
The easiest way around this is to make sure you do not assign the new value on the first change
being fired.
from jodit.
Related Issues (20)
- Documentation HOT 1
- Unable to use Speech Recognition HOT 1
- Paste value with set limitChars HOT 2
- Inline popup tooltips are not visible HOT 2
- space key issues HOT 1
- Incorrect character count for spaces HOT 4
- Jodit Editor vulnerable to Cross-site Scripting HOT 1
- Menu Item Popups Hidden when Jodit is inside an <dialog> element HOT 2
- I want to modify the icon on the change character color, background, how do I handle it? HOT 1
- Text pasting from word wrong - with margin squashing text to the left
- cleanHTML fillEmptyParagraph and removeEmptyElements seem broken
- Tooltip Visibility Problem
- How to update toolbar icon and tooltip HOT 1
- Jodit call a lot of times of blob endpoint to get worker-html.js HOT 8
- Pop-Up "Paste as HTML" HOT 1
- Issues with typings for Jodit options
- Different result if paste html (word) in Free and PRO version
- How do I insert a video (Not from youtube or vimeo) HOT 1
- Missing CSS file for ImageProperties dialog HOT 1
- Config modifications after initialization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jodit.