Skip to content

Commit

Permalink
fix(addon-editor): allow paste base64 image
Browse files Browse the repository at this point in the history
  • Loading branch information
splincode committed Nov 29, 2022
1 parent 1d78810 commit c98fb9b
Show file tree
Hide file tree
Showing 7 changed files with 74 additions and 43 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export const defaultEditorExtensions = [
import(`@taiga-ui/addon-editor/extensions/font-color`).then(
({FontColor}) => FontColor,
),
import(`@tiptap/extension-image`).then(({default: Image}) =>
Image.configure({inline: true}),
),
import(`@taiga-ui/addon-editor/extensions/image`).then(({TuiImage}) => TuiImage),
import(`@taiga-ui/addon-editor/extensions/link`).then(({TuiLink}) => TuiLink),
import(`@taiga-ui/addon-editor/extensions/jump-anchor`).then(
({TuiJumpAnchor}) => TuiJumpAnchor,
Expand Down
3 changes: 3 additions & 0 deletions projects/addon-editor/extensions/image/image.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import {Image} from '@tiptap/extension-image';

export const TuiImage = Image.extend().configure({inline: true, allowBase64: true});
1 change: 1 addition & 0 deletions projects/addon-editor/extensions/image/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './image';
8 changes: 8 additions & 0 deletions projects/addon-editor/extensions/image/ng-package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"lib": {
"entryFile": "index.ts",
"styleIncludePaths": [
"../../../core/styles"
]
}
}
1 change: 1 addition & 0 deletions projects/addon-editor/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from '@taiga-ui/addon-editor/extensions/file-link';
export * from '@taiga-ui/addon-editor/extensions/font-color';
export * from '@taiga-ui/addon-editor/extensions/font-size';
export * from '@taiga-ui/addon-editor/extensions/group';
export * from '@taiga-ui/addon-editor/extensions/image';
export * from '@taiga-ui/addon-editor/extensions/image-editor';
export * from '@taiga-ui/addon-editor/extensions/indent-outdent';
export * from '@taiga-ui/addon-editor/extensions/link';
Expand Down
2 changes: 2 additions & 0 deletions projects/demo-integrations/cypress/support/editor/html.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,5 @@ export const HTML_EDITOR_EXAMPLE_NESTED_UL = `<ul><li>1<ul><li>2<ul><li>3</li><l
export const HTML_EDITOR_EXAMPLE_LONG_WORD_UL = `<p></p><ul><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p><p></p></li></ul><hr><ol><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p><p></p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p><ol><li><p>2</p><ol><li><p>123</p><ol><li><p>23</p><ol><li><p>213</p></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li></ol></li></ol></li></ol></li></ol></li><li><p>122222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222</p></li></ol><p></p>`;

export const HTML_EDITOR_EXAMPLE_NESTED_OL_UL = `<ul><li><p>Lorem</p><ol><li><p>Ipsum</p></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">is simply</span></p></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">dummy text of</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">the printing</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">and typesetting</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">industry</span></p><p></p></li></ul></li></ul></li></ul></li></ol></li></ul><ol><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">Lorem</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">Ipsum</span></p><ul><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">has been</span></p><ol><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">the industry's</span></p></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">standard dummy</span></p></li></ol></li></ul></li></ul></li><li><p><span style="color: rgb(0, 0, 0); background-color: rgb(255, 255, 255); font-size: 14px">text ever since the 1500s</span></p></li></ol>`;

export const HTML_BASE64_IMG = `<img%20src%3D"data:image%2Fpng;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAYAAACtWK6eAAAdnklEQVR4nOyde4wcV5n2n7p099zaPXYcO4yd8fgCCQEnAzifPlgPiRekxUqwsxIrUBw2ZtldcHY3XlarFUhLCAiJ1f5DEqEAC0ucKEQrWERiNssKEeVOsuAkkzEJiZNxfIkntsfjmemeS9%2BqanWqq3pqevpSl3Pqen5W6%2FRUV1eXW%2B%2FT73nOe%2BqUCE6o%2BH3mmuGnV109HPR5cGoIQZ8ABxiXhokgbgVwE4ChiV6VbD4B4GEA94%2Fkx0aDPsekwgUSEOPS8JAhCCKMZRnDEIgVIpD7iWBG8mMnfD3RhMMF4iPj0nC%2FRRTXt9qviUCsPGERywyTE%2BXU4QLxgXFp%2BCZLF6ojHQRixeyCPezpBDkt4QJhhCGKvYYo%2Bp2814FATGYMsTzCxUIXLhCKNJptt8dxIRAr3NxThAvEIxazfdCLKKx4FIgVIpa7ubl3DxeICyxm%2B2DjCBQNKArEyqhFLNzc24QLxAHj0vB%2Bi69gBiOBWDH9yi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hNGVir3H6AQXSANBT60PWCCRmILuJ1wgLTCE8m2%2FjXyAAjlkdKe4MCxwgXTAGPG6zy8jH4BAnjAKfYkZmXICF4hN%2FDLyPgok8QbcDlwgDmFt5H0QCDfgDuACcQFLI89QINyAu4ALxAMsjDwjgXAD7hIuEArQNPKUBcINuEe4QChCw8hTEgg34JTgAmGAFyPvUSDcgFOGC4QRbo28S4FwA84ILhDGGEL5miGWjrgQyF1G1uDCYAAXiE8YRp74k5va7edAIA8bPoMbcIZwgfhMp9s72BBIqG4PEHe4QAKilZFvIxBuwAOACyRgxqXhO61GvolAdAM%2Bkh%2B7M7CTTDCJWbQhrGxVRu80FpNodn%2BMu4zFEbg4AuL%2FAgAA%2F%2F%2B%2BpbP0xBKy2wAAAABJRU5ErkJggg%3D%3D">`;
Original file line number Diff line number Diff line change
@@ -1,55 +1,73 @@
import {
tuiGetDemoContent,
tuiVisitEditorApiPage,
} from '@demo-integrations/support/editor/helpers';
import {HTML_BASE64_IMG} from '@demo-integrations/support/editor/html';
import {
EDITOR_PAGE_URL,
WAIT_BEFORE_SCREENSHOT,
} from '@demo-integrations/support/properties/shared.entities';

describe(`Examples with preview images`, () => {
beforeEach(() => cy.viewport(1650, 900).tuiVisit(EDITOR_PAGE_URL));
describe(`Examples images`, () => {
it(`base64`, () => {
tuiVisitEditorApiPage({content: HTML_BASE64_IMG, skipDecodingUrl: true});

tuiGetDemoContent()
.wait(WAIT_BEFORE_SCREENSHOT)
.matchImageSnapshot(`2-1-support-base64-image`);
});

it(`preview display of images`, () => {
cy.get(`#preview-image`).findByAutomationId(`tui-doc-example`).as(`wrapper`);
describe(`Preview`, () => {
beforeEach(() => cy.viewport(1650, 900).tuiVisit(EDITOR_PAGE_URL));

cy.get(`@wrapper`).tuiScrollIntoView().click();
it(`preview display of images`, () => {
cy.get(`#preview-image`).findByAutomationId(`tui-doc-example`).as(`wrapper`);

cy.get(`@wrapper`)
.find(`.tui-editor-socket`)
.eq(1)
.tuiScrollIntoView()
.wait(WAIT_BEFORE_SCREENSHOT)
.matchImageSnapshot(`3-1-two-visible-image`, {capture: `viewport`});

cy.get(`@wrapper`)
.find(`tui-editor-socket._preview-image`)
.find(`img`)
.filter(`[src="assets/images/big-wallpaper.jpg"]`)
.filter(`:visible`)
.click();

cy.tuiHide(`tui-doc-page`);
cy.wait(WAIT_BEFORE_SCREENSHOT).matchImageSnapshot(`3-2-preview-big-wallpaper`, {
capture: `viewport`,
});
cy.get(`@wrapper`).tuiScrollIntoView().click();

cy.tuiShow(`tui-doc-page`);
closePreview();
cy.get(`@wrapper`)
.find(`.tui-editor-socket`)
.eq(1)
.tuiScrollIntoView()
.wait(WAIT_BEFORE_SCREENSHOT)
.matchImageSnapshot(`3-1-two-visible-image`, {capture: `viewport`});

cy.get(`@wrapper`)
.find(`tui-editor-socket._preview-image`)
.find(`img`)
.filter(`[src="assets/images/lumberjack.png"]`)
.filter(`:visible`)
.click();
cy.get(`@wrapper`)
.find(`tui-editor-socket._preview-image`)
.find(`img`)
.filter(`[src="assets/images/big-wallpaper.jpg"]`)
.filter(`:visible`)
.click();

cy.tuiHide(`tui-doc-page`);
cy.wait(WAIT_BEFORE_SCREENSHOT).matchImageSnapshot(`3-3-preview-lumberjack`, {
capture: `viewport`,
cy.tuiHide(`tui-doc-page`);
cy.wait(WAIT_BEFORE_SCREENSHOT).matchImageSnapshot(
`3-2-preview-big-wallpaper`,
{
capture: `viewport`,
},
);

cy.tuiShow(`tui-doc-page`);
closePreview();

cy.get(`@wrapper`)
.find(`tui-editor-socket._preview-image`)
.find(`img`)
.filter(`[src="assets/images/lumberjack.png"]`)
.filter(`:visible`)
.click();

cy.tuiHide(`tui-doc-page`);
cy.wait(WAIT_BEFORE_SCREENSHOT).matchImageSnapshot(`3-3-preview-lumberjack`, {
capture: `viewport`,
});

cy.tuiShow(`tui-doc-page`);
closePreview();
});

cy.tuiShow(`tui-doc-page`);
closePreview();
function closePreview(): void {
cy.get(`tui-preview`).find(`button[icon=tuiIconCloseLarge]`).click();
}
});
});

function closePreview(): void {
cy.get(`tui-preview`).find(`button[icon=tuiIconCloseLarge]`).click();
}

0 comments on commit c98fb9b

Please sign in to comment.