editor.py 905 B

12345678910111213141516171819202122232425
  1. from typing import Any, Callable, Optional
  2. from .mixins.disableable_element import DisableableElement
  3. from .mixins.value_element import ValueElement
  4. class Editor(ValueElement, DisableableElement):
  5. def __init__(self,
  6. *,
  7. placeholder: Optional[str] = None,
  8. value: str = '',
  9. on_change: Optional[Callable[..., Any]] = None,
  10. ) -> None:
  11. """Editor
  12. A WYSIWYG editor based on `Quasar's QEditor <https://quasar.dev/vue-components/editor>`_.
  13. The value is a string containing the formatted text as HTML code.
  14. :param value: initial value
  15. :param on_change: callback to be invoked when the value changes
  16. """
  17. super().__init__(tag='q-editor', value=value, on_value_change=on_change)
  18. if placeholder is not None:
  19. self._props['placeholder'] = placeholder