editor.pyi 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200
  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, Dict, List, Literal, Optional, Tuple, Union, overload
  7. from reflex.base import Base
  8. from reflex.components.component import NoSSRComponent
  9. from reflex.event import EventType
  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. def on_blur_spec(e: Var, content: Var[str]) -> Tuple[Var[str]]: ...
  43. def on_paste_spec(
  44. e: Var, clean_data: Var[str], max_char_count: Var[bool]
  45. ) -> Tuple[Var[str], Var[bool]]: ...
  46. class Editor(NoSSRComponent):
  47. def add_imports(self) -> ImportDict: ...
  48. @overload
  49. @classmethod
  50. def create( # type: ignore
  51. cls,
  52. *children,
  53. lang: Optional[
  54. Union[
  55. Literal[
  56. "ckb",
  57. "da",
  58. "de",
  59. "en",
  60. "es",
  61. "fr",
  62. "he",
  63. "it",
  64. "ja",
  65. "ko",
  66. "lv",
  67. "pl",
  68. "pt_br",
  69. "ro",
  70. "ru",
  71. "se",
  72. "ua",
  73. "zh_cn",
  74. ],
  75. Var[
  76. Union[
  77. Literal[
  78. "ckb",
  79. "da",
  80. "de",
  81. "en",
  82. "es",
  83. "fr",
  84. "he",
  85. "it",
  86. "ja",
  87. "ko",
  88. "lv",
  89. "pl",
  90. "pt_br",
  91. "ro",
  92. "ru",
  93. "se",
  94. "ua",
  95. "zh_cn",
  96. ],
  97. dict,
  98. ]
  99. ],
  100. dict,
  101. ]
  102. ] = None,
  103. name: Optional[Union[Var[str], str]] = None,
  104. default_value: Optional[Union[Var[str], str]] = None,
  105. width: Optional[Union[Var[str], str]] = None,
  106. height: Optional[Union[Var[str], str]] = None,
  107. placeholder: Optional[Union[Var[str], str]] = None,
  108. auto_focus: Optional[Union[Var[bool], bool]] = None,
  109. set_options: Optional[Union[Dict, Var[Dict]]] = None,
  110. set_all_plugins: Optional[Union[Var[bool], bool]] = None,
  111. set_contents: Optional[Union[Var[str], str]] = None,
  112. append_contents: Optional[Union[Var[str], str]] = None,
  113. set_default_style: Optional[Union[Var[str], str]] = None,
  114. disable: Optional[Union[Var[bool], bool]] = None,
  115. hide: Optional[Union[Var[bool], bool]] = None,
  116. hide_toolbar: Optional[Union[Var[bool], bool]] = None,
  117. disable_toolbar: Optional[Union[Var[bool], bool]] = None,
  118. style: Optional[Style] = None,
  119. key: Optional[Any] = None,
  120. id: Optional[Any] = None,
  121. class_name: Optional[Any] = None,
  122. autofocus: Optional[bool] = None,
  123. custom_attrs: Optional[Dict[str, Union[Var, Any]]] = None,
  124. on_blur: Optional[Union[EventType[()], EventType[str]]] = None,
  125. on_change: Optional[Union[EventType[()], EventType[str]]] = None,
  126. on_click: Optional[EventType[()]] = None,
  127. on_context_menu: Optional[EventType[()]] = None,
  128. on_copy: Optional[EventType[()]] = None,
  129. on_cut: Optional[EventType[()]] = None,
  130. on_double_click: Optional[EventType[()]] = None,
  131. on_focus: Optional[EventType[()]] = None,
  132. on_input: Optional[EventType[()]] = None,
  133. on_load: Optional[Union[EventType[()], EventType[bool]]] = None,
  134. on_mount: Optional[EventType[()]] = None,
  135. on_mouse_down: Optional[EventType[()]] = None,
  136. on_mouse_enter: Optional[EventType[()]] = None,
  137. on_mouse_leave: Optional[EventType[()]] = None,
  138. on_mouse_move: Optional[EventType[()]] = None,
  139. on_mouse_out: Optional[EventType[()]] = None,
  140. on_mouse_over: Optional[EventType[()]] = None,
  141. on_mouse_up: Optional[EventType[()]] = None,
  142. on_paste: Optional[
  143. Union[EventType[()], EventType[str], EventType[str, bool]]
  144. ] = None,
  145. on_scroll: Optional[EventType[()]] = None,
  146. on_unmount: Optional[EventType[()]] = None,
  147. toggle_code_view: Optional[Union[EventType[()], EventType[bool]]] = None,
  148. toggle_full_screen: Optional[Union[EventType[()], EventType[bool]]] = None,
  149. **props,
  150. ) -> "Editor":
  151. """Create an instance of Editor. No children allowed.
  152. Args:
  153. set_options: Configuration object to further configure the instance.
  154. 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".
  155. 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.
  156. 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
  157. width: Sets the width of the editor. px and percentage values are accepted, eg width="100%" or width="500px" default: 100%
  158. height: Sets the height of the editor. px and percentage values are accepted, eg height="100%" or height="100px"
  159. placeholder: Sets the placeholder of the editor.
  160. auto_focus: Should the editor receive focus when initialized?
  161. set_options: Pass an EditorOptions instance to modify the behaviour of Editor even more.
  162. set_all_plugins: Whether all SunEditor plugins should be loaded. default: True.
  163. 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.
  164. append_contents: Append editor content
  165. set_default_style: Sets the default style of the editor's edit area
  166. disable: Disable the editor default: False.
  167. hide: Hide the editor default: False.
  168. hide_toolbar: Hide the editor toolbar default: False.
  169. disable_toolbar: Disable the editor toolbar default: False.
  170. on_change: Fired when the editor content changes.
  171. on_input: Fired when the something is inputted in the editor.
  172. on_blur: Fired when the editor loses focus.
  173. on_load: Fired when the editor is loaded.
  174. on_copy: Fired when the editor content is copied.
  175. on_cut: Fired when the editor content is cut.
  176. on_paste: Fired when the editor content is pasted.
  177. toggle_code_view: Fired when the code view is toggled.
  178. toggle_full_screen: Fired when the full screen mode is toggled.
  179. style: The style of the component.
  180. key: A unique key for the component.
  181. id: The id for the component.
  182. class_name: The class name for the component.
  183. autofocus: Whether the component should take the focus once the page is loaded
  184. custom_attrs: custom attribute
  185. **props: Any properties to be passed to the Editor
  186. Returns:
  187. An Editor instance.
  188. Raises:
  189. ValueError: If set_options is a state Var.
  190. """
  191. ...