Skip to content

Commit

Permalink
refactor: modify comment
Browse files Browse the repository at this point in the history
  • Loading branch information
luolonghao committed Oct 18, 2024
1 parent 20ff903 commit 79b9980
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 12 deletions.
20 changes: 10 additions & 10 deletions src/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ export class Editor {
immediate: true,
});

// Updates the classes of all boxes when the current selection of the editor is changed.
// Updates the classes of all boxes when the current selection is changed.
private updateBoxSelectionStyle = debounce(() => {
// The editor has been unmounted.
if (this.root.first().length === 0) {
Expand Down Expand Up @@ -256,7 +256,7 @@ export class Editor {
immediate: true,
});

// Triggers the statechange event when the current selection of the editor is changed.
// Triggers the statechange event when the current selection is changed.
private emitStateChangeEvent = debounce(() => {
const commandNames = this.command.getNames();
let appliedItems = this.selection.getAppliedItems();
Expand Down Expand Up @@ -342,7 +342,7 @@ export class Editor {
selection.insertNode(document.createTextNode(text));
}

// Resets the value of unsaved input property.
// Resets the value of "unsavedInputData" property.
private resetUnsavedInputData(): void {
this.unsavedInputData = '';
this.unsavedInputCount = 0;
Expand Down Expand Up @@ -389,7 +389,7 @@ export class Editor {
this.history.save();
}

// Binds events about inputting text.
// Binds events for inputting text.
private bindInputEvents(): void {
this.container.on('compositionstart', () => {
this.isComposing = true;
Expand All @@ -409,7 +409,7 @@ export class Editor {
});
}

// Binds events about history.
// Binds events for history.
private bindHistoryEvents(): void {
const executeCommonMethods = (value: string) => {
if (this.fixContent()) {
Expand Down Expand Up @@ -444,7 +444,7 @@ export class Editor {
});
}

// Returns a boolean value indicating whether the editor has focus.
// Returns a boolean value indicating whether the editor is focused.
public get hasFocus(): boolean {
const activeElement = document.activeElement;
if (!activeElement) {
Expand All @@ -453,7 +453,7 @@ export class Editor {
return query(activeElement).closest('.lake-container').get(0) === this.container.get(0);
}

// Returns translation functions by the specified lang.
// Returns translation functions for the specified language.
public get locale(): TranslationFunctions {
return i18nObject(this.config.lang as Locales);
}
Expand Down Expand Up @@ -573,7 +573,7 @@ export class Editor {
artificialCaret.remove();
}

// Sets the specified value to the editor.
// Sets the specified content to the editor.
public setValue(value: string): void {
value = normalizeValue(value);
const htmlParser = new HTMLParser(value);
Expand All @@ -585,15 +585,15 @@ export class Editor {
this.selection.updateByBookmark();
}

// Returns the value of the editor.
// Returns the content of the editor.
public getValue(): string {
const item = this.history.cloneContainer();
let value = new HTMLParser(item).getHTML();
value = denormalizeValue(value);
return value;
}

// Renders an editor area and sets default value to it.
// Renders an editor area and sets default content to it.
public render(): void {
const value = normalizeValue(this.config.value);
const htmlParser = new HTMLParser(value);
Expand Down
3 changes: 1 addition & 2 deletions src/utils/scroll-to-node.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { isVisible } from './is-visible';
import { Nodes } from '../models/nodes';

// If a node is not visible, scrolls the container that contains this node to its position to make it visible.
// If the node is visible, then scrolling takes place.
// If the specified node is not visible, scrolls the container that contains the node to its position to make it visible.
export function scrollToNode(node: Nodes, options?: ScrollIntoViewOptions): void {
const visible = isVisible(node);
if (!visible.left || !visible.right || !visible.top || !visible.bottom) {
Expand Down

0 comments on commit 79b9980

Please sign in to comment.