editor.pyi 10 KB

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