이 문서는 낙엽1124님이 페미위키:개선요청의 "시각편집기와 원본편집기에 {{주}} 사용 메뉴 추가" 주제의 게시물의 두 판 사이의 차이를 보여줍니다.
역사 문서에서 이 게시물의 다른 판을 볼 수 있습니다.
29번째 줄: | 29번째 줄: | ||
href: '틀:주', | href: '틀:주', | ||
wt: '주' | wt: '주' | ||
} | } | ||
} | } | ||
55번째 줄: | 52번째 줄: | ||
CommentTemplateTool.static.name = 'commentTemplate'; | CommentTemplateTool.static.name = 'commentTemplate'; | ||
CommentTemplateTool.static.group = ' | CommentTemplateTool.static.group = 'object'; | ||
CommentTemplateTool.static.title = '부연 설명'; | CommentTemplateTool.static.title = '부연 설명'; | ||
CommentTemplateTool.static.icon = 'reference'; | CommentTemplateTool.static.icon = 'reference'; | ||
CommentTemplateTool.static.commandName = 'commentTemplate'; | CommentTemplateTool.static.commandName = 'commentTemplate'; | ||
CommentTemplateTool.static.modelClasses = ve.ui.toolFactory.lookup('reference').static.modelClasses; | |||
CommentTemplateTool.static.autoAddToCatchall = false; | CommentTemplateTool.static.autoAddToCatchall = false; | ||
CommentTemplateTool.prototype.onUpdateState = function() { | CommentTemplateTool.prototype.onUpdateState = function() { | ||
70번째 줄: | 67번째 줄: | ||
var toolbarGroups = ve.init.mw.Target.static.toolbarGroups; | var toolbarGroups = ve.init.mw.Target.static.toolbarGroups; | ||
toolbarGroups[ 4 ].label='각주'; | |||
toolbarGroups[ 4 ].include.push( 'commentTemplate' ); | toolbarGroups[ 4 ].include.push( 'commentTemplate' ); | ||
ve.ui.toolFactory.lookup('reference').static.title='출처'; | |||
ve.ui.toolFactory.lookup('reference/existing').static.title='출처 재사용'; | |||
} | } | ||
76번째 줄: | 77번째 줄: | ||
mw.loader.using( 'ext.visualEditor.desktopArticleTarget.init' ).done( function() { | mw.loader.using( 'ext.visualEditor.desktopArticleTarget.init' ).done( function() { | ||
mw.libs.ve.addPlugin( function() { | mw.libs.ve.addPlugin( function() { | ||
mw.loader.using( [ 'ext.visualEditor.core' ] ) | mw.loader.using( [ 'ext.visualEditor.core' ] ).done( function() { | ||
addCommentTemplateTool(); | addCommentTemplateTool(); | ||
} ); | |||
} ); | } ); | ||
} ); | } ); | ||
var customizeToolbar = function () { | |||
/* 왠지 작동 안함 | |||
$( '#wpTextbox1' ).on( 'wikiEditor-toolbar-buildSection-main', function( event, section ) { | |||
delete section.groups.insert.tools.reference["labelMsg"]; | |||
section.groups.insert.tools.reference.label = '출처'; | |||
} );*/ | |||
$( '#wpTextbox1' ).wikiEditor( 'addToToolbar', { | |||
'section': 'main', | |||
'group': 'insert', | |||
'tools': { | |||
'comment': { | |||
label: '부연 설명', | |||
type: 'button', | |||
icon: { | |||
sv: 'insert-reference.png' | |||
}, | |||
offset:{ | |||
sv: [2, -1798] | |||
}, | |||
action: { | |||
type: 'encapsulate', | |||
options: { | |||
pre: "{{주|", | |||
post: "}}" | |||
} | |||
} | |||
} | |||
} | |||
} ); | |||
}; | |||
if ( $.inArray( mw.config.get( 'wgAction' ), [ 'edit', 'submit' ] ) !== -1 ) { | |||
mw.loader.using( 'user.options' ).then( function () { | |||
if ( mw.user.options.get( 'usebetatoolbar' ) == 1 ) { | |||
$.when( | |||
mw.loader.using( 'ext.wikiEditor.toolbar' ), $.ready | |||
).then( customizeToolbar ); | |||
} | |||
} ); | |||
} | |||
</pre>{{글 숨김 끝}} | </pre>{{글 숨김 끝}} | ||
(6/13 추가)원본편집기 편집 도구 모음에도 추가했습니다. |