drjyvoi734793 2013-09-24 19:53
浏览 121
已采纳

适用于使用ckEditor进行内联编辑

I'm creating an inline CMS using ckeditor. The idea is:

  • Client logs into admin area
  • Login beings a session
  • Client is directed to pages on their website where they can edit predefined regions

The regions are specified with the contenteditable attribute:

<div contenteditable="true">
  safsdfdfsdfdfsdfsdfds
</div>

Since a session is created when the client logs in, I've written some PHP that knows to enable ckEditor and all the CMS functionality if the client is logged in.

The issue I have, is when not logged in, contenteditable="true" on divs still allows you to edit them without a WYSIWYG as the default behaviour for the browser. Obviously this is no good. How do I stop users being able to edit the page?

  • 写回答

2条回答 默认 最新

  • duanba4254 2013-09-24 19:58
    关注

    You could setup the divs like that:

    <div data-contenteditable="true">
    

    And have a JavaScript (if in admin mode) go over all divs (document.getElementsByTagName("div")) and if they have data-contenteditable set the real contenteditable.

    Otherwise let the server only include contenteditable if in admin mode

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置