RawViewer

RawViewer

new RawViewer(options)

Description:
  • Represents a RawViewer object.

Source:
Parameters:
Name Type Description
options object

Options for configuring the RawViewer.

Properties
Name Type Attributes Default Description
container jQuery <optional>
$("#previewRawData")

The container element for the RawViewer.

Members

container :jQuery

Description:
  • The container element for the RawViewer.

Source:

The container element for the RawViewer.

Type:
  • jQuery

feather :number

Description:
  • The feather value for the RawViewer.

Source:

The feather value for the RawViewer.

Type:
  • number

options :object

Description:
  • Options for configuring the RawViewer.

Source:
Properties:
Name Type Attributes Default Description
container jQuery <optional>
$("#previewRawData")

The container element for the RawViewer.

Options for configuring the RawViewer.

Type:
  • object

Methods

addContextMenu(elm, obj, optionsopt)

Description:
  • Adds a context menu to the specified element.

Source:
Parameters:
Name Type Attributes Default Description
elm HTMLElement

The element to which the context menu will be added.

obj object

An object.

options object <optional>
{}

Additional options.

Properties
Name Type Attributes Default Description
externalEditor boolean <optional>
false

Whether to enable options for opening with external editors.

addTextPreview(textObj, optionsopt) → {Promise.<jQuery>}

Description:
  • Adds text preview to the RawViewer.

Source:
Parameters:
Name Type Attributes Description
textObj object | string

The text object or string to be previewed.

options object <optional>

Additional options.

Properties
Name Type Attributes Default Description
lineStart number <optional>
1

The line number to start the preview.

language string <optional>
"html"

The language of the text for syntax highlighting.

Returns:
  • A promise resolving to the jQuery object of the added text preview.
Type
Promise.<jQuery>

addTextPreviewFromFileOffset(file, offsetStart, offsetEnd, optionsopt) → {Promise.<jQuery>}

Description:
  • Adds a text preview from a file offset to the RawViewer.

Source:
Parameters:
Name Type Attributes Description
file string

The path of the file.

offsetStart number

The starting offset in the file.

offsetEnd number

The ending offset in the file.

options object <optional>

Additional options.

Properties
Name Type Attributes Description
language string <optional>

The language for syntax highlighting.

Returns:
  • A promise resolving to the jQuery object of the added text preview.
Type
Promise.<jQuery>

addTextPreviewFromTextOffset(text, offsetStart, offsetEnd, optionsopt) → {Promise.<jQuery>}

Description:
  • Adds a text preview from a text offset to the RawViewer.

Source:
Parameters:
Name Type Attributes Description
text string

The text content.

offsetStart number

The starting offset in the text.

offsetEnd number

The ending offset in the text.

options object <optional>

Additional options.

Properties
Name Type Attributes Description
language string <optional>

The language for syntax highlighting.

data object <optional>

Additional data.

Returns:
  • A promise resolving to the jQuery object of the added text preview.
Type
Promise.<jQuery>

append(html) → {jQuery}

Description:
  • Appends HTML content to the RawViewer container.

Source:
Parameters:
Name Type Description
html string

The HTML content to append.

Returns:
  • The container element after appending the HTML content.
Type
jQuery

clear()

Description:
  • Clears the RawViewer.

Source:

commonHandleFile(selectedCell, language, offsetList, filePathopt)

Source:
Parameters:
Name Type Attributes Description
selectedCell Object

Selected cell object passed from event onLoadSnippet

language String

language of the snippet, determines syntax highlight

offsetList Array.<Object>

Array of object (because one row can have more than one occurance of string)

Properties
Name Type Description
start integer

Offset start of the string

end integer

Offset end of the string

filePath string <optional>

Path to the file. By default the file in the original project location / cache.

getKeyString() → {string}

Description:
  • Gets the key string from the selection info.

Source:
Returns:
  • The key string.
Type
string

getSnippetFromOffset(text, offsetStart, offsetEndopt) → {object}

Description:
  • Gets a snippet of text from the given offsets in the text.

Source:
Parameters:
Name Type Attributes Default Description
text string

The text.

offsetStart number

The starting offset.

offsetEnd number <optional>
offsetStart

The ending offset.

Returns:
  • The snippet of text.
Type
object

getStartingLineFromOffset(text, offsetStart) → {number}

Description:
  • Gets the starting line number from the offset in the text.

Source:
Parameters:
Name Type Description
text string

The text.

offsetStart number

The starting offset.

Returns:
  • The starting line number.
Type
number

handleAttachment(selectedCell, language, offsetListopt)

Description:
  • Handles attachment content by adding text previews with context menus.

Source:
Parameters:
Name Type Attributes Description
selectedCell object

The selected cell object.

language string

The language for syntax highlighting.

offsetList Array.<object> <optional>

The list of offsets.

init()

Description:
  • Initializes the RawViewer by setting event listeners and loading Prism.

Source:

isClear() → {boolean}

Description:
  • Checks if the RawViewer is clear.

Source:
Returns:
  • Indicates whether the RawViewer is clear.
Type
boolean

loadPrism()

Description:
  • Loads Prism CSS stylesheet if not already loaded, and initializes Prism library if not already initialized.

Source:

openFile(path) → {Promise.<string>}

Description:
  • Opens a file asynchronously and reads its content.

Source:
Parameters:
Name Type Description
path string

The path of the file to open.

Returns:
  • A promise resolving to the content of the file.
Type
Promise.<string>

setListener()

Description:
  • Sets event listeners for the RawViewer.

Source: