SPK Editor Configurations
Configuartion Options
	


Configuration Options Explination
  • API Key

    The API key is generated using the purchase code within the provided generate.html file. It is a one-time token, created during this process, and cannot be regenerated.

  • Exclude:

    Purpose: Specifies which editor features and tools should be excluded or disabled.

    Use Case: Allows customization of the available functionalities in the editor. For example, if a simplified editor without formatting options or media insertion is desired, these features can be excluded.

  • icons:

    Purpose: Specifies which icons should be used for different editor tools and features.

    Use Case: Customize the icons displayed in the editor toolbar to match your design or preferences.

  • dropdown:

    Purpose: Configures the dropdown options available in the editor, such as font families, font sizes, and line heights.

    Use Case: Define the available options for dropdown menus to control text styling and formatting in the editor.

  • placeholderText:

    Purpose: Sets the placeholder text displayed in the editor when it is empty.

    Use Case: Provide guidance or initial text to users on what they should do in the editor.

  • customClass:

    Purpose: Adds a custom CSS class to the editor container.

    Use Case: Apply custom styling or CSS rules to the editor.

  • dark:

    Purpose: Enables or disables dark mode in the editor.

    Use Case: Provide a dark theme for the editor interface.

  • rtl:

    Purpose: Sets the text direction of the editor. Options include "ltr" (left-to-right) or "rtl" (right-to-left).

    Use Case: Support different languages and writing directions, such as Arabic or Hebrew.

  • updateValue(value):

    Purpose: Updates the content of the editor with the specified value.

    Use Case: Use this method to programmatically set the content of the editor. For example, you might want to load text from a server or reset the editor to a specific value.

  • sanitizeHTML(html):

    Purpose: Sanitizes the provided HTML string to remove unsafe tags and attributes.

    Use Case: This method helps prevent security issues like XSS (Cross-Site Scripting) by stripping out potentially harmful tags such as script, link, and eval.

  • haveCursorAtStart():

    Purpose: Checks if the cursor is positioned at the start of the content in the editor.

    Use Case: Useful for validating cursor position before performing actions like inserting text at the beginning of the content.

  • haveCursorAtEnd():

    Purpose: Checks if the cursor is positioned at the end of the content in the editor.

    Use Case: Useful for validating cursor position before appending text to the end of the content.

  • Event Handling on(event, callback):

    Purpose: Registers an event listener for specific editor events such as focus, blur, keyup, etc.

    Use Case: Customize the editor's behavior by responding to user interactions or editor events. You can attach custom behavior to these events.

  • debounce(callback, delay):

    Purpose: Creates a debounced version of a function that delays its execution until after a specified delay has elapsed since the last time it was invoked.

    Use Case: Useful for optimizing performance by preventing a function from being called too frequently during events like keyup.

  • throttleFunction(callback, delay):

    Purpose: Creates a throttled version of a function that limits the rate at which it can be called.

    Use Case: Useful for controlling the rate of function execution during events like keyup to avoid excessive processing.

            
        
  • Custom Button and Event Handling
    addButton(label, id, callback, className):

    Purpose: Adds a custom button to the editor toolbar with a specified label, id, and callback function. You can also provide a custom class for styling.

    Use Case: Customize the editor by adding new buttons that trigger specific actions or events.

            
        
Summary
  • exclude: Disables certain features in the editor.

  • icons: Defines icons for various editor tools.

  • dropdown: Configures dropdown options for text formatting.

  • placeholderText: Sets placeholder text for the editor.

  • customClass: Applies a custom CSS class to the editor.

  • dark: Enables dark mode for the editor.

  • rtl: Sets text direction (left-to-right or right-to-left).

  • updateValue(value): Sets the editor content.

  • sanitizeHTML(html): Sanitizes HTML to prevent security risks.

  • haveCursorAtStart(): Checks if the cursor is at the start.

  • haveCursorAtEnd(): Checks if the cursor is at the end.

  • on(event, callback): Adds event listeners to the editor.

  • debounce(callback, delay): Limits how often a function is called.

  • throttleFunction(callback, delay): Controls the rate of function execution.

  • addButton(label, id, callback, className): Adds custom buttons to the editor toolbar.