Class to manipulate the rich texts content
:return: [description] :rtype: [type]
Attributes
blocks: List
editor_version: str
version: int
Functions
Initialize self. See help(type(self)) for accurate signature.
Name | Type | Default value | Description |
---|---|---|---|
rich_text_dto | Optional | ||
target_version | int |
Add a figure to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
figure_data | RichTextFigureData | ||
parameter_name | str |
RichTextBlock |
Add a file to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
file_data | RichTextFileData | ||
parameter_name | str |
RichTextBlock |
Add a view to a rich text content. This view is not associated with a resource
Name | Type | Default value | Description |
---|---|---|---|
file_view | RichTextViewFileData | View to add | |
parameter_name | str | Name of the parameter where to insert the block. if none, the block is appended , optional |
RichTextBlock |
Add a math formula to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
formula | str | :param formula_data: math formula using the katex syntax :type formula_data: | |
parameter_name | str | Name of the parameter where to insert the block. if none, the block is appended , optional |
RichTextBlock |
Add a header to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
text | str | ||
level | RichTextParagraphHeaderLevel |
RichTextBlock |
Add a list to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
data | RichTextParagraphListData |
RichTextBlock |
Add a view to a rich text content used in note. This requires the note to call the view
Name | Type | Default value | Description |
---|---|---|---|
resource_view | RichTextNoteResourceViewData | View to add | |
parameter_name | str | Name of the parameter where to insert the block. if none, the block is appended , optional |
RichTextBlock |
Add a paragraph to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
text | str |
RichTextBlock |
Name | Type | Default value | Description |
---|---|---|---|
resource_view | RichTextResourceViewData | ||
parameter_name | str |
RichTextBlock |
Add a timestamp to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
timestamp_data | RichTextTimestampData | ||
parameter_name | str |
RichTextBlock |
Append a block to the rich text content
Name | Type | Default value | Description |
---|---|---|---|
block | RichTextBlock | Block to add |
int |
Name | Type | Default value | Description |
---|---|---|---|
rich_text | RichText |
str |
Set |
Get the block at the given index
Name | Type | Default value | Description |
---|---|---|---|
index | int |
RichTextBlock |
Get the block by its id
Name | Type | Default value | Description |
---|---|---|---|
block_id | str | Id of the block |
Optional |
Get the block index by its id
Name | Type | Default value | Description |
---|---|---|---|
block_id | str | Id of the block |
int |
List |
Get the blocks of the given type
Name | Type | Default value | Description |
---|---|---|---|
block_type | RichTextBlockType |
List |
List |
List |
List |
List |
Check if the rich text contains a resource view with the given view_config_id
Name | Type | Default value | Description |
---|---|---|---|
view_config_id | str |
bool |
Insert an element in the rich text content at the given index
Name | Type | Default value | Description |
---|---|---|---|
index | int | ||
block | RichTextBlock |
bool |
Replace a block at the given index
Name | Type | Default value | Description |
---|---|---|---|
index | int | ||
block | RichTextBlock |
Replace a block by its id
Name | Type | Default value | Description |
---|---|---|---|
block_id | str | ||
block | RichTextBlock |
Replace the data of a block by its id
Name | Type | Default value | Description |
---|---|---|---|
block_id | str | ||
data | Any |
Method to remove the resource view from the rich text content and replace it when parameters. Useful when creating a template (because templates can't have resource views)
Serialize the object into a json object. For SerializableRField, this method is called when the resource is saved.
dict |
Replace the parameter in the rich text content text
Name | Type | Default value | Description |
---|---|---|---|
parameter_name | str | ||
value | str |
RichTextDTO |
dict |
Create a block
Name | Type | Default value | Description |
---|---|---|---|
id_ | str | ||
block_type | RichTextBlockType | ||
data | Any |
RichTextBlock |
summary
Name | Type | Default value | Description |
---|---|---|---|
id_ | str | Id of the block | |
formula | str | Math formula using the katex syntax |
RichTextBlock |
Create a paragraph block
Name | Type | Default value | Description |
---|---|---|---|
id_ | str | ||
text | str | ||
level | RichTextParagraphHeaderLevel |
RichTextBlock |
Create a list block
Name | Type | Default value | Description |
---|---|---|---|
id_ | str | ||
data | RichTextParagraphListData |
RichTextBlock |
Create a paragraph block
Name | Type | Default value | Description |
---|---|---|---|
id_ | str | ||
text | str |
RichTextBlock |
Name | Type | Default value | Description |
---|---|---|---|
blocks | List |
RichTextDTO |
Create a timestamp block
Name | Type | Default value | Description |
---|---|---|---|
id_ | str | ||
data | RichTextTimestampData |
RichTextBlock |
Deserialize the object from a json object. For SerializableRField, this method is called when the RField is loaded.
Name | Type | Default value | Description |
---|---|---|---|
data | dict | Json object generated by the serialize method union[dict, list, str, bool, float] |
RichText |