Back to bricks list
Introduction
Getting Started
Developer guide
Release
Architecture
CLI
Technical documentations
Version

RichText

Class to manipulate the rich texts content

:return: [description] :rtype: [type]

Attributes
blocks: Listeditor_version: strversion: int
Functions
__INIT__

Initialize self. See help(type(self)) for accurate signature.

rich_text_dto : Optional
target_version : int
ADD_FIGURE

Add a figure to the rich text content

figure_data : RichTextFigureData
parameter_name : str
Return type : RichTextBlock
ADD_FILE

Add a file to the rich text content

file_data : RichTextFileData
parameter_name : str
Return type : RichTextBlock
ADD_FILE_VIEW

Add a view to a rich text content. This view is not associated with a resource

file_view : RichTextViewFileData
view to add
parameter_name : str
name of the parameter where to insert the block. If None, the block is appended
Return type : RichTextBlock
ADD_FORMULA

Add a math formula to the rich text content

formula : str
parameter_name : str
name of the parameter where to insert the block. If None, the block is appended
Return type : RichTextBlock
ADD_HEADER

Add a header to the rich text content

text : str
level : RichTextParagraphHeaderLevel
Return type : RichTextBlock
ADD_LIST

Add a list to the rich text content

data : RichTextParagraphListData
Return type : RichTextBlock
ADD_NOTE_RESOURCE_VIEW

Add a view to a rich text content used in note. This requires the note to call the view

Resource view : RichTextNoteResourceViewData
view to add
parameter_name : str
name of the parameter where to insert the block. If None, the block is appended
Return type : RichTextBlock
ADD_PARAGRAPH

Add a paragraph to the rich text content

text : str
Return type : RichTextBlock
ADD_RESOURCE_VIEW
Resource view : RichTextResourceViewData
parameter_name : str
Return type : RichTextBlock
ADD_TIMESTAMP

Add a timestamp to the rich text content

timestamp_data : RichTextTimestampData
parameter_name : str
Return type : RichTextBlock
APPEND_BLOCK

Append a block to the rich text content

block : RichTextBlock
block to add
Return type : int
APPEND_RICH_TEXT
rich_text : RichText
GENERATE_ID
Return type : str
GET_ASSOCIATED_RESOURCES
Return type : Set
GET_BLOCK_AT_INDEX

Get the block at the given index

index : int
Return type : RichTextBlock
GET_BLOCK_BY_ID

Get the block by its id

block_id : str
id of the block
Return type : Optional
GET_BLOCK_INDEX_BY_ID

Get the block index by its id

block_id : str
id of the block
Return type : int
GET_BLOCKS
Return type : List
GET_BLOCKS_BY_TYPE

Get the blocks of the given type

block_type : RichTextBlockType
Return type : List
GET_FIGURES_DATA
Return type : List
GET_FILE_VIEWS_DATA
Return type : List
GET_FILES_DATA
Return type : List
GET_RESOURCE_VIEWS_DATA
Return type : List
HAS_VIEW_CONFIG

Check if the rich text contains a resource view with the given view_config_id

view_config_id : str
Return type : bool
INSERT_BLOCK_AT_INDEX

Insert an element in the rich text content at the given index

index : int
block : RichTextBlock
IS_EMPTY
Return type : bool
REPLACE_BLOCK_AT_INDEX

Replace a block at the given index

index : int
block : RichTextBlock
REPLACE_BLOCK_BY_ID

Replace a block by its id

block_id : str
block : RichTextBlock
REPLACE_BLOCK_DATA_BY_ID

Replace the data of a block by its id

block_id : str
data : Any
REPLACE_RESOURCE_VIEWS_WITH_PARAMETERS

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

Serialize the object into a json object. For SerializableRField, this method is called when the resource is saved.

Return type : dict
SET_PARAMETER

Replace the parameter in the rich text content text

parameter_name : str
value : str
replace_block : bool - False
TO_DTO
Return type : RichTextDTO
TO_DTO_JSON_DICT
Return type : dict
CREATE_BLOCK - @classmethod

Create a block

id_ : str
block_type : RichTextBlockType
data : Any
Return type : RichTextBlock
CREATE_FORMULA - @classmethod

summary

id_ : str
id of the block
formula : str
math formula using the KaTeX syntax
Return type : RichTextBlock
CREATE_HEADER - @classmethod

Create a paragraph block

id_ : str
text : str
level : RichTextParagraphHeaderLevel
Return type : RichTextBlock
CREATE_LIST - @classmethod

Create a list block

id_ : str
data : RichTextParagraphListData
Return type : RichTextBlock
CREATE_PARAGRAPH - @classmethod

Create a paragraph block

id_ : str
text : str
Return type : RichTextBlock
CREATE_RICH_TEXT_DTO - @classmethod
blocks : List
Return type : RichTextDTO
CREATE_TIMESTAMP - @classmethod

Create a timestamp block

id_ : str
data : RichTextTimestampData
Return type : RichTextBlock
DESERIALIZE - @classmethod

Deserialize the object from a json object. For SerializableRField, this method is called when the RField is loaded.

data : dict
json object generated by the serialize method
Return type : RichText
FROM_JSON - @classmethod
data : dict
Return type : RichText