Created
November 28, 2019 19:01
-
-
Save mcunha98/bfbba247862d20c375983154ee467d49 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| Mesmo colocando no config do ckeditor a toolbar nunca aparecia, pois aqui dentro eu | |
| tive que forçar para ser anexada ao toolbar insert por exemplo. | |
| */ | |
| CKEDITOR.plugins.add('strinsert', | |
| { | |
| requires : ['richcombo'], | |
| init : function( editor ) | |
| { | |
| //tag, texto, tooltip | |
| var cliente = []; | |
| cliente.push(['{$cliente_nome}', 'Nome', 'Insere esta tag no documento']); | |
| cliente.push(['{$cliente_email}', 'Email', 'Insere esta tag no documento']); | |
| cliente.push(['{$cliente_cpfcnpj}', 'Cpf/Cnpj', 'Insere esta tag no documento']); | |
| cliente.push(['{$cliente_senha_nova}', 'Senha nova', 'Insere esta tag no documento']); | |
| var endereco = []; | |
| endereco.push(['{$endereco_nome}', 'Nome', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_logradouro}', 'Logradouro', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_numero}', 'Número', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_complemento}', 'Complemento', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_bairro}', 'Bairro', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_cidade}', 'Cidade', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_uf}', 'UF', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_cep}', 'CEP', 'Insere esta tag no documento']); | |
| endereco.push(['{$endereco_completo}', 'Endereço completo', 'Insere esta tag no documento']); | |
| var condicao = []; | |
| condicao.push(['{$condicao_nome}', 'Nome', 'Insere esta tag no documento']); | |
| condicao.push(['{$condicao_instrucoes}', 'Instrucoes', 'Insere esta tag no documento']); | |
| condicao.push(['{$condicao_parcelas}', 'Num. de parcelas', 'Insere esta tag no documento']); | |
| var forma = []; | |
| forma.push(['{$forma_nome}', 'Nome', 'Insere esta tag no documento']); | |
| var loja = []; | |
| loja.push(['{$loja_nome}', 'Nome', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_razao_social}', 'Razão social', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_link}', 'Link da loja', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_atendimento}', 'Horário de atendimento', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_cnpj}', 'Cnpj', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_email}', 'E-mail', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_endereco}', 'Endereço', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_endereco_numero}', 'Número', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_endereco_complemento}', 'Complemento', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_endereco_cep}', 'CEP', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_endereco_bairro}', 'Bairro', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_endereco_cidade}', 'Cidade', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_endereco_uf}', 'UF', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_ie}', 'Insc.Estadual', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_im}', 'Insc.Municipal', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_telefone}', 'Telefone', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_celular}', 'Celular', 'Insere esta tag no documento']); | |
| loja.push(['{$loja_imagem}', 'Logotipo', 'Insere esta tag no documento']); | |
| var pedido = []; | |
| pedido.push(['{$pedido_items}', 'Itens do pedido', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_numero}', 'Número', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_codigo_rastreio}', 'Código de rastreio', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_prazo_entrega}', 'Prazo de entrega', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_valor_frete}', 'Valor do frete', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_valor_desconto}', 'Valor do desconto', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_valor_desconto_cupom}', 'Valor do cupom de desconto', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_valor_subtotal}', 'Valor do sub-total', 'Insere esta tag no documento']); | |
| pedido.push(['{$pedido_valor_total}', 'Valor total', 'Insere esta tag no documento']); | |
| var boleto = []; | |
| boleto.push(['{$boleto_url}', 'Url do boleto', 'Insere esta tag no documento']); | |
| editor.ui.addRichCombo('strinsert', | |
| { | |
| toolbar: 'insert', | |
| label: 'Dicionario', | |
| title: 'Dicionario', | |
| voiceLabel: 'Dicionario', | |
| className: 'cke_format', | |
| multiSelect:false, | |
| panel: | |
| { | |
| css: [ editor.config.contentsCss, CKEDITOR.skin.getPath('editor') ], | |
| voiceLabel: editor.lang.panelVoiceLabel | |
| }, | |
| init: function() | |
| { | |
| this.startGroup("Cliente"); | |
| for (var i in cliente) | |
| { | |
| this.add(cliente[i][0], cliente[i][1], cliente[i][2]); | |
| } | |
| this.startGroup("Endereco"); | |
| for (var i in endereco) | |
| { | |
| this.add(endereco[i][0], endereco[i][1], endereco[i][2]); | |
| } | |
| this.startGroup("Condição de pagamento"); | |
| for (var i in condicao) | |
| { | |
| this.add(condicao[i][0], condicao[i][1], condicao[i][2]); | |
| } | |
| this.startGroup("Forma de pagamento"); | |
| for (var i in forma) | |
| { | |
| this.add(forma[i][0], forma[i][1], forma[i][2]); | |
| } | |
| this.startGroup("Loja"); | |
| for (var i in loja) | |
| { | |
| this.add(loja[i][0], loja[i][1], loja[i][2]); | |
| } | |
| this.startGroup("Pedido"); | |
| for (var i in pedido) | |
| { | |
| this.add(pedido[i][0], pedido[i][1], pedido[i][2]); | |
| } | |
| this.startGroup("Boleto"); | |
| for (var i in boleto) | |
| { | |
| this.add(boleto[i][0], boleto[i][1], boleto[i][2]); | |
| } | |
| }, | |
| onClick: function( value ) | |
| { | |
| editor.focus(); | |
| editor.fire( 'saveSnapshot' ); | |
| editor.insertHtml(value); | |
| editor.fire( 'saveSnapshot' ); | |
| } | |
| }); | |
| } | |
| }); | |
| /* | |
| E o arquivo config.js do ckeditor ficou assim | |
| */ | |
| CKEDITOR.editorConfig = function( config ) { | |
| config.uiColor = '#ffffff'; | |
| config.language = 'pt-br'; | |
| config.filebrowserBrowseUrl = CKEDITOR.basePath + 'kcfinder/browse.php'; | |
| config.filebrowserImageBrowseUrl = CKEDITOR.basePath + 'kcfinder/browse.php?type=images'; | |
| config.filebrowserImageUploadUrl = CKEDITOR.basePath + 'kcfinder/upload.php?type=images'; | |
| config.enterMode = CKEDITOR.ENTER_BR; | |
| config.toolbarGroups = [ | |
| { name: 'clipboard' }, | |
| { name: 'editing', groups: ['find','selection']}, | |
| { name: 'basicstyles', groups: ['basicstyles','cleanup']}, | |
| { name: 'colors' }, | |
| { name: 'links' }, | |
| { name: 'insert' }, | |
| { name: 'paragraph', groups: ['list','align']}, | |
| { name: 'tools'}, | |
| { name: 'styles'}, | |
| ]; | |
| config.removeButtons = 'Source,Save,Print,NewPage,Preview,Styles,Font,Anchor,PageBreak,Maximize,Superscript,Subscript,Flash,Iframe,ShowBlocks'; | |
| config.format_tags = 'p;h1;h2;h3;pre'; | |
| config.removeDialogTabs = 'image:advanced;link:advanced'; | |
| config.autoUpdateElement = true; | |
| config.extraPlugins = 'youtube,strinsert'; | |
| config.removePlugins = 'elementspath'; | |
| config.resize_enabled = false; | |
| }; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment