editor.pyi 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211
  1. """Stub file for reflex/components/suneditor/editor.py"""
  2. # ------------------- DO NOT EDIT ----------------------
  3. # This file was generated by `reflex/utils/pyi_generator.py`!
  4. # ------------------------------------------------------
  5. import enum
  6. from typing import Any, Callable, Dict, List, Literal, Optional, Union, overload
  7. from reflex.base import Base
  8. from reflex.components.component import NoSSRComponent
  9. from reflex.event import EventHandler, EventSpec
  10. from reflex.style import Style
  11. from reflex.utils.imports import ImportDict
  12. from reflex.vars.base import Var
  13. class EditorButtonList(list, enum.Enum):
  14. BASIC = [["font", "fontSize"], ["fontColor"], ["horizontalRule"], ["link", "image"]]
  15. FORMATTING = [
  16. ["undo", "redo"],
  17. ["bold", "underline", "italic", "strike", "subscript", "superscript"],
  18. ["removeFormat"],
  19. ["outdent", "indent"],
  20. ["fullScreen", "showBlocks", "codeView"],
  21. ["preview", "print"],
  22. ]
  23. COMPLEX = [
  24. ["undo", "redo"],
  25. ["font", "fontSize", "formatBlock"],
  26. ["bold", "underline", "italic", "strike", "subscript", "superscript"],
  27. ["removeFormat"],
  28. "/",
  29. ["fontColor", "hiliteColor"],
  30. ["outdent", "indent"],
  31. ["align", "horizontalRule", "list", "table"],
  32. ["link", "image", "video"],
  33. ["fullScreen", "showBlocks", "codeView"],
  34. ["preview", "print"],
  35. ["save", "template"],
  36. ]
  37. class EditorOptions(Base):
  38. default_tag: Optional[str]
  39. mode: Optional[str]
  40. rtl: Optional[bool]
  41. button_list: Optional[List[Union[List[str], str]]]
  42. class Editor(NoSSRComponent):
  43. def add_imports(self) -> ImportDict: ...
  44. @overload
  45. @classmethod
  46. def create( # type: ignore
  47. cls,
  48. *children,
  49. lang: Optional[
  50. Union[
  51. Literal[
  52. "ckb",
  53. "da",
  54. "de",
  55. "en",
  56. "es",
  57. "fr",
  58. "he",
  59. "it",
  60. "ja",
  61. "ko",
  62. "lv",
  63. "pl",
  64. "pt_br",
  65. "ro",
  66. "ru",
  67. "se",
  68. "ua",
  69. "zh_cn",
  70. ],
  71. Var[
  72. Union[
  73. Literal[
  74. "ckb",
  75. "da",
  76. "de",
  77. "en",
  78. "es",
  79. "fr",
  80. "he",
  81. "it",
  82. "ja",
  83. "ko",
  84. "lv",
  85. "pl",
  86. "pt_br",
  87. "ro",
  88. "ru",
  89. "se",
  90. "ua",
  91. "zh_cn",
  92. ],
  93. dict,
  94. ]
  95. ],
  96. dict,
  97. ]
  98. ] = None,
  99. name: Optional[Union[Var[str], str]] = None,
  100. default_value: Optional[Union[Var[str], str]] = None,
  101. width: Optional[Union[Var[str], str]] = None,
  102. height: Optional[Union[Var[str], str]] = None,
  103. placeholder: Optional[Union[Var[str], str]] = None,
  104. auto_focus: Optional[Union[Var[bool], bool]] = None,
  105. set_options: Optional[Union[Dict, Var[Dict]]] = None,
  106. set_all_plugins: Optional[Union[Var[bool], bool]] = None,
  107. set_contents: Optional[Union[Var[str], str]] = None,
  108. append_contents: Optional[Union[Var[str], str]] = None,
  109. set_default_style: Optional[Union[Var[str], str]] = None,
  110. disable: Optional[Union[Var[bool], bool]] = None,
  111. hide: Optional[Union[Var[bool], bool]] = None,
  112. hide_toolbar: Optional[Union[Var[bool], bool]] = None,
  113. disable_toolbar: Optional[Union[Var[bool], bool]] = None,
  114. style: Optional[Style] = None,
  115. key: Optional[Any] = None,
  116. id: Optional[Any] = None,
  117. class_name: Optional[Any] = None,
  118. autofocus: Optional[bool] = None,
  119. custom_attrs: Optional[Dict[str, Union[Var, str]]] = None,
  120. on_blur: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  121. on_change: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  122. on_click: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  123. on_context_menu: Optional[
  124. Union[EventHandler, EventSpec, list, Callable, Var]
  125. ] = None,
  126. on_copy: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  127. on_cut: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  128. on_double_click: Optional[
  129. Union[EventHandler, EventSpec, list, Callable, Var]
  130. ] = None,
  131. on_focus: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  132. on_input: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  133. on_load: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  134. on_mount: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  135. on_mouse_down: Optional[
  136. Union[EventHandler, EventSpec, list, Callable, Var]
  137. ] = None,
  138. on_mouse_enter: Optional[
  139. Union[EventHandler, EventSpec, list, Callable, Var]
  140. ] = None,
  141. on_mouse_leave: Optional[
  142. Union[EventHandler, EventSpec, list, Callable, Var]
  143. ] = None,
  144. on_mouse_move: Optional[
  145. Union[EventHandler, EventSpec, list, Callable, Var]
  146. ] = None,
  147. on_mouse_out: Optional[
  148. Union[EventHandler, EventSpec, list, Callable, Var]
  149. ] = None,
  150. on_mouse_over: Optional[
  151. Union[EventHandler, EventSpec, list, Callable, Var]
  152. ] = None,
  153. on_mouse_up: Optional[
  154. Union[EventHandler, EventSpec, list, Callable, Var]
  155. ] = None,
  156. on_paste: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  157. on_resize_editor: Optional[
  158. Union[EventHandler, EventSpec, list, Callable, Var]
  159. ] = None,
  160. on_scroll: Optional[Union[EventHandler, EventSpec, list, Callable, Var]] = None,
  161. on_unmount: Optional[
  162. Union[EventHandler, EventSpec, list, Callable, Var]
  163. ] = None,
  164. toggle_code_view: Optional[
  165. Union[EventHandler, EventSpec, list, Callable, Var]
  166. ] = None,
  167. toggle_full_screen: Optional[
  168. Union[EventHandler, EventSpec, list, Callable, Var]
  169. ] = None,
  170. **props,
  171. ) -> "Editor":
  172. """Create an instance of Editor. No children allowed.
  173. Args:
  174. set_options(Optional[EditorOptions]): Configuration object to further configure the instance.
  175. lang: Language of the editor. Alternatively to a string, a dict of your language can be passed to this prop. Please refer to the library docs for this. options: "en" | "da" | "de" | "es" | "fr" | "ja" | "ko" | "pt_br" | "ru" | "zh_cn" | "ro" | "pl" | "ckb" | "lv" | "se" | "ua" | "he" | "it" default : "en"
  176. name: This is used to set the HTML form name of the editor. This means on HTML form submission, it will be submitted together with contents of the editor by the name provided.
  177. default_value: Sets the default value of the editor. This is useful if you don't want the on_change method to be called on render. If you want the on_change method to be called on render please use the set_contents prop
  178. width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100%
  179. height: Sets the height of the editor. px and percentage values are accepted, eg height="100%" or height="100px"
  180. placeholder: Sets the placeholder of the editor.
  181. auto_focus: Should the editor receive focus when initialized?
  182. set_options: Pass an EditorOptions instance to modify the behaviour of Editor even more.
  183. set_all_plugins: Whether all SunEditor plugins should be loaded. default: True
  184. set_contents: Set the content of the editor. Note: To set the initial contents of the editor without calling the on_change event, please use the default_value prop. set_contents is used to set the contents of the editor programmatically. You must be aware that, when the set_contents's prop changes, the on_change event is triggered.
  185. append_contents: Append editor content
  186. set_default_style: Sets the default style of the editor's edit area
  187. disable: Disable the editor default: False
  188. hide: Hide the editor default: False
  189. hide_toolbar: Hide the editor toolbar default: False
  190. disable_toolbar: Disable the editor toolbar default: False
  191. style: The style of the component.
  192. key: A unique key for the component.
  193. id: The id for the component.
  194. class_name: The class name for the component.
  195. autofocus: Whether the component should take the focus once the page is loaded
  196. custom_attrs: custom attribute
  197. **props: Any properties to be passed to the Editor
  198. Returns:
  199. An Editor instance.
  200. Raises:
  201. ValueError: If set_options is a state Var.
  202. """
  203. ...