Skip to content

Commit

Permalink
Merge branch 'master' into xiaozhe/test/model2dom-in-batches
Browse files Browse the repository at this point in the history
  • Loading branch information
Rain-Zheng committed Sep 19, 2024
2 parents ebc3238 + 63747b9 commit 0401c5d
Show file tree
Hide file tree
Showing 77 changed files with 45,088 additions and 39,285 deletions.
59 changes: 29 additions & 30 deletions demo/scripts/controlsV2/demoButtons/setBulletedListStyleButton.ts
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
import { BulletListType } from 'roosterjs-content-model-dom';
import { setListStyle } from 'roosterjs-content-model-api';
import type { RibbonButton } from 'roosterjs-react';

const dropDownMenuItems = {
[BulletListType.Disc]: 'Disc',
[BulletListType.Dash]: 'Dash',
[BulletListType.Square]: 'Square',
[BulletListType.ShortArrow]: 'ShortArrow',
[BulletListType.LongArrow]: 'LongArrow',
[BulletListType.UnfilledArrow]: 'UnfilledArrow',
[BulletListType.Hyphen]: 'Hyphen',
[BulletListType.DoubleLongArrow]: 'DoubleLongArrow',
[BulletListType.Circle]: 'Circle',
};

export const setBulletedListStyleButton: RibbonButton<'ribbonButtonBulletedListStyle'> = {
key: 'ribbonButtonBulletedListStyle',
dropDownMenu: { items: dropDownMenuItems },
unlocalizedText: 'Set unordered list style',
iconName: 'BulletedList',
isDisabled: formatState => !formatState.isBullet,
onClick: (editor, key) => {
const value = parseInt(key);

setListStyle(editor, {
unorderedStyleType: value,
});
},
};
import { BulletListType } from 'roosterjs-content-model-dom';
import { setListStyle } from 'roosterjs-content-model-api';
import type { RibbonButton } from 'roosterjs-react';

const dropDownMenuItems = {
[BulletListType.Disc]: 'Disc',
[BulletListType.Dash]: 'Dash',
[BulletListType.Square]: 'Square',
[BulletListType.ShortArrow]: 'ShortArrow',
[BulletListType.LongArrow]: 'LongArrow',
[BulletListType.UnfilledArrow]: 'UnfilledArrow',
[BulletListType.Hyphen]: 'Hyphen',
[BulletListType.Circle]: 'Circle',
};

export const setBulletedListStyleButton: RibbonButton<'ribbonButtonBulletedListStyle'> = {
key: 'ribbonButtonBulletedListStyle',
dropDownMenu: { items: dropDownMenuItems },
unlocalizedText: 'Set unordered list style',
iconName: 'BulletedList',
isDisabled: formatState => !formatState.isBullet,
onClick: (editor, key) => {
const value = parseInt(key);

setListStyle(editor, {
unorderedStyleType: value,
});
},
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"coverage-istanbul-loader": "3.0.5",
"css-loader": "3.5.3",
"detect-port": "^1.3.0",
"dompurify": "2.3.0",
"dompurify": "2.5.4",
"eslint": "^8.50.0",
"eslint-plugin-etc": "^2.0.3",
"eslint-plugin-react": "^7.33.2",
Expand Down Expand Up @@ -82,7 +82,7 @@
"typedoc-plugin-remove-references": "0.0.5",
"typescript": "4.4.4",
"url-loader": "4.1.0",
"webpack": "5.84.1",
"webpack": "5.94.0",
"webpack-cli": "3.3.11",
"webpack-dev-server": "3.10.3"
},
Expand Down
Loading

0 comments on commit 0401c5d

Please sign in to comment.