forked from marcelinombb/Tiptap-Exitus
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
criação de botoes de criar paragrafo na tabela
- Loading branch information
1 parent
5836c5f
commit 4c98a82
Showing
6 changed files
with
109 additions
and
4 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,53 @@ | ||
import { Button } from '@editor/ui' | ||
import setaCima from '@icons/corner-down-left-line.svg' | ||
import setaBaixo from '@icons/corner-down-right-line.svg' | ||
import type ExitusEditor from 'src/ExitusEditor' | ||
|
||
import { type TableView } from './TableView' | ||
|
||
export default class TableFocus { | ||
tableView: TableView | ||
FocarCima!: HTMLElement | ||
FocarBaixo!: HTMLElement | ||
|
||
constructor(tableView: TableView, editor: ExitusEditor) { | ||
this.tableView = tableView | ||
this.focaTabela(editor) | ||
} | ||
|
||
private focaTabela(editor: ExitusEditor) { | ||
const element = this.tableView.tableWrapper | ||
element.style.position = 'relative' | ||
|
||
const botaoCima = createButton(editor, setaCima, () => { | ||
this.moveAlvoParaCima() | ||
}) | ||
this.FocarCima = element.appendChild(botaoCima) | ||
this.FocarCima.classList.add('bolinha', 'bolinha-cima') | ||
|
||
const botaoBaixo = createButton(editor, setaBaixo, () => { | ||
this.moveAlvoParaBaixo() | ||
}) | ||
this.FocarBaixo = element.appendChild(botaoBaixo) | ||
this.FocarBaixo.classList.add('bolinha', 'bolinha-baixo') | ||
} | ||
|
||
private moveAlvoParaCima() { | ||
const paragrafo = '<p></p>' | ||
this.tableView.dom.insertAdjacentHTML('beforebegin', paragrafo) | ||
} | ||
|
||
private moveAlvoParaBaixo() { | ||
const paragrafo = '<p></p>' | ||
this.tableView.dom.insertAdjacentHTML('afterend', paragrafo) | ||
} | ||
} | ||
|
||
function createButton(editor: ExitusEditor, icone: string, onClick: () => void) { | ||
const button = new Button(editor, { | ||
icon: icone, | ||
classList: ['bolinha'] | ||
}) | ||
button.bind('click', onClick) | ||
return button.render() | ||
} |
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