Forum

Thread tagged as: Question, Problem

Customize MarkItUp in Perch 3

I am upgrading several websites from Perch 2 to 3. In many I used a customized version of the markitup-editor. I tried to get this following the instructions, but it does not work as needed. Can you please have a look to my config-file?

In the following version I only need bold, italic, file and link:

Perch.UserConfig.markitup = function(){

var get = function(profile, config, field) {

return {
nameSpace: 'markdown',
previewParserPath: '',
onTab: {keepDefault:false, openWith:' '},
onShiftEnter: {keepDefault:false, openWith:'\n\n'},
// markupSet: [
// {name:'Heading', key:'1', className:'fa fa-header', dropMenu: [
// {name:'Heading 1', className:'fa fa-header', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '='); }, placeHolder:'Your title here...' },
// {name:'Heading 2', className:'fa fa-header', closeWith:function(markItUp) { return miu.markdownTitle(markItUp, '-'); }, placeHolder:'Your title here...' },
// {name:'Heading 3', className:'fa fa-header', openWith:'### ', placeHolder:'Your title here...' },
// {name:'Heading 4', className:'fa fa-header', openWith:'#### ', placeHolder:'Your title here...' },
// {name:'Heading 5', className:'fa fa-header', openWith:'##### ', placeHolder:'Your title here...' },
// {name:'Heading 6', className:'fa fa-header', openWith:'###### ', placeHolder:'Your title here...' }
// ]},
{name:'Bold', className:'fa fa-bold', key:'B', openWith:'**', closeWith:'**'},
{name:'Italic', className:'fa fa-italic', key:'I', openWith:'_', closeWith:'_'},
// {name:'Script type', className:'fa fa-superscript', dropMenu: [
// {name:'Superscript', className:'fa fa-superscript', openWith:'<sup>', closeWith:'</sup>' },
// {name:'Subscript', className:'fa fa-subscript', openWith:'<sub>', closeWith:'</sub>' }
// ]},
// {name:'Text size', className:'fa fa-text-height', dropMenu: [
// {name:'Big', className:'fa fa-text-height', openWith:'<big>', closeWith:'</big>' },
// {name:'Small', className:'fa fa-text-height', openWith:'<small>', closeWith:'</small>' }
// ]},
// {name:'Quotes', className:'fa fa-quote-left', openWith:'> '},
// {name:'Bulleted List', className:'fa fa-list-ul', openWith:'- ' },
// {name:'Numeric List', className:'fa fa-list-ol', openWith:function(markItUp) {
return markItUp.line+'. ';
}},
// {name:'Picture', className:'image-upload fa fa-picture-o', openWith:function(markItUp){miu.ImageUpload.upload(markItUp,'markdown');}},
{name:'File', className:'file-upload fa fa-file-o', openWith:function(markItUp){miu.ImageUpload.upload(markItUp,'markdown',true);}},
{name:'Link', className:'fa fa-link', key:'L', openWith:'[', closeWith:']([![URL:!:https://]!] "[![Title]!]")', placeHolder:'Your text to link here...' }
]
};
};

var load = function(cb) {
cb();
};

return {
'get': get,
'load': load
}

}();

Your help is much appreciated!

Martin Stettler

Martin Stettler 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

What's happening with it?

I still see the full set although several lines are commented out.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you enabled PERCH_CUSTOM_EDITOR_CONFIGS ?

Yes. The only hidden elements when commented out, are script type and text size. Does this helps?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you on Perch 3.0.10?

Yes, 3.0.10

Drew McLellan

Drew McLellan 2638 points
Perch Support

I can't see immediately by looking at the code you've pasted. Are you getting any errors? Have you tried actually deleting the parts you don't want instead of commenting them out?

There were no errors, but after deleting the unused parts, it works fine, thanks a lot, Drew!

Very informative thread.