패키지, 저장소 및 앱 카테고리 검색

패키지 상세v0.7.14+5.65.18

codemirror

CodeMirror 텍스트 편집기 주위의 Dart 래퍼입니다.

Web
30일 다운로드
1.3천
좋아요
20
Pub 점수
120

패키지 설치

flutter pub add codemirror

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

CodeMirror 텍스트 에디터용 Dart 래퍼로, Flutter 웹 애플리케이션에서 풍부한 코드 편집 기능을 가능하게 합니다. 구문 강조, 줄 번호, 사용자 정의 테마를 제공하며, 브라우저에서 직접 강력한 CodeMirror 라이브러리를 활용합니다. 이 패키지는 인터랙티브 코드 에디터, IDE와 유사한 기능, 또는 특정 언어의 구문 지원이 필요한 고급 텍스트 편집이 필요한 모든 애플리케이션에 적합합니다. 웹 전용 Flutter 프로젝트에서는 원활한 통합을 통해 익숙하고 성능이 우수한 편집 경험을 보장합니다.

사용 사례

  • 웹 기반 코드 편집기
  • 인터랙티브 코딩 튜토리얼
  • IDE와 유사한 웹 애플리케이션
  • 실시간 코드 협업
  • 구문 강조 입력 필드

주요 기능

  • 구문 강조
  • 행 번호
  • 사용자 정의 테마
  • 브라우저 기반 렌더링
  • CodeMirror 플러그인을 통한 확장 가능

적합한 대상

  • Flutter 웹 개발자
  • 교육 플랫폼
  • 코드 공유 도구
  • 개발자 도구
  • 웹 기반 IDE

고려 사항

  • 웹 전용 플랫폼 지원
  • 자바스크립트 상호 운용이 필요합니다
  • 브라우저 환경에 한정
  • 외부 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 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.