パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.7.14+5.65.18

codemirror

CodeMirrorテキストエディタのDartラッパー。

Web
30日間ダウンロード
1330
いいね数
20
Pub ポイント
120

パッケージをインストール

flutter pub add codemirror

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

CodeMirrorテキストエディタ用のDartラッパーであり、Flutterウェブアプリケーションで豊かなコード編集機能を可能にします。構文強調表示、行番号、カスタマイズ可能なテーマを提供し、ブラウザ上で強力なCodeMirrorライブラリを直接活用しています。このパッケージは、インタラクティブなコードエディタ、IDEのような機能、または言語固有の構文サポートを必要とするあらゆるアプリケーションの構築に最適です。ウェブ専用のFlutterプロジェクトでは、シームレスな統合により、馴染みやすくパフォーマンスの高い編集体験を実現します。

用途

  • ウェブベースのコードエディタ
  • インタラクティブなコーディングチュートリアル
  • IDEに似たWebアプリケーション
  • リアルタイムコード共同作業
  • 構文強調入力フィールド

主な機能

  • 構文ハイライト
  • 行番号
  • カスタマイズ可能なテーマ
  • ブラウザベースのレンダリング
  • CodeMirror プラグインによる拡張が可能

適している対象

  • Flutter web開発者
  • 教育プラットフォーム
  • コード共有ツール
  • 開発者ツール
  • ウェブベースのIDE

注意事項

  • Web専用プラットフォームサポート
  • JavaScript との相互運用が必要です
  • ブラウザ環境に限定
  • 外部の CodeMirror ライブラリに依存
  • バンドルサイズを増加させる可能性があります

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

codemirror.dart

Build Status pub package

What is it?

A Dart wrapper around the CodeMirror text editor. From codemirror.net:

CodeMirror is a versatile text editor implemented in JavaScript for the browser. It is specialized for editing code, and comes with a number of language modes and addons that implement more advanced editing functionality.

Note: This is NOT a Flutter package, it is a Dart package for writing web applications like DartPad.

An example

final options = <String, String>{
  'mode': 'javascript',
  'theme': 'monokai'
};

final editor = CodeMirror.fromElement(
    document.querySelector('#textContainer')!, options: options);
editor.doc.setValue('foo.bar(1, 2, 3);');

See also our example/ directory.

How do I use it?

In your main html file, link to the style sheet:

<link href="packages/codemirror/codemirror.css" rel="stylesheet">

reference the CodeMirror JavaScript code:

<script src="packages/codemirror/codemirror.js"></script>

and, in your Dart code, import the library:

import 'package:codemirror/codemirror.dart';

What about modes? Addons?

This Dart package ships with several language modes built in. CodeMirror itself supports over 100 modes; the modes built into the Dart package include the usual suspects for web development - css, html, dart and javascript as well as a few others. In order to add additional modes, you'll need to reference the mode file from your html entry point. So,

<script src="packages/codemirror/mode/lua.js"></script>

will bring in support for Lua.

Similarly with addons, we've included a few common ones, and have made the others available to import on a case-by-case basis. In order to use the active-line addon, import:

<script src="packages/codemirror/addon/selection/active-line.js"></script>

Be aware that many addons need additional configuration in order to enable then. This is generally done by passing values into the options of the CodeMirror constructor.

Some addons are exposed through the main Dart interface. Some are exposed via side-car Dart libraries available in the main package, and some have yet to be exposed. Pull requests welcome :)

Themes

By importing the codemirror.css file:

<link href="packages/codemirror/codemirror.css" rel="stylesheet">

You get access to all the CodeMirror themes. If you only want a few, or don't want to pay the network roundtrip cost to load all the themes, you can import only the ones you're interested in:

<link href="packages/codemirror/theme/monokai.css" rel="stylesheet">
<link href="packages/codemirror/theme/zenburn.css" rel="stylesheet">

Disclaimer

This is not an official Google product.

カテゴリー

依存関係

依存関係一覧 1 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。