Back to bricks list
Introduction Getting Started
Architecture
Technical Documentation
Other Classes
AbstractDbManager AgentFactory AudioView AuthService BadRequestException BarPlotView Base BaseEnvShell BaseHTTPException BaseModelDTO BaseTestCase BaseTestCaseLight BashCodeParam BoolParam BoolRField BoolValidator BoxPlotView BrickMigration BrickService CheckBeforeTaskResult CommunityService Compress CondaShellProxy Config ConfigParams Connector ConnectorPartSpec ConnectorSpec ConverterRunner Credentials CredentialsDataBasic CredentialsDataLab CredentialsDataOther CredentialsDataS3 CredentialsParam CredentialsType CurrentUserService Dashboard DashboardType DataframeAggregatorHelper DataframeDataFilterHelper DataframeFilterHelper DataFrameRField DataframeScalerHelper datetime DateTimeUTC DbConfig DictRField DictValidator DispatchedMessage DynamicInputs DynamicOutputs EntityNavigator EntityNavigatorNote EntityNavigatorResource EntityNavigatorScenario EntityNavigatorService EntityNavigatorView EntityTag EntityType Enum ExceptionHandler ExceptionResponse ExpressionBuilder ExternalApiService ExternalSpaceCreateFolder FileDownloader FileHelper FileRField FloatParam FloatRField FloatValidator ForbiddenException FrontService FrontTheme FSNodeModel FsNodeService GwsCorePackages GWSException GzipCompress HeatmapView HistogramView ImageView InPort Inputs InputSpec InputSpecs InterfaceSpec IntParam IntRField IntValidator IO IOface Job JsonCodeParam JSONField JSONView JuliaCodeParam KVStore LazyViewParam LinePlot2DView ListParam ListRField ListValidator Logger LoggerMessageObserver MailService MambaShellProxy MessageDispatcher MessageLevel MessageObserver Model ModelRfield ModelService Monitor MonitorService MultiViews NetworkView Note Notebook NoteParam NoteSearchBuilder NoteService NoteTemplate NoteTemplateParam NoteTemplateService NotFoundException NumericHelper NumericParam NumericValidator OpenAiChat OpenAiChatMessage OpenAiChatParam OpenAiHelper OutPort Outputs OutputSpec OutputSpecs PackageHelper Paginator ParamSet ParamSpec PerlCodeParam PipShellProxy PlotlyRField PlotlyView PoolDb Port PrimitiveRField Process ProcessFactory ProcessModel ProcessProxy ProcessSpec ProgressBar ProgressBarMessageObserver ProgressBarService ProtocolModel ProtocolProxy ProtocolService ProtocolTyping PythonCodeParam Queue QueueService RCodeParam Requests ResourceDownloaderBase ResourceModel ResourceOrigin ResourceRField ResourceSearchBuilder ResourceService ResourceTransfertService ResourceTyping RField RichText RichTextBlock RichTextBlockModificationDTO RichTextBlockModificationWithUserDTO RichTextBlockType RichTextDTO RichTextFigureData RichTextFileData RichTextFormulaData RichTextListData RichTextListItem RichTextModificationDifferenceDTO RichTextModificationsDTO RichTextModificationType RichTextNoteResourceViewData RichTextObjectType RichTextParagraphData RichTextParagraphHeaderData RichTextParagraphHeaderLevel RichTextParagraphListData RichTextParagraphListItemData RichTextParagraphText RichTextResourceViewData RichTextTimestampData RichTextUserDTO RichTextVariableData RichTextView RichTextViewFileData S3Bucket ScatterPlot2DView Scenario ScenarioCreationType ScenarioProcessStatus ScenarioProxy ScenarioRunService ScenarioSaveDTO ScenarioSearchBuilder ScenarioService ScenarioStatus ScenarioTemplate ScenarioTemplateFactory ScenarioTransfertService SearchBuilder SerializableObjectJson SerializableRField Settings ShellProxy ShellProxyFactory SimpleTextView SpaceFolder SpaceService SqlMigrator StackedBarPlotView StreamlitApp StreamlitAppManager StreamlitProcess StringHelper StrParam StrRField StrValidator SysProc TableAnnotatorHelper TableColumnSelector TableColumnTagToRowExtractor TableColumnTagUnfolder TableConcatHelper TableHeaderInfo TableOperationHelper TableRowSelector TableRowTagToColumnExtractor TableRowTagUnfolder TableScalerHelper TableTagAggregatorHelper TableUnfolderHelper TableView TabularView Tag TagHelper TagKeyModel TagList TagService TagsParam TagValueModel TarCompress TarGzCompress TaskFileDownloader TaskHelper TaskInputs TaskModel TaskProxy TaskRunner TaskService TaskTyping TechnicalInfo TextParam TextView TextViewData Typing TypingDeprecated TypingIconColor TypingIconType TypingManager TypingStyle UnauthorizedException URLValidator User UserCredentialsDTO UserGroup UserService Utils UUIDRField Validator VennDiagramView Version View ViewConfig ViewTester ViewType YamlCodeParam ZipCompress
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.

Parameters:
NameTypeDefault valueDescription
rich_text_dtoOptional
target_versionint
ADD_FIGURE

Add a figure to the rich text content

Parameters:
NameTypeDefault valueDescription
figure_dataRichTextFigureData
parameter_namestr
Return type:
RichTextBlock
ADD_FILE

Add a file to the rich text content

Parameters:
NameTypeDefault valueDescription
file_dataRichTextFileData
parameter_namestr
Return type:
RichTextBlock
ADD_FILE_VIEW

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

Parameters:
NameTypeDefault valueDescription
file_viewRichTextViewFileData View to add
parameter_namestr Name of the parameter where to insert the block. if none, the block is appended , optional
Return type:
RichTextBlock
ADD_FORMULA

Add a math formula to the rich text content

Parameters:
NameTypeDefault valueDescription
formulastr :param formula_data: math formula using the katex syntax :type formula_data:
parameter_namestr Name of the parameter where to insert the block. if none, the block is appended , optional
Return type:
RichTextBlock
ADD_HEADER

Add a header to the rich text content

Parameters:
NameTypeDefault valueDescription
textstr
levelRichTextParagraphHeaderLevel
Return type:
RichTextBlock
ADD_LIST

Add a list to the rich text content

Parameters:
NameTypeDefault valueDescription
dataRichTextParagraphListData
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

Parameters:
NameTypeDefault valueDescription
resource_viewRichTextNoteResourceViewData View to add
parameter_namestr Name of the parameter where to insert the block. if none, the block is appended , optional
Return type:
RichTextBlock
ADD_PARAGRAPH

Add a paragraph to the rich text content

Parameters:
NameTypeDefault valueDescription
textstr
Return type:
RichTextBlock
ADD_RESOURCE_VIEW
Parameters:
NameTypeDefault valueDescription
resource_viewRichTextResourceViewData
parameter_namestr
Return type:
RichTextBlock
ADD_TIMESTAMP

Add a timestamp to the rich text content

Parameters:
NameTypeDefault valueDescription
timestamp_dataRichTextTimestampData
parameter_namestr
Return type:
RichTextBlock
APPEND_BLOCK

Append a block to the rich text content

Parameters:
NameTypeDefault valueDescription
blockRichTextBlock Block to add
Return type:
int
APPEND_RICH_TEXT
Parameters:
NameTypeDefault valueDescription
rich_textRichText
GENERATE_ID
Return type:
str
GET_ASSOCIATED_RESOURCES
Return type:
Set
GET_BLOCK_AT_INDEX

Get the block at the given index

Parameters:
NameTypeDefault valueDescription
indexint
Return type:
RichTextBlock
GET_BLOCK_BY_ID

Get the block by its id

Parameters:
NameTypeDefault valueDescription
block_idstr Id of the block
Return type:
Optional
GET_BLOCK_INDEX_BY_ID

Get the block index by its id

Parameters:
NameTypeDefault valueDescription
block_idstr Id of the block
Return type:
int
GET_BLOCKS
Return type:
List
GET_BLOCKS_BY_TYPE

Get the blocks of the given type

Parameters:
NameTypeDefault valueDescription
block_typeRichTextBlockType
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

Parameters:
NameTypeDefault valueDescription
view_config_idstr
Return type:
bool
INSERT_BLOCK_AT_INDEX

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

Parameters:
NameTypeDefault valueDescription
indexint
blockRichTextBlock
IS_EMPTY
Return type:
bool
REPLACE_BLOCK_AT_INDEX

Replace a block at the given index

Parameters:
NameTypeDefault valueDescription
indexint
blockRichTextBlock
REPLACE_BLOCK_BY_ID

Replace a block by its id

Parameters:
NameTypeDefault valueDescription
block_idstr
blockRichTextBlock
REPLACE_BLOCK_DATA_BY_ID

Replace the data of a block by its id

Parameters:
NameTypeDefault valueDescription
block_idstr
dataAny
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

Parameters:
NameTypeDefault valueDescription
parameter_namestr
valuestr
replace_blockbool False
TO_DTO
Return type:
RichTextDTO
TO_DTO_JSON_DICT
Return type:
dict
CREATE_BLOCK - @classmethod

Create a block

Parameters:
NameTypeDefault valueDescription
id_str
block_typeRichTextBlockType
dataAny
Return type:
RichTextBlock
CREATE_FORMULA - @classmethod

summary

Parameters:
NameTypeDefault valueDescription
id_str Id of the block
formulastr Math formula using the katex syntax
Return type:
RichTextBlock
CREATE_HEADER - @classmethod

Create a paragraph block

Parameters:
NameTypeDefault valueDescription
id_str
textstr
levelRichTextParagraphHeaderLevel
Return type:
RichTextBlock
CREATE_LIST - @classmethod

Create a list block

Parameters:
NameTypeDefault valueDescription
id_str
dataRichTextParagraphListData
Return type:
RichTextBlock
CREATE_PARAGRAPH - @classmethod

Create a paragraph block

Parameters:
NameTypeDefault valueDescription
id_str
textstr
Return type:
RichTextBlock
CREATE_RICH_TEXT_DTO - @classmethod
Parameters:
NameTypeDefault valueDescription
blocksList
Return type:
RichTextDTO
CREATE_TIMESTAMP - @classmethod

Create a timestamp block

Parameters:
NameTypeDefault valueDescription
id_str
dataRichTextTimestampData
Return type:
RichTextBlock
DESERIALIZE - @classmethod

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

Parameters:
NameTypeDefault valueDescription
datadict Json object generated by the serialize method union[dict, list, str, bool, float]
Return type:
RichText
FROM_JSON - @classmethod
Parameters:
NameTypeDefault valueDescription
datadict
Return type:
RichText