Comments (5)
Ok, this is because in demo site some content edit features are not enabled by default. Once enabled, this would work.
@juliaroldi I think we should only turn them off for content model demo site.
from roosterjs.
We fixed it by making the MaintainListChain
edit feature asynchronous.
I'm not sure if RoosterJS maintainers want to fix it internally since the legacy editor is being deprecated.
import { ListFeatures } from 'roosterjs-editor-plugins/lib-mjs/plugins/ContentEdit/features/listFeatures';
import { GenericContentEditFeature, PluginKeyboardEvent } from 'roosterjs-editor-types';
// Run maintainListChain edit feature in async to fix the issue "The number of the new line is not increased after typing return"
const { maintainListChain } = ListFeatures;
/**
* Maintain the list numbers in list chain
* e.g. we have two lists:
* 1, 2, 3 and 4, 5, 6
* Now we delete list item 2, so the first one becomes "1, 2".
* This edit feature can maintain the list number of the second list to become "3, 4, 5"
*/
export const AsyncMaintainListChain: GenericContentEditFeature<PluginKeyboardEvent> = {
keys: maintainListChain.keys,
shouldHandleEvent: maintainListChain.shouldHandleEvent,
handleEvent: (event, editor) => {
setTimeout(() => {
maintainListChain.handleEvent(event, editor);
}, 50);
},
};
from roosterjs.
Hi @haven2world,
I see, thank you very much for sharing the code!
from roosterjs.
@juliaroldi can you take a look? The recent change should not impact legacy editor, but I remember this should work not too long ago.
from roosterjs.
from roosterjs.
Related Issues (20)
- Content Model: General block element is not transformed to dark mode HOT 5
- Cannot access ambient const enums when 'isolatedModules' is enabled HOT 3
- Content Model: Setting Rooster content div innerHTML equal to a variable containing html inserts quotes around element property values HOT 1
- Is there a way to set the default paste type? HOT 1
- Bulleted and numbered list sometimes can't be added when an input box is empty HOT 3
- Text from the Watermark plugin is shown for a few miliseconds when indent is changed and input box is empty HOT 3
- 'Align center' doesn't work when copy and paste the text HOT 5
- Watermark plugin's text value can't be updated or localized HOT 5
- AttributeSanitizers are not applied to the child elements
- Use border shorthand CSS property and hex colors for table editor HOT 2
- Pasting labels sometimes adds a Div element that is not present in the source of the copy HOT 4
- Copying content from a dark mode website into a dark mode Rooster editor results in flipped colors HOT 1
- createUpdateContentPlugin callback and getContent() return different result for numbered lists if there is even smallest delay HOT 1
- Content Model: Feature to add anchor ids HOT 5
- Test suite tableResizerTest is unstable HOT 1
- [Improvement] Allow setBackgroundColor and setColor to be used without editor gaining focus HOT 7
- Link color resets and doesn't persist HOT 1
- Content Model: Selection Range become Marker after formatContentModel HOT 3
- Content Model: creating a DOM tree using selection marker results in blank window and/or throws an error. HOT 4
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 roosterjs.