web/assets/libs/ckeditor/4.6.7/plugins/link/dialogs/anchor.js
(开头部分) 1KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
/**
* @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved.
* For licensing, see LICENSE.md or http://ckeditor.com/license
*/
CKEDITOR.dialog.add( 'anchor', function( editor ) {
// Function called in onShow to load selected element.
var loadElements = function( element ) {
this._.selectedElement = element;
var attributeValue = element.data( 'cke-saved-name' );
this.setValueOf( 'info', 'txtName', attributeValue || '' );
};
function createFakeAnchor( editor, attributes ) {
return editor.createFakeElement( editor.document.createElement( 'a', {
attributes: attributes
} ), 'cke_anchor', 'anchor' );
}
return {
title: editor.lang.link.anchor.title,
minWidth: 300,
minHeight: 60,
onOk: function() {
var name = CKEDITOR.tools.trim( this.getValueOf( 'info', 'txtName' ) );
var attributes = {
id: name,
name: name,
'data-cke-saved-name': name
};
if ( this._.selectedElement ) {
if ( this._.selectedElement.data( 'cke-realelement' ) ) {
var newFake = createFakeAnchor( editor, attributes );
newFake.replace( this._.selectedElement );
// Selecting fake element for IE. (#11377)
if ( CKEDITOR.env.ie )
editor.getSelection().selectElement( newFake );
} else {
this._.selectedElement.setAttributes( attributes );
}
} else {
var sel = editor.getSelection(),
range = sel && sel.getRanges()[ 0 ];
// Empty anchor
if ( range.collapsed ) {
var anchor = createFakeAnchor( editor, attributes );
range.insertNode( anchor );
} else {
if ( CKEDITOR.env.ie && CKEDITOR.env.version < 9 )
attributes[ 'class' ] = 'cke_anchor';
// Apply style.
var style = new CKEDITOR.style( { element: 'a', attributes: attributes } );
style.type = CKEDITOR.STYLE_INLINE;
editor.applyStyle( style );
}
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。