Giter Site home page Giter Site logo

xmarkdown's Introduction

功能简介

让textarea成为极简的markdown编辑器

支持自定义快捷键

使用

<script src="/path/xMarkdown.js"></script>
<script>
var md = xMarkdown.create('#editor');

// 获取数据
md.value();

// 重置数据
md.value('重新插入的数据');

// 获取焦点
md.focus();

// 失去焦点
md.blur();

// 在光标处插入字符 如有选中字符将进行替换
md.insert('要插入或替换的文本');

// 获取先中文本
md.selectionText();

// 获取光标信息
var cursor = md.cursor();

// cursor.text 当前光标所在行文本
// cursor.line 当前光标所在行序号
// cursor.lines textarea所有行数组
// cursor.start 选中区域开始位置
// cursor.end 选中区域结束位置

// 编辑状态
md.enable(true || false);

// 执行自定义方法
// @name 方法名
// @code 文本数据 可选
// @args 附加参数 可选
md.action(name , code , args);

md.action('bold'); // 加粗 Ctrl-B
md.action('italic'); // 斜体 Ctrl-I
md.action('link'); // 链接 Ctrl-K

// 支持 bold,italic,link,image,list,underline,code,codeblock,table,header,quote等
// 可以通过 xMarkdown.action自由扩展或修改原有功能

</script>

xmarkdown's People

Contributors

fonhen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.