Skip to content

Commit

Permalink
Bump Rooster to 8.39.0 (#1450)
Browse files Browse the repository at this point in the history
* get biggest z index

* comment

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor

* refactor and comments

* refactor

* Improve handling of quotes inside lists (#1438)

* Remove coloring when removing a quote inside a LI

* Prevent list items from being removed before quote

* refactor

* Content Model Support PRE and CODE: step 1 (#1439)

* Support PRE and CODE: step 1

* improve

* Content Model Support PRE and CODE: step 2 (#1440)

* Support PRE and CODE: step 1

* improve

* Support PRE and CODE step 2

* Fix issue when cell resizing with merged cells (#1445)

* init

* Fix

* Content Model Support PRE and CODE: step 3 (#1441)

* Support PRE and CODE: step 1

* improve

* Support PRE and CODE step 2

* Support PRE and CODE: step 3

* Content Model Support PRE and CODE: step 4 (#1442)

* Support PRE and CODE: step 1

* improve

* Support PRE and CODE step 2

* Support PRE and CODE: step 3

* Support PRE and CODE: step 4

* Allow styled table header cells to be clear formatted (#1447)

* Consider nodes with siblings with no text as empty

* Cleanup

* Fix background color issue that can go across block element (#1448)

* Fix Unhandled Rejection: Error: Editor is already disposed (#1449)

* Fix issue

* fix test

* Bump

* Bump content model

Co-authored-by: Júlia Roldi <[email protected]>
Co-authored-by: Julia Roldi <[email protected]>
Co-authored-by: Jiuqing Song <[email protected]>
Co-authored-by: Bryan Valverde U <[email protected]>
  • Loading branch information
5 people committed Jun 16, 2023
1 parent 573547d commit f93e927
Show file tree
Hide file tree
Showing 10 changed files with 130 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ import { addBlock } from '../../modelApi/common/addBlock';
import { blockProcessor } from './blockProcessor';
import { ContentModelSegmentFormat } from '../../publicTypes/format/ContentModelSegmentFormat';
import { createParagraph } from '../../modelApi/creators/createParagraph';
import { DomToModelContext } from '../../publicTypes/context/DomToModelContext';
import { createParagraphDecorator } from '../../modelApi/creators/createParagraphDecorator';
import { ElementProcessor } from '../../publicTypes/context/ElementProcessor';
import { formatContainerProcessor } from './formatContainerProcessor';
import { getDefaultStyle } from '../utils/getDefaultStyle';
import { isBlockElement } from '../utils/isBlockElement';
import { MarginFormat } from '../../publicTypes/format/formatParts/MarginFormat';
import { parseFormat } from '../utils/parseFormat';
import { stackFormat } from '../utils/stackFormat';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const defaultStyleMap: DefaultStyleMap = {
display: 'block',
textAlign: 'center',
},
code: { fontFamily: 'monospace' },
dd: blockElement,
div: blockElement,
dl: blockElement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ContentModelHandler } from '../../publicTypes/context/ContentModelHandl
import { ContentModelText } from '../../publicTypes/segment/ContentModelText';
import { handleSegmentCommon } from '../utils/handleSegmentCommon';
import { ModelToDomContext } from '../../publicTypes/context/ModelToDomContext';
import { stackFormat } from '../utils/stackFormat';

/**
* @internal
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion packages/roosterjs-content-model/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
"roosterjs-editor-core": ""
},
"main": "./lib/index.ts",
"version": "0.0.9"
"version": "0.0.10"
}
Original file line number Diff line number Diff line change
Expand Up @@ -715,4 +715,90 @@ describe('knownElementProcessor', () => {
});
expect(context.link).toEqual({ format: {}, dataset: {} });
});

it('P tag', () => {
const group = createContentModelDocument();
const p = document.createElement('p');

spyOn(parseFormat, 'parseFormat');

knownElementProcessor(group, p, context);

expect(group).toEqual({
blockGroupType: 'Document',
blocks: [
{
blockType: 'Paragraph',
format: {},
decorator: {
tagName: 'p',
format: {},
},
segments: [],
},
{
blockType: 'Paragraph',
format: {},
segments: [],
isImplicit: true,
},
],
});

expect(parseFormat.parseFormat).toHaveBeenCalledTimes(2);
expect(parseFormat.parseFormat).toHaveBeenCalledWith(
p,
context.formatParsers.block,
context.blockFormat,
context
);
expect(parseFormat.parseFormat).toHaveBeenCalledWith(
p,
context.formatParsers.segmentOnBlock,
context.segmentFormat,
context
);
});

it('Div with top margin', () => {
const group = createContentModelDocument();
const div = document.createElement('div');

context.defaultStyles.div = {
marginTop: '20px',
marginBottom: '40px',
display: 'block',
};

knownElementProcessor(group, div, context);

expect(group).toEqual({
blockGroupType: 'Document',
blocks: [
{
blockType: 'Divider',
tagName: 'div',
format: {
marginTop: '20px',
},
},
{
blockType: 'Paragraph',
format: {},
segments: [],
},
{
blockType: 'Divider',
tagName: 'div',
format: { marginBottom: '40px' },
},
{
blockType: 'Paragraph',
segments: [],
format: {},
isImplicit: true,
},
],
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -199,4 +199,21 @@ describe('handleSegment', () => {

runTest(segment, '<a href="/test"><img src="http://test.com/test" data-a="b"></a>', 0);
});

it('call stackFormat', () => {
const segment: ContentModelImage = {
segmentType: 'Image',
src: 'http://test.com/test',
format: { underline: true },
link: { format: { href: '/test' }, dataset: {} },
dataset: {},
};

spyOn(stackFormat, 'stackFormat').and.callThrough();

runTest(segment, '<a href="/test"><img src="http://test.com/test"></a>', 0);

expect(stackFormat.stackFormat).toHaveBeenCalledTimes(1);
expect((<jasmine.Spy>stackFormat.stackFormat).calls.argsFor(0)[1]).toBe('a');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ describe('handleParagraph', () => {
{
blockType: 'Paragraph',
format: {},
header: {
headerLevel: 1,
decorator: {
tagName: 'h1',
format: { fontWeight: 'bold', fontSize: '20px' },
},
segments: [
Expand All @@ -295,8 +295,8 @@ describe('handleParagraph', () => {
{
blockType: 'Paragraph',
format: {},
header: {
headerLevel: 1,
decorator: {
tagName: 'h1',
format: {},
},
segments: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,21 @@ describe('handleText', () => {

expect(parent.innerHTML).toBe('<span style="font-size: 12px;"><a href="#">test</a></span>');
});

it('call stackFormat', () => {
const text: ContentModelText = {
segmentType: 'Text',
text: 'test',
format: { underline: true },
link: { format: { href: '/test' }, dataset: {} },
};

spyOn(stackFormat, 'stackFormat').and.callThrough();

handleText(document, parent, text, context);

expect(parent.innerHTML).toBe('<a href="/test">test</a>');
expect(stackFormat.stackFormat).toHaveBeenCalledTimes(1);
expect((<jasmine.Spy>stackFormat.stackFormat).calls.argsFor(0)[1]).toBe('a');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import DragAndDropContext, { DNDDirectionX, DnDDirectionY } from './types/DragAn
import DragAndDropHandler from '../../pluginUtils/DragAndDropHandler';
import DragAndDropHelper from '../../pluginUtils/DragAndDropHelper';
import getGeneratedImageSize from './editInfoUtils/getGeneratedImageSize';
import getLatestZIndex from './editInfoUtils/getLastZIndex';
import ImageEditInfo from './types/ImageEditInfo';
import ImageHtmlOptions from './types/ImageHtmlOptions';
import { Cropper, getCropHTML } from './imageEditors/Cropper';
Expand Down

0 comments on commit f93e927

Please sign in to comment.