Comparing version 0.0.6 to 0.1.0
@@ -9,6 +9,7 @@ ( function () { | ||
input: [ './demo/Editor.js', './demo/config.js' ], | ||
// input: [ '../ueditor-doc/_src/core/Editor.js', '../ueditor-doc/_src/core/EventBase.js', '../ueditor-doc/_src/core/browser.js', '../ueditor-doc/_src/core/ajax.js', '../ueditor-doc/_src/core/domUtils.js', '../ueditor-doc/_src/core/utils.js' ], | ||
input: [ '../ueditor-doc/_src/plugins/video.js' ], | ||
output: './api.html', | ||
view: require( "./views/ueditor" ), | ||
highlight: false, | ||
highlight: true, | ||
viewOptions: { | ||
@@ -15,0 +16,0 @@ assetsPath: '/doc/views/ueditor/' |
@@ -7,2 +7,3 @@ ( function () { | ||
TYPE = { | ||
'COMMAND': 'command', | ||
'METHOD': 'method', | ||
@@ -28,2 +29,19 @@ 'CONSTRUCTOR': 'constructor', | ||
type: TYPE.COMMAND, | ||
check: function ( data ) { | ||
return data.hasOwnProperty( TYPE.COMMAND ); | ||
}, | ||
format: function ( data ) { | ||
formatUtil[ TYPE.METHOD ]( data ); | ||
data[ TYPE.METHOD ] = data.name; | ||
data.name = data[ TYPE.COMMAND ][ 0 ]; | ||
delete data[ TYPE.COMMAND ]; | ||
} | ||
}, { | ||
type: TYPE.CONSTRUCTOR, | ||
@@ -206,2 +224,7 @@ | ||
//desc补充 | ||
if ( !data.hasOwnProperty( 'desc' ) ) { | ||
data[ 'desc' ] = [ "" ]; | ||
} | ||
if ( data.hasOwnProperty( "unfile" ) ) { | ||
@@ -208,0 +231,0 @@ delete data.unfile; |
@@ -79,4 +79,2 @@ ( function () { | ||
data; | ||
var type = definition.getType( block ); | ||
@@ -93,2 +91,6 @@ | ||
case definition.TYPE.COMMAND: | ||
Syntax.commandToTree( block, tree ); | ||
break; | ||
case definition.TYPE.EVENT: | ||
@@ -123,3 +125,28 @@ Syntax.eventToTree( block, tree ); | ||
}, | ||
//command特殊处理 | ||
commandToTree: function ( commandBlock, tree ) { | ||
var root = tree; | ||
if ( !root[ definition.TYPE.COMMAND ] ) { | ||
tree[ definition.TYPE.COMMAND ] = {}; | ||
} | ||
root = tree[ definition.TYPE.COMMAND ]; | ||
if ( !root[ commandBlock.name ] ) { | ||
root[ commandBlock.name ] = {}; | ||
} | ||
root = root[ commandBlock.name ]; | ||
//提取并重置execCommand的描述 | ||
if ( commandBlock.method === 'execCommand' ) { | ||
root._commandDesc = commandBlock.desc; | ||
commandBlock.desc = '执行当前命令'; | ||
} | ||
root[ commandBlock.method ] = commandBlock; | ||
}, | ||
@@ -126,0 +153,0 @@ |
{ | ||
"name": "udoc", | ||
"version": "0.0.6", | ||
"version": "0.1.0", | ||
"description": "The Javascript API Doc", | ||
@@ -5,0 +5,0 @@ "main": "./lib/doc.js", |
@@ -11,2 +11,3 @@ ( function () { | ||
NavRender = require( "./navrender" ), | ||
CommandRender = require( "./commandrender" ), | ||
VIEW_ENV = require( "./view.env" ), | ||
@@ -35,8 +36,17 @@ fileOptions = { | ||
$.forOwn( data, function ( moduleData ) { | ||
$.forOwn( data, function ( moduleData, key ) { | ||
transResult = transResult.concat( View.extractData( exampleKey, moduleData ) ); | ||
if ( key === 'command' ) { | ||
transResult = transResult.concat( View.extractCommandData( exampleKey, moduleData ) ); | ||
} else { | ||
transResult = transResult.concat( View.extractData( exampleKey, moduleData ) ); | ||
} | ||
} ); | ||
if ( !transResult.length ) { | ||
callback(); | ||
return; | ||
} | ||
//example 解析 | ||
@@ -49,3 +59,3 @@ transResult.forEach( function ( targetData ) { | ||
if ( /`{3}([^\n]*)\n([\s\S]*?)(\s*`{3}$|$)/.test( exp ) ) { | ||
if ( /`{3}([^\r\n]*)\r?\n([\s\S]*?)(\s*`{3}$|$)/.test( exp ) ) { | ||
@@ -86,2 +96,22 @@ //代码高亮 | ||
extractCommandData: function ( keyword, data ) { | ||
var result = []; | ||
$.forOwn( data, function ( commandData ) { | ||
$.forOwn( commandData, function ( commandMethod ) { | ||
if ( commandMethod.hasOwnProperty( keyword ) ) { | ||
result.push( commandMethod ); | ||
} | ||
} ); | ||
} ); | ||
return result; | ||
}, | ||
extractData: function ( keyword, data ) { | ||
@@ -124,4 +154,7 @@ | ||
var tplData = [], | ||
navTpl = View.renderNavigation( data ); | ||
navTpl = View.renderNavigation( data ), | ||
commandTpl = View.renderCommand( data.command ); | ||
delete data.command; | ||
$.forOwn( data, function ( moduleData ) { | ||
@@ -133,3 +166,7 @@ | ||
return View.renderPage( tplData, navTpl ); | ||
return View.renderPage( { | ||
navs: navTpl, | ||
members: tplData, | ||
command: commandTpl | ||
} ); | ||
@@ -150,7 +187,8 @@ }, | ||
renderPage: function ( tplData, navHtml ) { | ||
renderPage: function ( data ) { | ||
return this._renderTpl( 'layout.ejs', { | ||
modules: tplData, | ||
nav: navHtml | ||
modules: data.members, | ||
nav: data.navs, | ||
command: data.command | ||
} ); | ||
@@ -166,2 +204,8 @@ | ||
renderCommand: function ( data ) { | ||
return CommandRender.render( data ); | ||
}, | ||
renderModule: function ( moduleData ) { | ||
@@ -185,2 +229,3 @@ | ||
debugger; | ||
return View._renderTpl( 'module.ejs', moduleData ); | ||
@@ -187,0 +232,0 @@ |
/** | ||
* AutoComplete组件 | ||
* @file | ||
*/ | ||
@@ -8,2 +7,7 @@ | ||
'use strict'; | ||
//匹配结果最大条数 | ||
var MAX_COUNT = 11; | ||
var Util = { | ||
@@ -23,4 +27,12 @@ | ||
if ( searchText === "" ) { | ||
return result; | ||
} | ||
$.each( source, function ( index, item ) { | ||
if ( result.length >= MAX_COUNT ) { | ||
return false; | ||
} | ||
if ( item.toLowerCase().indexOf( searchText ) !== -1 ) { | ||
@@ -81,7 +93,2 @@ | ||
if ( evt.ctrlKey ) { | ||
return; | ||
} | ||
_self._inputValue = this.value; | ||
@@ -98,5 +105,12 @@ | ||
} ).on( "click", function () { | ||
return false; | ||
} ).on( "keydown", function ( evt ) { | ||
if ( evt.ctrlKey && evt.keyCode === 81 ) { | ||
$( document ).trigger( 'togglepanel' ); | ||
return false; | ||
} | ||
if ( evt.keyCode === 13 ) { | ||
@@ -103,0 +117,0 @@ |
@@ -8,2 +8,4 @@ /** | ||
'use strict'; | ||
//panle open state | ||
@@ -36,3 +38,3 @@ var PANEL_OPEN_STATE = false, | ||
$(document).on("keydown", function ( evt ) { | ||
$( document ).on("keydown", function ( evt ) { | ||
@@ -46,5 +48,4 @@ if ( isInput ) { | ||
!PANEL_OPEN_STATE ? showPanel() : hidePanel(); | ||
$( document ).trigger( 'togglepanel' ); | ||
//esc close | ||
@@ -58,4 +59,6 @@ } else if ( evt.keyCode === 27 ) { | ||
}).on( "click", function () { | ||
} ).on( "click", function () { | ||
complete.hide(); | ||
} ).on( "togglepanel", function () { | ||
!PANEL_OPEN_STATE ? showPanel() : hidePanel(); | ||
} ); | ||
@@ -97,4 +100,7 @@ | ||
PANEL_OPEN_STATE = false; | ||
document.documentElement.style.overflow = ''; | ||
document.body.style.overflow = ''; | ||
$searchPanel.hide(); | ||
$searchInput.blur(); | ||
complete.clear(); | ||
} | ||
@@ -104,2 +110,4 @@ | ||
PANEL_OPEN_STATE = true; | ||
document.documentElement.style.overflow = 'hidden'; | ||
document.body.style.overflow = 'hidden'; | ||
$searchPanel.show(); | ||
@@ -106,0 +114,0 @@ $searchInput.focus(); |
@@ -46,2 +46,5 @@ /** | ||
case ITEM_TYPE.COMMAND: | ||
return this.getCommandTitleHtml.apply( this, arguments ); | ||
case ITEM_TYPE.EVENT: | ||
@@ -106,2 +109,10 @@ return this.getEventTitleHtml.apply( this, arguments ); | ||
getCommandTitleHtml: function ( data ) { | ||
var cmd = data[ 'execCommand' ].name; | ||
return '<a name="COMMAND::'+ cmd +'" class="anchor">'+ cmd +'</a>'; | ||
}, | ||
//解析method签名HTML | ||
@@ -360,5 +371,11 @@ getMethodTitleHtml: function ( data, isLink, isWithPrefix ) { | ||
var start = data.module + "." + data.class + ":" + data.name, | ||
var start = data.module, | ||
paramStr = []; | ||
if ( data.hasOwnProperty("class") ) { | ||
start += "." + data['class'] + ':' + data.name; | ||
} else { | ||
start += '.' + data.name; | ||
} | ||
data.param && data.param.forEach( function ( par ) { | ||
@@ -365,0 +382,0 @@ paramStr.push( par.type ); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51
16196
664757
9