-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
600 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<!doctype html> | ||
<html> | ||
<head> | ||
<meta charset="utf-8" /> | ||
<title>Quill Table Module Demo</title> | ||
<meta | ||
name="viewport" | ||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0, viewport-fit=cover" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css" | ||
integrity="sha384-nB0miv6/jRmo5UMMR1wu3Gz6NLsoTkbqJghGIsx//Rlm+ZU03BU6SQNC66uf4l5+" | ||
crossorigin="anonymous" | ||
/> | ||
<script | ||
defer | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js" | ||
integrity="sha384-7zkQWkzuo3B5mTepMUcHkMB5jZaolc2xDwL6VFqjFALcbeS9Ggm/Yr2r3Dy4lfFg" | ||
crossorigin="anonymous" | ||
></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.js"></script> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.bubble.css" rel="stylesheet" /> | ||
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/quill.snow.css" rel="stylesheet" /> | ||
<script type="module" src="./index.umd.js"></script> | ||
<link href="./index.css" rel="stylesheet" /> | ||
<link href="./table-creator.css" rel="stylesheet" /> | ||
<style> | ||
.ql-editor { | ||
line-height: 1.4; | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div style="display: flex; flex-direction: column; max-width: 1200px; margin: auto"> | ||
<div id="container1"> | ||
<button id="btn1">console</button> | ||
<div id="editor1" style="height: 600px"></div> | ||
<div id="output1"></div> | ||
</div> | ||
<div id="container2"> | ||
<button id="btn2">console</button> | ||
<div id="editor2" style="height: 600px"></div> | ||
<div id="output2"></div> | ||
</div> | ||
<div id="container3"> | ||
<button id="btn3">console</button> | ||
<div id="editor3" style="height: 600px"></div> | ||
<div id="output3"></div> | ||
</div> | ||
<div id="container4"> | ||
<button id="btn4">console</button> | ||
<div id="editor4" style="height: 600px"></div> | ||
<div id="output4"></div> | ||
</div> | ||
</div> | ||
<script type="module" src="./test.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
/* eslint-disable no-undef */ | ||
const Quill = window.Quill; | ||
const { | ||
default: TableUp, | ||
TableAlign, | ||
TableVirtualScrollbar, | ||
TableResizeLine, | ||
TableResizeBox, | ||
TableMenuContextmenu, | ||
TableMenuSelect, | ||
TableResizeScale, | ||
defaultCustomSelect, | ||
TableSelection, | ||
} = window.TableUp; | ||
|
||
Quill.register({ | ||
[`modules/${TableUp.moduleName}`]: TableUp, | ||
}, true); | ||
|
||
const toolbarConfig = [ | ||
['bold', 'italic', 'underline', 'strike'], | ||
['blockquote', 'code-block', 'code'], | ||
['link', 'image', 'video', 'formula'], | ||
[{ list: 'ordered' }, { list: 'bullet' }, { list: 'check' }], | ||
[{ script: 'sub' }, { script: 'super' }], | ||
[{ indent: '-1' }, { indent: '+1' }], | ||
[{ direction: 'rtl' }], | ||
[{ size: ['small', false, 'large', 'huge'] }], | ||
[{ header: [1, 2, 3, 4, 5, 6, false] }], | ||
[{ color: [] }, { background: [] }], | ||
[{ font: [] }], | ||
[{ align: [] }], | ||
[{ [TableUp.toolName]: [] }], | ||
['clean'], | ||
]; | ||
|
||
const quills = [ | ||
{ | ||
full: false, | ||
scrollbar: TableVirtualScrollbar, | ||
align: TableAlign, | ||
resize: TableResizeLine, | ||
resizeScale: TableResizeScale, | ||
customSelect: defaultCustomSelect, | ||
customBtn: true, | ||
selection: TableSelection, | ||
selectionOptions: { | ||
tableMenu: TableMenuContextmenu, | ||
}, | ||
}, | ||
{ | ||
full: false, | ||
scrollbar: TableVirtualScrollbar, | ||
align: TableAlign, | ||
resize: TableResizeBox, | ||
resizeScale: TableResizeScale, | ||
customSelect: defaultCustomSelect, | ||
customBtn: true, | ||
selection: TableSelection, | ||
selectionOptions: { | ||
tableMenu: TableMenuSelect, | ||
}, | ||
}, | ||
{ | ||
full: true, | ||
scrollbar: TableVirtualScrollbar, | ||
align: TableAlign, | ||
resize: TableResizeLine, | ||
resizeScale: TableResizeScale, | ||
customSelect: defaultCustomSelect, | ||
customBtn: true, | ||
selection: TableSelection, | ||
selectionOptions: { | ||
tableMenu: TableMenuContextmenu, | ||
}, | ||
}, | ||
{ | ||
full: true, | ||
scrollbar: TableVirtualScrollbar, | ||
align: TableAlign, | ||
resize: TableResizeBox, | ||
resizeScale: TableResizeScale, | ||
customSelect: defaultCustomSelect, | ||
customBtn: true, | ||
selection: TableSelection, | ||
selectionOptions: { | ||
tableMenu: TableMenuSelect, | ||
}, | ||
}, | ||
].map((ops, i) => { | ||
return new Quill(`#editor${i + 1}`, { | ||
// debug: 'info', | ||
theme: 'snow', | ||
modules: { | ||
toolbar: toolbarConfig, | ||
[TableUp.moduleName]: ops, | ||
}, | ||
}); | ||
}); | ||
|
||
window.quills = quills; | ||
|
||
const output = [ | ||
output1, | ||
output2, | ||
output3, | ||
output4, | ||
]; | ||
|
||
for (const [i, btn] of [ | ||
btn1, | ||
btn2, | ||
btn3, | ||
btn4, | ||
].entries()) { | ||
btn.addEventListener('click', () => { | ||
const content = quills[i].getContents(); | ||
console.log(content); | ||
output[i].innerHTML = ''; | ||
// eslint-disable-next-line unicorn/no-array-for-each | ||
content.forEach((content) => { | ||
const item = document.createElement('li'); | ||
item.textContent = `${JSON.stringify(content)},`; | ||
output[i].appendChild(item); | ||
}); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { defineConfig, devices } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: './src/__tests__/e2e', | ||
fullyParallel: true, | ||
forbidOnly: !!process.env.CI, | ||
retries: process.env.CI ? 2 : 0, | ||
workers: process.env.CI ? 1 : undefined, | ||
reporter: 'html', | ||
use: { | ||
trace: 'on-first-retry', | ||
}, | ||
projects: [ | ||
{ | ||
name: 'chromium', | ||
use: { ...devices['Desktop Chrome'] }, | ||
}, | ||
|
||
// { | ||
// name: 'firefox', | ||
// use: { ...devices['Desktop Firefox'] }, | ||
// }, | ||
|
||
// { | ||
// name: 'webkit', | ||
// use: { ...devices['Desktop Safari'] }, | ||
// }, | ||
|
||
/* Test against mobile viewports. */ | ||
// { | ||
// name: 'Mobile Chrome', | ||
// use: { ...devices['Pixel 5'] }, | ||
// }, | ||
// { | ||
// name: 'Mobile Safari', | ||
// use: { ...devices['iPhone 12'] }, | ||
// }, | ||
|
||
/* Test against branded browsers. */ | ||
// { | ||
// name: 'Microsoft Edge', | ||
// use: { ...devices['Desktop Edge'], channel: 'msedge' }, | ||
// }, | ||
// { | ||
// name: 'Google Chrome', | ||
// use: { ...devices['Desktop Chrome'], channel: 'chrome' }, | ||
// }, | ||
], | ||
}); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.