@@ -1792,7 +1792,7 @@ function RemoteFunctions(config = {}) {
17921792 const leftPos = offset . left ;
17931793
17941794 // if element is non-editable we use gray bg color in info box, otherwise normal blue color
1795- const bgColor = this . element . hasAttribute ( 'data-brackets-id' ) ? '#4285F4' : '#666666 ' ;
1795+ const bgColor = this . element . hasAttribute ( 'data-brackets-id' ) ? '#4285F4' : '#3C3F41 ' ;
17961796
17971797 const styles = `
17981798 :host {
@@ -3846,6 +3846,12 @@ function RemoteFunctions(config = {}) {
38463846 dismissImageRibbonGallery ( ) ;
38473847 }
38483848
3849+ // if element is not editable and user clicks on it, then we show a toast notification saying
3850+ // that this element is not editable
3851+ if ( ! element . hasAttribute ( "data-brackets-id" ) ) {
3852+ showToast ( "Element not editable - generated by script" ) ;
3853+ }
3854+
38493855 // make sure that the element is actually visible to the user
38503856 if ( isElementVisible ( element ) ) {
38513857 // Only show more options box for editable elements (have data-brackets-id)
@@ -4540,6 +4546,78 @@ function RemoteFunctions(config = {}) {
45404546 dismissImageRibbonGallery ( ) ;
45414547 }
45424548
4549+ let _toastTimeout = null ;
4550+
4551+ /**
4552+ * this function is to show a toast notification at the bottom center of the screen
4553+ * this toast message is used when user tries to edit a non-editable element
4554+ * @param {String } message - the message to display in the toast
4555+ */
4556+ function showToast ( message ) {
4557+ // clear any existing toast & timer, if there are any
4558+ const existingToast = window . document . getElementById ( 'phoenix-toast-notification' ) ;
4559+ if ( existingToast ) {
4560+ existingToast . remove ( ) ;
4561+ }
4562+ if ( _toastTimeout ) {
4563+ clearTimeout ( _toastTimeout ) ;
4564+ }
4565+
4566+ // create a new fresh toast container
4567+ const toast = window . document . createElement ( 'div' ) ;
4568+ toast . id = 'phoenix-toast-notification' ;
4569+ const shadow = toast . attachShadow ( { mode : 'open' } ) ;
4570+
4571+ const styles = `
4572+ :host {
4573+ all: initial !important;
4574+ }
4575+
4576+ .toast-container {
4577+ position: fixed !important;
4578+ bottom: 30px !important;
4579+ left: 50% !important;
4580+ transform: translateX(-50%) translateY(0) !important;
4581+ background-color: #333333f2 !important;
4582+ color: white !important;
4583+ padding: 10px 12px !important;
4584+ border-radius: 6px !important;
4585+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
4586+ font-family: Arial, sans-serif !important;
4587+ font-size: 13px !important;
4588+ line-height: 1.4 !important;
4589+ z-index: 2147483647 !important;
4590+ pointer-events: none !important;
4591+ text-align: center !important;
4592+ max-width: 90% !important;
4593+ box-sizing: border-box !important;
4594+ animation: slideUp 0.3s ease-out !important;
4595+ }
4596+
4597+ @keyframes slideUp {
4598+ from {
4599+ opacity: 0;
4600+ transform: translateY(20px);
4601+ }
4602+ to {
4603+ opacity: 1;
4604+ transform: translateY(0);
4605+ }
4606+ }
4607+ ` ;
4608+
4609+ shadow . innerHTML = `<style>${ styles } </style><div class="toast-container">${ message } </div>` ;
4610+ window . document . body . appendChild ( toast ) ;
4611+
4612+ // Auto-dismiss after 3 seconds
4613+ _toastTimeout = setTimeout ( ( ) => {
4614+ if ( toast && toast . parentNode ) {
4615+ toast . remove ( ) ;
4616+ }
4617+ _toastTimeout = null ;
4618+ } , 3000 ) ;
4619+ }
4620+
45434621 /**
45444622 * Helper function to cleanup previously clicked element highlighting and state
45454623 */
0 commit comments