Skip to content

Commit 1282c97

Browse files
committed
changelog
1 parent e6611a0 commit 1282c97

File tree

2 files changed

+51
-22
lines changed

2 files changed

+51
-22
lines changed

src/exports/elements/tip-tap-editor-base.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ export class TipTapEditorBase extends BaseElement {
6666
class: { reflect: true },
6767
accept: { reflect: true },
6868
serializer: { reflect: true },
69-
deferInitialize: { type: Boolean, attribute: "defer-initialize", reflect: true },
69+
deferInitialize: {
70+
type: Boolean,
71+
attribute: "defer-initialize",
72+
reflect: true,
73+
},
7074

7175
// Properties
7276
editor: { state: true },
@@ -130,8 +134,7 @@ export class TipTapEditorBase extends BaseElement {
130134
/**
131135
* When the `defer-initialize` attribute is present, it will wait to start the TipTap editor until the attribute has been removed.
132136
*/
133-
deferInitialize = false
134-
137+
deferInitialize = false;
135138

136139
/**
137140
* @internal
@@ -323,7 +326,7 @@ export class TipTapEditorBase extends BaseElement {
323326
changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>,
324327
): void {
325328
if (changedProperties.has("deferInitialize") && !this.deferInitialize) {
326-
this.startEditor()
329+
this.startEditor();
327330
}
328331

329332
if (changedProperties.has("class")) {
@@ -399,11 +402,11 @@ export class TipTapEditorBase extends BaseElement {
399402
this.classList.add("rhino-editor");
400403

401404
if (!this.deferInitialize) {
402-
this.startEditor()
405+
this.startEditor();
403406
}
404407
}
405408

406-
async startEditor () {
409+
async startEditor() {
407410
await this.updateComplete;
408411

409412
setTimeout(() => {

src/exports/elements/tip-tap-editor.ts

Lines changed: 42 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,8 @@ export class TipTapEditor extends TipTapEditorBase {
197197
/**
198198
* @override
199199
*/
200-
async startEditor () {
201-
await super.startEditor()
200+
async startEditor() {
201+
await super.startEditor();
202202

203203
if (this.editor) {
204204
this.editor.on("focus", this.closeLinkDialog);
@@ -337,7 +337,9 @@ export class TipTapEditor extends TipTapEditorBase {
337337
}
338338

339339
renderBoldButton(prefix = "") {
340-
const boldEnabled = this.starterKitOptions.bold !== false || Boolean(this.editor?.commands.toggleBold);
340+
const boldEnabled =
341+
this.starterKitOptions.bold !== false ||
342+
Boolean(this.editor?.commands.toggleBold);
341343

342344
if (!boldEnabled) return html``;
343345

@@ -389,7 +391,9 @@ export class TipTapEditor extends TipTapEditorBase {
389391
}
390392

391393
renderItalicButton(prefix = "") {
392-
const italicEnabled = this.starterKitOptions.italic !== false || Boolean(this.editor?.commands.toggleItalic);
394+
const italicEnabled =
395+
this.starterKitOptions.italic !== false ||
396+
Boolean(this.editor?.commands.toggleItalic);
393397

394398
if (!italicEnabled) return html``;
395399

@@ -445,7 +449,9 @@ export class TipTapEditor extends TipTapEditorBase {
445449
}
446450

447451
renderStrikeButton(prefix = "") {
448-
const strikeEnabled = this.starterKitOptions.rhinoStrike !== false || Boolean(this.editor?.commands.toggleStrike);
452+
const strikeEnabled =
453+
this.starterKitOptions.rhinoStrike !== false ||
454+
Boolean(this.editor?.commands.toggleStrike);
449455

450456
if (!strikeEnabled) return html``;
451457

@@ -500,7 +506,9 @@ export class TipTapEditor extends TipTapEditorBase {
500506
}
501507

502508
renderLinkButton(prefix = "") {
503-
const linkEnabled = this.starterKitOptions.rhinoLink !== false || Boolean(this.editor?.commands.setLink);
509+
const linkEnabled =
510+
this.starterKitOptions.rhinoLink !== false ||
511+
Boolean(this.editor?.commands.setLink);
504512

505513
if (!linkEnabled) return html``;
506514

@@ -558,7 +566,9 @@ export class TipTapEditor extends TipTapEditorBase {
558566
}
559567

560568
renderHeadingButton(prefix = "") {
561-
const headingEnabled = this.starterKitOptions.heading !== false || Boolean(this.editor?.commands.toggleHeading);
569+
const headingEnabled =
570+
this.starterKitOptions.heading !== false ||
571+
Boolean(this.editor?.commands.toggleHeading);
562572

563573
if (!headingEnabled) return html``;
564574

@@ -615,7 +625,9 @@ export class TipTapEditor extends TipTapEditorBase {
615625
}
616626

617627
renderBlockquoteButton(prefix = "") {
618-
const blockQuoteEnabled = this.starterKitOptions.blockquote !== false || Boolean(this.editor?.commands.toggleBlockquote);
628+
const blockQuoteEnabled =
629+
this.starterKitOptions.blockquote !== false ||
630+
Boolean(this.editor?.commands.toggleBlockquote);
619631

620632
if (!blockQuoteEnabled) return html``;
621633

@@ -672,7 +684,9 @@ export class TipTapEditor extends TipTapEditorBase {
672684
}
673685

674686
renderCodeBlockButton(prefix = "") {
675-
const codeBlockEnabled = this.starterKitOptions.codeBlock !== false || Boolean(this.editor?.commands.toggleCodeBlock);
687+
const codeBlockEnabled =
688+
this.starterKitOptions.codeBlock !== false ||
689+
Boolean(this.editor?.commands.toggleCodeBlock);
676690

677691
if (!codeBlockEnabled) return html``;
678692

@@ -728,7 +742,9 @@ export class TipTapEditor extends TipTapEditorBase {
728742
}
729743

730744
renderBulletListButton(prefix = "") {
731-
const bulletListEnabled = this.starterKitOptions.bulletList !== false || Boolean(this.editor?.commands.toggleBulletList);
745+
const bulletListEnabled =
746+
this.starterKitOptions.bulletList !== false ||
747+
Boolean(this.editor?.commands.toggleBulletList);
732748

733749
if (!bulletListEnabled) return html``;
734750

@@ -791,7 +807,9 @@ export class TipTapEditor extends TipTapEditorBase {
791807
}
792808

793809
renderOrderedListButton(prefix = "") {
794-
const orderedListEnabled = this.starterKitOptions.orderedList !== false || Boolean(this.editor?.commands.toggleOrderedList);
810+
const orderedListEnabled =
811+
this.starterKitOptions.orderedList !== false ||
812+
Boolean(this.editor?.commands.toggleOrderedList);
795813

796814
if (!orderedListEnabled) return html``;
797815

@@ -856,7 +874,9 @@ export class TipTapEditor extends TipTapEditorBase {
856874
}
857875

858876
renderAttachmentButton(prefix = "") {
859-
const attachmentEnabled = this.starterKitOptions.rhinoAttachment !== false || Boolean(this.editor?.commands.setAttachment);
877+
const attachmentEnabled =
878+
this.starterKitOptions.rhinoAttachment !== false ||
879+
Boolean(this.editor?.commands.setAttachment);
860880

861881
if (!attachmentEnabled) return html``;
862882

@@ -917,7 +937,9 @@ export class TipTapEditor extends TipTapEditorBase {
917937
}
918938

919939
renderUndoButton(prefix = "") {
920-
const undoEnabled = this.starterKitOptions.history !== false || Boolean(this.editor?.commands.undo);
940+
const undoEnabled =
941+
this.starterKitOptions.history !== false ||
942+
Boolean(this.editor?.commands.undo);
921943

922944
if (!undoEnabled) return html``;
923945

@@ -971,7 +993,8 @@ export class TipTapEditor extends TipTapEditorBase {
971993
renderDecreaseIndentation(prefix = "") {
972994
// Decrease / increase indentation are special cases in that they rely on built-in editor
973995
// commands and not commands added by extensions.
974-
const decreaseIndentationEnabled = this.starterKitOptions.decreaseIndentation !== false // || Boolean(this.editor?.commands.liftListItem);
996+
const decreaseIndentationEnabled =
997+
this.starterKitOptions.decreaseIndentation !== false; // || Boolean(this.editor?.commands.liftListItem);
975998

976999
if (!decreaseIndentationEnabled) return html``;
9771000

@@ -1027,7 +1050,8 @@ export class TipTapEditor extends TipTapEditorBase {
10271050
renderIncreaseIndentation(prefix = "") {
10281051
// Decrease / increase indentation are special cases in that they rely on built-in editor
10291052
// commands and not commands added by extensions.
1030-
const increaseIndentationEnabled = this.starterKitOptions.increaseIndentation !== false // || Boolean(this.editor?.commands.sinkListItem);
1053+
const increaseIndentationEnabled =
1054+
this.starterKitOptions.increaseIndentation !== false; // || Boolean(this.editor?.commands.sinkListItem);
10311055

10321056
if (!increaseIndentationEnabled) return html``;
10331057

@@ -1081,7 +1105,9 @@ export class TipTapEditor extends TipTapEditorBase {
10811105
}
10821106

10831107
renderRedoButton(prefix = "") {
1084-
const redoEnabled = this.starterKitOptions.history !== false || Boolean(this.editor?.commands.redo);
1108+
const redoEnabled =
1109+
this.starterKitOptions.history !== false ||
1110+
Boolean(this.editor?.commands.redo);
10851111

10861112
if (!redoEnabled) return html``;
10871113

0 commit comments

Comments
 (0)