Code Editor

type CodeEditor = {
    --// new() arguments
    Editable: boolean?,
    FontSize: number?,
    FontFace: FontFace?,
    
    --// Methods
    ApplyTheme: (self) -> nil,
    GetVersion: () -> string,
    ClearText: (self) -> nil,
    SetText: (self, Text: string) -> nil,
    GetText: (self) -> string,
    SetEditing: (self, Editing: boolean) -> nil,
    AppendText: (self, Text: string) -> nil,
    ResetSelection: (self, NoRefresh: boolean?) -> nil,
    GetSelectionText: (self) -> string,
    
    --// Properties
    Gui: Frame,
    Editing: boolean
}

Importing the editor:

local IDEModule = require(...IDEModule)

Example usage:

local EditorTab = TabSelector:CreateTab({
	Name = "Editor"
}) --> Canvas

local CodeEditor = IDEModule.CodeFrame.new({
    Editable = false,
    FontSize = 13,
    Colors = SyntaxColors,
    FontFace = TextFont
})

--// Parent and apply custom ReGui properties
ReGui:ApplyFlags({
	Object = CodeEditor.Gui,
	WindowClass = Window,
	Class = {
		--Border = true,
		Fill = true,
		Active = true,
		Parent = EditorTab:GetObject(), -- Canvas function
		BackgroundTransparency = 1,
	}
})

Last updated