> ## Documentation Index
> Fetch the complete documentation index at: https://docs.langdock.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Document Editor

> The Document Editor opens as a panel in your chat so you can write and format documents, or build interactive applications with code, without leaving the conversation.

<Info>
  Canvas is now the Document Editor. Any Canvas files you created before are still accessible in their original chats.
</Info>

## Document Editor

The Document Editor opens as a panel alongside your chat, so you can write and iterate on documents without switching context. Use it when you want to draft a proposal, write a report, put together a project plan, or work on any longer piece you'll refine and share. Documents are saved to your [Library](/en/using-langdock/guides/library/library-guide) automatically, so they're accessible across all your chats. You can open the Document Editor in three ways:

* **Type a prompt** like "draft a proposal" or "create a report". The editor opens automatically.
* Click **Create document** in the input bar and choose your format: **Document**, **Word**, or **PDF**.
* Open the **Tools** menu and select **Create document**.

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/document_editor_startscreen.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=2a5469df9ac356812826d6f242b2e1ae" alt="Chat input bar with Create document active and the format selector showing Document, Word, and PDF options" style={{borderRadius: '6px'}} width="1818" height="1260" data-path="images/document_editor_startscreen.png" />
</Frame>

Once you have sent your prompt, the editor panel opens on the right side of the screen.

### Formatting

Edit your document directly in Langdock. Click anywhere to start typing, deleting, or rearranging content.

To add structure to your document, type: `/` anywhere to open the formatting menu. It's organized into three groups: headings and text styles under **Format**, **Lists**, and insertable elements under **Insert** including tables, code blocks, and an auto-generated table of contents.

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/document_editor_slash_command.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=6810b50b2069c7196a03e0e1d4f7a733" alt="Slash command menu open in the Document Editor showing Format, Lists, and Insert groups" style={{borderRadius: '6px'}} width="1800" height="1286" data-path="images/document_editor_slash_command.png" />
</Frame>

* **Heading 1**, **Heading 2**, **Heading 3**, **Heading 4**
* **Bullet List** and **Numbered List**
* **Blockquote** and **Code Block**
* **Tables**
* **Table of contents**
* **Divider**

The toolbar at the top of the editor shows the same options and is always visible. Use the expand icon in the top bar to switch to full-screen view when you want to focus on writing without the chat alongside.

### Edit with AI

The Document Editor lets you collaborate with the AI in two distinct ways: You can make edits on specific text, or broader changes across the whole document.

Select any text you would like to edit, and click the **Edit with AI** button that appears. This quotes your selection into the chat where you can type your instructions. The AI applies the change directly in the document.

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/document_editor_edit.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=b2ad490488305c7760a930392aedcdae" alt="Text selected in the Document Editor with the Edit with AI button appearing to the right" style={{borderRadius: '6px'}} width="2080" height="1344" data-path="images/document_editor_edit.png" />
</Frame>

For broader changes such as rewriting a section, adjusting the tone, or expanding content, type your instructions in the chat without selecting anything first. The AI edits the document and saves a new version automatically.

### Export your Document

When you're ready to use your document outside Langdock, export it directly from the editor. Click the download icon in the top bar and choose your format:

* **Download Markdown**
* **Download Word**
* **Download PDF**

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/document_editor_download.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=c58fb6651df445a58bac6a25f39364b3" alt="Download menu open in the Document Editor top bar showing Download Markdown, Download Word, and Download PDF options" style={{borderRadius: '6px'}} width="1792" height="1260" data-path="images/document_editor_download.png" />
</Frame>

<Warning>
  You can generate documents in the Document Editor and export them as PDF or Word files. It is not possible to edit Word or PDF files directly in the Document Editor.
</Warning>

## Working with Code

You can also work with code directly from within the Document Editor, so you can build interactive tools without leaving Langdock. Use it to build interactive outputs like data dashboards, charts, visualizations, and small tools for your team. All of your generated code is automatically saved to your [Library](/en/using-langdock/guides/library/library-guide), so it's accessible across all your chats. You can open the Document Editor in three ways:

* Type a prompt like "build me a budget tracker" or "create a bar chart from this data". Langdock automatically opens the editor for you.
* Click **Create document** in the input bar and describe what you want to build in your prompt.
* Open the **Tools** menu and select **Create document**.

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/code_editor_start_screen.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=3c139a1892a38b665e2df07f5ea2ce8d" alt="Chat input bar with a code prompt and the Create document button active" style={{borderRadius: '6px'}} width="1944" height="1272" data-path="images/code_editor_start_screen.png" />
</Frame>

### Code and Preview

Once your code is generated, you work with it in two views. Toggle between them at the top of the panel.

**Code** shows the full source file. You can read through it, edit it directly by clicking anywhere and typing, or ask the AI to make changes. Everything saves automatically.

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/code_editor_code_view.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=c8272cfd2ddc4f1580ba8d1f650c828b" alt="Code view in the Document Editor showing the HTML source of a monthly budget tracker" style={{borderRadius: '6px'}} width="2148" height="1300" data-path="images/code_editor_code_view.png" />
</Frame>

**Preview** renders your code live. Interact with it and test it directly before sharing or exporting.

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/code_editor_preview_view.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=51b310e88325900cc3cddc07aa353fe6" alt="Preview view in the Document Editor showing a running Monthly Budget Tracker" style={{borderRadius: '6px'}} width="2116" height="1278" data-path="images/code_editor_preview_view.png" />
</Frame>

### Debugging with AI

The Document Editor lets you iterate on your code with the AI directly from the chat. Type your instructions in the chat to add a feature, change the styling, fix a bug, or rework the layout, and the AI applies the change directly to the file and saves a new version automatically.

<Warning>
  If the preview fails to render, an error card appears. Click **Fix with AI** to send the error to the chat automatically. The AI reads it and applies a fix.
</Warning>

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/code_editor_runtime_error.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=769c07b2b86df56ad0e2a52810c68c6d" alt="Error running code dialog showing the error message and a Fix with AI button" style={{borderRadius: '6px'}} width="1858" height="940" data-path="images/code_editor_runtime_error.png" />
</Frame>

### Export your Code

When you're ready to use your file outside Langdock, download it directly from the editor. Click the download icon in the top bar. The file downloads in its native format: `.html`, `.jsx`, or `.tsx`.

## Version history

Every change is tracked automatically, for both documents and code files. Version history gives you a full record of every edit made to your file, whether by you or the AI, so nothing is ever lost.

Click **Version history** in the top bar to open the version panel. Each version is timestamped and attributed to either you or the AI. Select any version to see exactly what changed. Click **Restore version** to make it the current document or file.

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/document-editor_versioning.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=d931204ea22de7a5689fea7a5b8558b7" alt="Version history dialog showing a diff view of changes alongside a list of versions attributed to the user and AI" style={{borderRadius: '6px'}} width="1798" height="1282" data-path="images/document-editor_versioning.png" />
</Frame>

When you ask the AI for changes, it always builds on your most recent edits rather than an older version. This ensures your manual edits are never lost.

## Save to external storage

Both documents and code files can be sent directly to your team's storage without downloading and re-uploading them. Click the external storage button in the top bar. All three options are always visible. Click **Connect** next to any integration that isn't set up yet:

* **Open in SharePoint**
* **Open in OneDrive**
* **Open in Google Drive**

<Frame>
  <img src="https://mintcdn.com/langdock-34/9YEZVL8Ws7sKsDHd/images/document_editor_external_storage.png?fit=max&auto=format&n=9YEZVL8Ws7sKsDHd&q=85&s=2aee1a06ef83750fbddf5d0d26bdd7c6" alt="External storage dropdown showing Open in SharePoint, Open in OneDrive, and Open in Google Drive with Connect options" style={{borderRadius: '6px'}} width="1344" height="956" data-path="images/document_editor_external_storage.png" />
</Frame>

## Library

Whether you are working with documents or with code, everything you create is saved to your Library automatically. Your Library is the central home for all your files across Langdock, so you can always find and continue working on them across different chats.

<Frame>
  <img src="https://mintcdn.com/langdock-34/_l399knwBRIAaZ8e/images/document_editor_library.png?fit=max&auto=format&n=_l399knwBRIAaZ8e&q=85&s=d5adb0a27aac2ef63e534910caa87376" alt="Library view showing a document created in the Document Editor under Recent files" style={{borderRadius: '6px'}} width="1690" height="1774" data-path="images/document_editor_library.png" />
</Frame>

Open any document or file from the Library to keep editing.

## What happened to Canvas?

Canvas is now the Document Editor. Any documents or files you created in Canvas are still accessible in the original chats where they were created.

The Document Editor is built on what Canvas started, with version history, direct export to Google Drive, OneDrive, and SharePoint, and a Library where all your files are always accessible. They will be the foundation for new features coming to Langdock over time.

Prompts that include the word "Canvas" still open the relevant editor, so your team can continue using that language without any disruption.
