Inherits from NSObject
Declared in IINKEditor.h

Overview

The Editor is the entry point by which modification is associated to a part. An editor is associated with a single part.

Tasks

Properties

canRedo

@property (nonatomic, readonly) BOOL canRedo
Discussion

Whether redo can be performed on the part or not

Declared In

IINKEditor.h

canUndo

@property (nonatomic, readonly) BOOL canUndo
Discussion

Whether undo can be performed on the part or not

Declared In

IINKEditor.h

delegate

@property (weak, nonatomic, nullable) id<IINKEditorDelegate> delegate
Discussion

The specified listener to this editor.

Declared In

IINKEditor.h

engine

@property (nonatomic, readonly, nonnull) IINKEngine *engine
Discussion

The Engine to which this editor is attached.

Declared In

IINKEditor.h

idle

@property (nonatomic, readonly) BOOL idle
Discussion

Whether part modification operations are over.

Declared In

IINKEditor.h

part

@property (strong, nonatomic, nullable) IINKContentPart *part
Discussion

The part managed by this editor.

Declared In

IINKEditor.h

penStyle

@property (nonatomic, strong, nonnull) NSString *penStyle
Discussion

The CSS style properties associated with new strokes.

Note: style properties provided with penStyle() may override the properties associated with the style classes provided via penStyleClasses().

Declared In

IINKEditor.h

penStyleClasses

@property (nonatomic, strong, nonnull) NSString *penStyleClasses
Discussion

The style classes associated with new strokes.

Note: style properties penStyle may override the styling associated with the style classes provided here.

Declared In

IINKEditor.h

renderer

@property (strong, nonatomic, nonnull) IINKRenderer *renderer
Discussion

The Renderer associated with this editor.

Declared In

IINKEditor.h

rootBlock

@property (nonatomic, strong, readonly, nullable) IINKContentBlock *rootBlock
Discussion

The content block at the root of the current part.

Declared In

IINKEditor.h

scrollAllowed

@property (nonatomic, readonly, getter=isScrollAllowed) BOOL scrollAllowed
Discussion

Whether scrolling on the part is allowed at this time.

Note: this applies for example when the editor is resizing or moving an object.

Declared In

IINKEditor.h

supportedAddBlockTypes

@property (nonatomic, readonly, nonnull) NSArray<NSString*> *supportedAddBlockTypes
Discussion

The types of blocks that can be added to the part.

Note: new blocks can be added only to a ContentPart with “Text Document” type: “Text” blocks are automatically created but other blocks must be added via addBlock(). Blocks cannot be added on other types of part.

Declared In

IINKEditor.h

theme

@property (nonatomic, strong, nonnull) NSString *theme
Discussion

The rendering theme style sheet, from a buffer containing CSS styling information.

Declared In

IINKEditor.h

Instance Methods

addBlock:type:error:

- (nullable IINKContentBlock *)addBlock:(CGPoint)position type:(nonnull NSString *)type error:(NSError *_Nullable *_Nullable)error
Discussion

Adds a new block to the part.

Parameters

position

the approximative position of the new block.

type

the type of the new block.

error

the recipient for the error description object * IINKErrorInvalidArgument when type is not supported by current part type. * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when a block already exists at this position, and is not a “Container” block. * IINKErrorRuntime when empty space around position is too small for a new block.

Return Value

block the newly added block on success, otherwise nil.

Declared In

IINKEditor.h

addBlock:type:mimeType:data:error:

- (nullable IINKContentBlock *)addBlock:(CGPoint)position type:(nonnull NSString *)type mimeType:(IINKMimeType)mimeType data:(nonnull NSString *)data error:(NSError *_Nullable *_Nullable)error
Discussion

Adds a new block to the part and fills it with data.

Parameters

position

the approximative position of the new block.

type

the type of the new block.

mimeType

the mime type that specifies the format of data.

data

the data to put i the new block.

error

the recipient for the error description object * IINKErrorInvalidArgument when type is not supported by current part type. * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when a block already exists at this position, and is not a “Container” block. * IINKErrorRuntime when empty space around position is too small for a new block. * IINKErrorRuntime when the content of data could not be added to the new block.

Return Value

block the newly added block on success, otherwise nil.

Declared In

IINKEditor.h

addImage:file:mimeType:error:

- (nullable IINKContentBlock *)addImage:(CGPoint)position file:(nonnull NSString *)file mimeType:(IINKMimeType)mimeType error:(NSError *_Nullable *_Nullable)error
Discussion

Adds a new image to the part.

Note: this method creates a new “Drawing” block in which the image will be added.

Parameters

position

the approximative position of the new image.

file

the image file to add.

mimeType

the mime type that specifies the format of inputFile.

error

the recipient for the error description object * IINKErrorInvalidArgument when mimeType is not an image type. * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when a block already exists at this position, and is not a “Container” block. * IINKErrorRuntime when empty space around position is too small for a new block. * IINKErrorRuntime when an I/O operation fails.

Return Value

the “Drawing” block associated with the newly added image on success, otherwise nil.

Declared In

IINKEditor.h

clampViewOffset:

- (void)clampViewOffset:(CGPoint *_Nonnull)viewOffset
Discussion

Clamps the supplied view offset to the area that ensures standard scrolling behavior. For “Diagram”, “Drawing” and “Math” it allows scrolling one screen outside of the view box on each direction. For “Text” and “Text Document” it allows scrolling one screen outside of the view box downward.

Parameters

viewOffset

the view offset to clamp.

Declared In

IINKEditor.h

clear

- (void)clear
Discussion

Removes all content from the part.

Declared In

IINKEditor.h

convert:targetState:error:

- (BOOL)convert:(nullable IINKContentBlock *)block targetState:(IINKConversionState)targetState error:(NSError *_Nullable *_Nullable)error
Discussion

Converts the specified content to digital form.

Parameters

block

the block to convert, nil means convert full part.

targetState

the target conversion state for the block.

error

the recipient for the error description object * IINKErrorRuntime when there is no IFontMetricsProvider associated with this editor. * IINKErrorInvalidArgument when the target conversion state is not reachable from the current state of the specified block.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

copy:error:

- (BOOL)copy:(nonnull IINKContentBlock *)block error:(NSError *_Nullable *_Nullable)error
Discussion

Copies a block to the internal clipboard.

Parameters

block

the block to copy.

error

the recipient for the error description object * IINKErrorRuntime when editor is not associated with a part.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

export_:mimeType:error:

- (nullable NSString *)export_:(nullable IINKContentBlock *)block mimeType:(IINKMimeType)mimeType error:(NSError *_Nullable *_Nullable)error
Discussion

Exports the specified content.

Note: the method is named export_ because the C++ standard defines export as a keyword.

Parameters

block

the block to export, nullptr means export full part.

mimeType

the mime type that specifies the output format.

error

the recipient for the error description object * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when the specified mime type is not supported. * IINKErrorRuntime when an I/O operation fails. * IINKErrorInvalidArgument when there is nothing to export.

Return Value

the exported content on success, otherwise nil.

Declared In

IINKEditor.h

export_:toFile:imageDrawer:error:

- (BOOL)export_:(nullable IINKContentBlock *)block toFile:(nonnull NSString *)file imageDrawer:(nullable id<IINKIImageDrawer>)imageDrawer error:(NSError *_Nullable *_Nullable)error
Discussion

Exports the specified content.

Note: the method is named export_ because the C++ standard defines export as a keyword.

Parameters

block

the block to export, nullptr means export full part.

file

the file to export to.

imageDrawer

an image drawer that is required for some output formats. If you know that the specified output format don’t require it you can leave it null.

error

the recipient for the error description object * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when an I/O operation fails. * IINKErrorRuntime when imageDrawer does not create the expected file. * IINKErrorInvalidArgument when there is nothing to export. * IINKErrorInvalidArgument when outputFile is invalid.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

export_:toFile:mimeType:imageDrawer:error:

- (BOOL)export_:(nullable IINKContentBlock *)block toFile:(nonnull NSString *)file mimeType:(IINKMimeType)mimeType imageDrawer:(nullable id<IINKIImageDrawer>)imageDrawer error:(NSError *_Nullable *_Nullable)error
Discussion

Exports the specified content.

Note: the method is named export_ because the C++ standard defines export as a keyword.

Parameters

block

the block to export, nullptr means export full part.

file

the file to export to.

mimeType

the mime type that specifies the output format.

imageDrawer

an image drawer that is required for some output formats. If you know that the specified output format don’t require it you can leave it null.

error

the recipient for the error description object * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when the specified mime type is not supported. * IINKErrorRuntime when an I/O operation fails. * IINKErrorRuntime when imageDrawer does not create the expected file. * IINKErrorInvalidArgument when there is nothing to export. * IINKErrorInvalidArgument when outputFile is invalid.

Return Value

YES on success, otherwise NO.

YES on success, otherwise NO.

Declared In

IINKEditor.h

getBlockById:

- (nullable IINKContentBlock *)getBlockById:(nullable NSString *)identifier
Discussion

Returns the content block associated with a given id.

Parameters

identifier

the identifier of the block.

Return Value

the content block associated with id or nil if there is no such block in the current part.

Declared In

IINKEditor.h

getSupportedAddBlockDataMimeTypes:

- (nonnull NSArray<IINKMimeTypeValue*> *)getSupportedAddBlockDataMimeTypes:(nonnull NSString *)type
Discussion

Returns the supported format for adding a new block with data.

Parameters

type

the type of the new block.

Return Value

an array of the supported mime types.

Declared In

IINKEditor.h

getSupportedExportMimeTypes:

- (nonnull NSArray<IINKMimeTypeValue*> *)getSupportedExportMimeTypes:(nullable IINKContentBlock *)block
Discussion

Returns the supported export formats for specified content.

Parameters

block

the block to request, nil means full part.

Return Value

an array of the supported mime types.

Declared In

IINKEditor.h

getSupportedImportMimeTypes:

- (nonnull NSArray<IINKMimeTypeValue*> *)getSupportedImportMimeTypes:(nullable IINKContentBlock *)block
Discussion

Returns the supported import formats for specified content.

Parameters

block

the block to request, nullptr means full part.

Return Value

an array of the supported mime types.

Declared In

IINKEditor.h

getSupportedTargetConversionState:

- (nonnull NSArray<IINKConversionStateValue*> *)getSupportedTargetConversionState:(nullable IINKContentBlock *)block
Discussion

Returns the supported target conversion states for the specified content.

Parameters

block

the block for which the supported target conversion states are requested, nil means full part.

Return Value

an array of the supported target conversion states.

Declared In

IINKEditor.h

hitBlock:

- (nullable IINKContentBlock *)hitBlock:(CGPoint)position
Discussion

Return the block at the given position, or nullptr if there is no block at that position.

Parameters

position

the hit position coordinates.

Return Value

the block below hit position, or nil if no block was found.

Declared In

IINKEditor.h

import_:data:block:error:

- (BOOL)import_:(IINKMimeType)mimeType data:(nonnull NSString *)data block:(nullable IINKContentBlock *)block error:(NSError *_Nullable *_Nullable)error
Discussion

Imports data into the part, or a block.

Parameters

mimeType

the mime type that specifies the format of data.

data

the data to import.

block

the target block, or nullptr to let editor detect the target.

error

the recipient for the error description object * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when the specified mime type is not supported.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

listStyleClasses:

- (nonnull NSDictionary *)listStyleClasses:(BOOL ( *_Nonnull ) ( NSString *_Nonnull ))predicate
Discussion

Lists the style classes that match a given predicate, associated with their styling properties.

Parameters

predicate

a function that checks style class names and returns true if class should be added to the returned map, otherwise false.

Return Value

a map associating class names with styling properties (NSString->IINKStyle).

Declared In

IINKEditor.h

paste:error:

- (BOOL)paste:(CGPoint)position error:(NSError *_Nullable *_Nullable)error
Discussion

Pastes the content of the internal clipboard at a given position. Internal clipboard is filled by calling copy(). If internal clipboard is empty, this does nothing.

Note: following limitation applies: the part managed by this editor must be a “Text Document” and clipboard must contain a single block, that is not a “Container”, from a “Text Document”.

Parameters

position

the target pasted block coordinates.

error

the recipient for the error description object * IINKErrorRuntime when editor is not associated with a part. * IINKErrorRuntime when content of the clipboard cannot be pasted on the part.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

pointerCancel:error:

- (BOOL)pointerCancel:(NSInteger)pointerId error:(NSError *_Nullable *_Nullable)error
Discussion

Cancels an ongoing pointer trace.

Parameters

pointerId

the id of the pointer.

error

the recipient for the error description object * IINKErrorInvalidArgument when pointerId is invalid. * IINKErrorRuntime when pointerDown() has already been called.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

pointerDown:at:force:type:pointerId:error:

- (nonnull NSString *)pointerDown:(CGPoint)point at:(int64_t)t force:(float)f type:(IINKPointerType)type pointerId:(NSInteger)pointerId error:(NSError *_Nullable *_Nullable)error
Discussion

Registers a pointer down event.

Parameters

point

pointer event coordinates.

t

pointer event timestamp.

f

normalized pressure.

type

the type of input.

pointerId

the id of the pointer.

error

the recipient for the error description object * IINKErrorInvalidArgument when pointerId is invalid. * IINKErrorInvalidArgument when x or y is not a number. * IINKErrorInvalidArgument when f is not a number or is negative. * IINKErrorRuntime when pointerDown() has already been called.

Return Value

the render item identifier of the starting stroke if any, otherwise an empty string.

Declared In

IINKEditor.h

pointerEvents:count:doProcessGestures:error:

- (BOOL)pointerEvents:(nonnull IINKPointerEvent *)events count:(NSInteger)count doProcessGestures:(BOOL)processGestures error:(NSError *_Nullable *_Nullable)error
Discussion

Sends a series of pointer events.

Note: this method can be used to perform batch recognition by representing the sequence of digital ink strokes as a series of pointer events and sending them with the gesture processing disabled.

Parameters

events

the list of events.

count

the event count.

processGestures

tells whether to process gestures or not.

error

the recipient for the error description object * IINKErrorInvalidArgument when pointerId is invalid.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

pointerMove:at:force:type:pointerId:error:

- (BOOL)pointerMove:(CGPoint)point at:(int64_t)t force:(float)f type:(IINKPointerType)type pointerId:(NSInteger)pointerId error:(NSError *_Nullable *_Nullable)error
Discussion

Registers a pointer move event.

Parameters

point

pointer event coordinates.

t

pointer event timestamp.

f

normalized pressure.

type

the type of input.

pointerId

the id of the pointer.

error

the recipient for the error description object * IINKErrorInvalidArgument when pointerId is invalid. * IINKErrorInvalidArgument when x or y is not a number. * IINKErrorInvalidArgument when f is not a number or is negative. * IINKErrorRuntime when pointerDown() has already been called.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

pointerUp:at:force:type:pointerId:error:

- (BOOL)pointerUp:(CGPoint)point at:(int64_t)t force:(float)f type:(IINKPointerType)type pointerId:(NSInteger)pointerId error:(NSError *_Nullable *_Nullable)error
Discussion

Registers a pointer up event.

Parameters

point

pointer event coordinates.

t

pointer event timestamp.

f

normalized pressure.

type

the type of input.

pointerId

the id of the pointer.

error

the recipient for the error description object * IINKErrorInvalidArgument when pointerId is invalid. * IINKErrorInvalidArgument when x or y is not a number. * IINKErrorInvalidArgument when f is not a number or is negative. * IINKErrorRuntime when pointerDown() has already been called.

Return Value

YES on success, otherwise NO.

Declared In

IINKEditor.h

redo

- (void)redo
Discussion

Redo the last action reverted by undo on part.

Declared In

IINKEditor.h

removeBlock:error:

- (BOOL)removeBlock:(nonnull IINKContentBlock *)block error:(NSError *_Nullable *_Nullable)error
Discussion

Removes a block from the part.

Note: the root block cannot be removed.

Parameters

block

the block to remove.

error

the recipient for the error description object * IINKErrorRuntime when editor is not associated with a part.

Return Value

YES on succerss, otherwise NO.

Declared In

IINKEditor.h

setFontMetricsProvider:

- (void)setFontMetricsProvider:(nonnull id<IINKIFontMetricsProvider>)fontMetricsProvider
Discussion

Sets a font metrics provider to this editor.

Parameters

fontMetricsProvider

a IINKIFontMetricsProvider.

Declared In

IINKEditor.h

setViewSize:

- (void)setViewSize:(CGSize)viewSize
Discussion

Sets the size of the view.

Parameters

viewSize

the view size.

Declared In

IINKEditor.h

undo

- (void)undo
Discussion

Undo the last action on part.

Declared In

IINKEditor.h

waitForIdle

- (void)waitForIdle
Discussion

Waits until part modification operations are over.

Declared In

IINKEditor.h